I am using bigserial as as column value in postgres. Now bigserial increments automatically, but I don’t want it to increment when same username is entered. Is there a way so that in case of a wrong pg insert value the bigserial won’t increase its value. Or is there a way that I can decrease the value of the bigserial value.
I am using bigserial as as column value in postgres. Now bigserial increments automatically,
Share
You can set the current value of the associated
SEQUENCEwith either of two methods:With an SQL statement:
With
setval():Take care not to run into duplicate key errors. Note that this does not work well with concurrent transactions. Read the notes in the manual.
This is hardly useful if you want a gap-less sequence of IDs. Mind the comments for that.