Paul Maier <[EMAIL PROTECTED]> writes: > Hello everybody, > > Why does... > > BEGIN; > SELECT nextval('test.test_seq') AS id; > ROLLBACK; > > ...still increase the sequence after aborting the transaction? This > nextval-command should be reverted after rolling back, right? Same with an > ABORT: > > BEGIN; > SELECT nextval('test.test_seq') AS id; > ABORT; > > Can anybody help me with this? Thanks a lot!
nextval does NOT roll back. As per the Fine Documentation on Sequence Manipulation Functions: "Important: To avoid blocking of concurrent transactions that obtain numbers from the same sequence, a nextval operation is never rolled back; that is, once a value has been fetched it is considered used, even if the transaction that did the nextval later aborts. This means that aborted transactions may leave unused "holes" in the sequence of assigned values. setval operations are never rolled back, either." -- output = ("cbbrowne" "@" "ntlug.org") http://cbbrowne.com/info/lsf.html I'm as confused as a baby in a topless bar. ---------------------------(end of broadcast)--------------------------- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly