Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR SQL

postgresql resolv duplicate value violates unique constraint

SELECT setval(pg_get_serial_sequence('users', 'id'), coalesce(max(id)+1, 1), false) FROM users;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #postgresql #resolv #duplicate #violates #unique #constraint
ADD COMMENT
Topic
Name
1+9 =