{
  "id": "postgres-merge-table",
  "kind": "table",
  "slug": "postgres-merge",
  "iil_id": null,
  "note_url": "https://iinventedlight.com/library/notes/postgres-merge/",
  "title": "MERGE in PostgreSQL inserts, updates, or deletes based on a match",
  "columns": [
    "name",
    "source",
    "detail"
  ],
  "rows": [
    {
      "name": "WHEN MATCHED",
      "source": "PostgreSQL Global Development Group",
      "detail": "then merge_update, merge_delete, or DO NOTHING"
    },
    {
      "name": "WHEN NOT MATCHED BY SOURCE",
      "source": "PostgreSQL Global Development Group",
      "detail": "then merge_update, merge_delete, or DO NOTHING"
    },
    {
      "name": "WHEN NOT MATCHED [ BY TARGET ]",
      "source": "PostgreSQL Global Development Group",
      "detail": "then merge_insert or DO NOTHING"
    },
    {
      "name": "AND condition",
      "source": "PostgreSQL Global Development Group",
      "detail": "a condition on the when_clause"
    }
  ],
  "related_slugs": [
    "postgres-upsert-on-conflict",
    "postgres-transactions",
    "postgres-views"
  ],
  "license": "CC-BY-4.0",
  "source_license": "PostgreSQL License (PostgreSQL Global Development Group); PostgreSQL License (PostgreSQL Global Development Group); prose restates cited source lines in own words",
  "as_of": "2026-11-20",
  "status": "deep-draft-20261120",
  "note": "Restated from the note's GREEN sources; check those sources before relying on a value."
}