How do I do the same for multiple conflicts in PostgreSQL?
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, the username is unique and (client, alias) 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 that gives me a syntax error. I also tried on (conflict(username) or conflict(customer,nickname))
but this also returns a syntax error.
so I want different conflicts to do the same thing.
+3
source to share
No one has answered this question yet
See similar questions:
or similar: