Skip to content Skip to sidebar Skip to footer

Postgresql: Error Duplicate Key Value Violates Unique Constraint

This question have been asked by several people but my problem seems to be different. Actually I have to merge same structured tables from different databases in postgresql into a

Solution 1:

As the error message tells you - you can not have two rows with the same value in the columns dementia_type, snapid since they need to be unique.

You have to make sure that the two databases has the same values for dementia_type, snapid.

A workaround would be to add a column to your table alter table t_types_of_dementia add column id serial generated always and use that as primary key instead of your current.

Post a Comment for "Postgresql: Error Duplicate Key Value Violates Unique Constraint"