Skip to content
Advertisement

Tag: upsert

Postgres on conflict do update on composite primary keys

I have a table where a user answers to a question. The rules are that the user can answer to many questions or many users can answer one question BUT a user can answer to a particular question only once. If the user answers to the question again, it should simply replace the old one. Generally the on conflict do

PostgreSQL Partial Indexes and UPSERT

After googling a lot my question is described below: Attempting to insert values: Results in: Altho this works(per spec): PostgreSQL documentation stands that it should work PostgreSQL v9.5 My aim is to find way to create unique index on this table on multiple nullable columns and update old rows with new ones on UPSERT Answer The conflict_target used in on

Advertisement