Postgresql ON CONFLICT ON CONSTRAINT for 2 constraints

I am currently working with PostgreSQL 9.5 and am wondering if it is possible to include the names of 2 constraints in the ON CONFLICT ON CONSTRAINT statement. My sql below

INSERT INTO LIVE.TABLE (column1, column2, column3) SELECT DISTINCT ON (cloumn1) column1, column2, column3 FROM STAGE.TABLE ​ON CONFLICT ON CONSTRAINT live.table.pkey DO NOTHING 

This works fine, however I am trying to include the second restriction in the ON CONFLICT ON CONSTRAINT statement. I tried the option below, but it doesn't seem to work for me.

 INSERT INTO LIVE.TABLE (column1, column2, column3) SELECT DISTINCT ON (cloumn1) column1, column2, column3 FROM STAGE.TABLE ​ON CONFLICT ON CONSTRAINT live.table.pkey, live.table.fkey1 DO NOTHING 

Any suggestion would be highly appreciated.

+5
source share

Source: https://habr.com/ru/post/1241787/


All Articles