Search Postgresql Archives

Re: serial increments on failed insert

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



David Kammer <djkammer@xxxxxxxxxxxxxxxx> writes:
> Notice that even though the second insert failed, it still incremented 
> the serial value.  This seems counter intuative to the way that serial 
> should work.  Is this truly a bug,

No.  nextval() calls never roll back; see the documentation.

> is there a good work around?

Don't assume that a serial column is without gaps.  It's only intended
to be unique.

			regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux