How to update an a postgreSQL unique key constraint -
i keep getting error within application
duplicate key value violates unique constraint "product_supplierinfo_pkey" detail: key (id)=(409) exists.
this on table product_supplierinfo.
the actual next sequence number key constraint needs 5461 not 409.
can please tell me correct query update key unique constraint?
@chris collins, please post output of \d product_supplierinfo
. imagine created table id serial
.
you should see name of sequence next default value id field come. product_supplierinfo_id_seq
.
then do, assuming above names correct, select * product_supplierinfo_id_seq;
. see next value 410.
if correct, select setval('product_supplierinfo_id_seq', 5461);
.
Comments
Post a Comment