How to don't update sequence on rollback of a transaction

Поиск
Список
Период
Сортировка
От Frank Lanitz
Тема How to don't update sequence on rollback of a transaction
Дата
Msg-id 501A980A.5090206@frank.uvena.de
обсуждение исходный текст
Ответы Re: How to don't update sequence on rollback of a transaction  (Andrew Hastie <andrew@ahastie.net>)
Re: How to don't update sequence on rollback of a transaction  (Chris Angelico <rosuav@gmail.com>)
Re: How to don't update sequence on rollback of a transaction  (Craig Ringer <ringerc@ringerc.id.au>)
Список pgsql-general
Hi folks,

I did a test with transactions and wondered about an behavior I didn't
expected. At http://pastebin.geany.org/bYQNo/raw/ I posted a complete
backlog for.

To make it short: I created a table with a serial and started a
transactions. After this I was inserting values into the table but did a
rollback. However. The sequence of the serial filed has been incremented
by 1 on each insert (which is fine), but wasn't reset after rollback of
transaction.

Documentation stats:
"If, partway through the transaction, we decide we do not wantto commit
(perhaps we just noticed that Alice's balance went   negative), we can
issue the command ROLLBACK instead of COMMIT, and all our updates so far
will be canceled."

My understanding of all was that it includes sequences. Obviously, I'm
wrong... but how to do it right?

Cheers,
Frank

В списке pgsql-general по дате отправления:

Предыдущее
От: Sergey Konoplev
Дата:
Сообщение: Re: Problem running "ALTER TABLE...", ALTER TABLE waiting
Следующее
От: Andrew Hastie
Дата:
Сообщение: Re: How to don't update sequence on rollback of a transaction