Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. ON CONFLICT (name, age)
  2. DO UPDATE SET
  3. occupation = 'teacher'
  4. ELSE ON CONFLICT(all others) DO NOTHING;
  5.  
  6. CREATE UNIQUE INDEX index1 ON contact USING btree (name, age);
  7. CREATE UNIQUE INDEX index2 ON contact USING btree (name, address) WHERE (address IS NOT NULL);
  8. CREATE UNIQUE INDEX index3 ...
  9. CREATE UNIQUE INDEX index4 ...
  10.  
  11. INSERT INTO contact
  12. (name,
  13. age,
  14. address,
  15. occupation)
  16. VALUES
  17. ('John',
  18. 25,
  19. '1 main st',
  20. 'doctor')
  21. ON CONFLICT (name, age)
  22. DO UPDATE SET
  23. occupation = 'teacher';
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement