{"action":"closed","issue":{"url":"https://api.github.com/repos/jOOQ/jOOQ/issues/4464","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/4464/labels{/name}","comments_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/4464/comments","events_url":"https://api.github.com/repos/jOOQ/jOOQ/issues/4464/events","html_url":"https://github.com/jOOQ/jOOQ/issues/4464","id":100100413,"number":4464,"title":"Emulate H2's MERGE statement for PostgreSQL 9.5","user":{"login":"lukaseder","id":734593,"avatar_url":"https://avatars.githubusercontent.com/u/734593?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/C:%20DB:%20PostgreSQL","name":"C: DB: PostgreSQL","color":"0000aa"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/P:%20Medium","name":"P: Medium","color":"ffaaaa"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/R:%20Fixed","name":"R: Fixed","color":"55ff55"},{"url":"https://api.github.com/repos/jOOQ/jOOQ/labels/T:%20Enhancement","name":"T: Enhancement","color":"cccccc"}],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/111","html_url":"https://github.com/jOOQ/jOOQ/milestones/Version%203.7.0","labels_url":"https://api.github.com/repos/jOOQ/jOOQ/milestones/111/labels","id":900413,"number":111,"title":"Version 3.7.0","description":"","creator":{"login":"lukaseder","id":734593,"avatar_url":"https://avatars.githubusercontent.com/u/734593?v=3","gravatar_id":"","url":"https://api.github.com/users/lukaseder","html_url":"https://github.com/lukaseder","followers_url":"https://api.github.com/users/lukaseder/followers","following_url":"https://api.github.com/users/lukaseder/following{/other_user}","gists_url":"https://api.github.com/users/lukaseder/gists{/gist_id}","starred_url":"https://api.github.com/users/lukaseder/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukaseder/subscriptions","organizations_url":"https://api.github.com/users/lukaseder/orgs","repos_url":"https://api.github.com/users/lukaseder/repos","events_url":"https://api.github.com/users/lukaseder/events{/privacy}","received_events_url":"https://api.github.com/users/lukaseder/received_events","type":"User","site_admin":false},"open_issues":40,"closed_issues":230,"state":"open","created_at":"2014-12-11T12:56:14Z","updated_at":"2015-09-29T15:35:59Z","due_on":null,"closed_at":null},"comments":1,"created_at":"2015-08-10T15:53:26Z","updated_at":"2015-09-29T15:35:59Z","closed_at":"2015-09-29T15:35:59Z","body":"H2's `MERGE` statement can be emulated in PostgreSQL 9.5:\r\n\r\n```sql\r\n-- H2\r\nMERGE INTO table(col1, col2, ...)\r\n[ KEY (...) ]\r\nVALUES (val1, val2, ...)\r\n\r\n-- PostgreSQL\r\nINSERT INTO table(col1, col2, ...)\r\nVALUES (val1, val2)\r\nON CONFLICT ( { explicit key columns, or implicit primary key } )\r\nDO UPDATE SET col1 = val1, col2 = val2\r\n```\r\n\r\n----\r\nSee also:\r\n- #4299"}}