Last active
March 19, 2017 19:02
-
-
Save jamesplease/280df5ff1339a0e98b139fa8ebd5c195 to your computer and use it in GitHub Desktop.
Upsert in Postgres. Will create nonexistent rows so not so useful for relationship updates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
INSERT INTO the_table (id, column_1, column_2) | |
VALUES (1, 'A', 'X'), (2, 'B', 'Y'), (3, 'C', 'Z') | |
ON CONFLICT (id) DO UPDATE | |
SET column_1 = excluded.column_1, | |
column_2 = excluded.column_2; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment