| От | Bruno Wolff III |
|---|---|
| Тема | Re: Issue with sequence and transactions |
| Дата | |
| Msg-id | 20041109034429.GA16284@wolff.to обсуждение |
| Ответ на | Issue with sequence and transactions (Ian Meyer <misc@crewcial.org>) |
| Список | pgsql-novice |
On Mon, Nov 08, 2004 at 22:27:39 -0500, Ian Meyer <misc@crewcial.org> wrote: > > Why does the sequence not get rolled back? I have looked in > documentation, read endlessly in a PostgreSQL book and can't figure out > if that is the expected behavior.. and if so, why? By not having the value of a sequence rolled back on transaction failure, applications using sequences run faster under load. > > What I want to happen (at least, the way I see it happening) is if > someone creates a username, but the query fails, or the username is > taken already, then the transaction is rolled back, and the id that > would have been taken, is still free. Then you probably don't want to use a sequence. Sequences should be used to obtain unique values, not to generate a list of id numbers without gaps.
В списке pgsql-novice по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера