Postgres няма MERGE изявление:
https://www.postgresql.org/docs/current/static /sql-commands.html
Използвайте INSERT ON CONFLICT DO вместо това:
https://www.postgresql.org/docs/current/static /sql-insert.html
Има известно движение към MERGER изявление, но не е задължително да е нещо, което очаквате:
https://wiki.postgresql.org/wiki/SQL_MERGE