Wednesday, November 16, 2011

PGError: ERROR: duplicate key value violates unique constraint


Syntax: 

SELECT setval('table_name_id_seq'::regclass, MAX(id)) FROM table_name;

Example of usage:

SELECT setval('personal_contacts_personal_folders_id_seq'::regclass, MAX(id)) FROM personal_contacts_personal_folders;



No comments:

Post a Comment