Sequences change in a rolled-back transactions
От | Erwin Moller |
---|---|
Тема | Sequences change in a rolled-back transactions |
Дата | |
Msg-id | 49B53245.5080102@darwine.nl обсуждение исходный текст |
Ответы |
Re: Sequences change in a rolled-back transactions
|
Список | pgsql-general |
Hi group, I just noticed getting the next number of a sequence doesn't respect a transaction. Here is an example: ======================================================= erwin=# SELECT nextval('tblofferlabel_offerlabelid_seq'::regclass) as nextofferlabelid; nextofferlabelid ------------------ 87 (1 row) erwin=# start transaction; START TRANSACTION erwin=# SELECT nextval('tblofferlabel_offerlabelid_seq'::regclass) as nextofferlabelid; nextofferlabelid ------------------ 88 (1 row) erwin=# SELECT nextval('tblofferlabel_offerlabelid_seq'::regclass) as nextofferlabelid; nextofferlabelid ------------------ 89 (1 row) # rollback; ROLLBACK erwin=# SELECT nextval('tblofferlabel_offerlabelid_seq'::regclass) as nextofferlabelid; nextofferlabelid ------------------ 90 ======================================================= As you can see the sequence just counts on outside the transaction. I thought a transaction that is rolled back, rolls back *everything* done in that transaction. Appearantly sequences are not included. It is no big deal, since I can easily code this differently, but I was unpleasantly surprised. :-/ Can anybody comment on this behaviour? Am I missing something? Thanks! Regards, Erwin Moller
В списке pgsql-general по дате отправления: