From the PostgreSQL wiki,
MERGE
is typically used to merge two tables, and was introduced in the 2003 SQL standard. TheREPLACE
statement (a MySQL extension) or UPSERT sequence attempts anUPDATE
, or on failure,INSERT
. This is similar toUPDATE
, then for unmatched rows,INSERT
. Whether concurrent access allows modifications which could cause row loss is implementation independent.
Further PostgreSQL's INSERT ... ON CONFLICT DO NOTHING/UPDATE
is marketed as UPSERT and was added in 9.5
What then is MERGE
? And how does it fit into the mix?