3

For example if I have a table:

create table test(

    username                varchar(50)   PRIMARY KEY,      
    customer                varchar(12),
    nickname                varchar(12)  
);

create unique index unique_customer_nickname on test(customer,nickname);

Therefore username is unique and (customer,nickname) together are unique.

Then If I want to write an upsert statement like this:

Insert into test(username,customer,nickname) values('utest','ctest','ntest') 
on conflict(username) or on conflict(customer,nickname) DO UPDATE ....

but this gives me syntax error. I also tried on (conflict(username) or conflict(customer,nickname)) but this also returns a syntax error.

so what I want is for different conflicts to perform the same thing.

Said Saifi
  • 1,995
  • 7
  • 26
  • 45
  • https://stackoverflow.com/questions/35888012/use-multiple-conflict-target-in-on-conflict-clause please read this – Vao Tsun Jun 02 '17 at 13:10

0 Answers0