postgresql duplicate key value violates unique constraint pkey code example
Example: postgresql resolv duplicate value violates unique constraint
SELECT setval(pg_get_serial_sequence('users', 'id'), coalesce(max(id)+1, 1), false) FROM users;
SELECT setval(pg_get_serial_sequence('users', 'id'), coalesce(max(id)+1, 1), false) FROM users;