Postgres non ha MERGE dichiarazione:
https://www.postgresql.org/docs/current/static /sql-comandi.html
Usa INSERT ON CONFLICT DO invece:
https://www.postgresql.org/docs/current/static /sql-insert.html
Ci sono alcuni movimenti verso MERGER dichiarazione, ma non sarà necessariamente quello che ti aspetti:
https://wiki.postgresql.org/wiki/SQL_MERGE