Re: [SQL] begin/end/abort work for sequences?

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: [SQL] begin/end/abort work for sequences?
Дата
Msg-id 199907011530.LAA02443@candle.pha.pa.us
обсуждение исходный текст
Ответ на Re: [SQL] begin/end/abort work for sequences?  (Kyle Bateman <kyle@actarg.com>)
Список pgsql-sql
> > If we rolled back sequence numbers, we would have to lock the table
> > until the transaction commited or was rolled back.  That is too much
> > locking so was not worth it.
> >
> 
> That seems like a pretty big thing to sacrifice.  Did sequence locking work before
> 6.5?  It was my impression that it did.

No, sequence numbers of aborted transactions never were saved.

> Do you know if there is a workaround?  In my particular situation, it is critical
> that all instances of the sequence actually get used.  If a transaction is
> aborted, I lose an instance and everything gets messed up.

I recommend hand-rolling a sequence number, similar to how the sequence
mechanism works, but explicitly lock your sequence table, retrieve the
value, and the commit/abort will unlock the table.

--  Bruce Momjian                        |  http://www.op.net/~candle maillist@candle.pha.pa.us            |  (610)
853-3000+  If your life is a hard drive,     |  830 Blythe Avenue +  Christ can be your backup.        |  Drexel Hill,
Pennsylvania19026
 


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

Предыдущее
От: Kyle Bateman
Дата:
Сообщение: Re: [SQL] begin/end/abort work for sequences?
Следующее
От: "D'Arcy" "J.M." Cain
Дата:
Сообщение: Re: [SQL] begin/end/abort work for sequences?