Re: possible race condition in trigger functions on insert operations?

Поиск
Список
Период
Сортировка
От Merlin Moncure
Тема Re: possible race condition in trigger functions on insert operations?
Дата
Msg-id CAHyXU0wEb_By9MZaoaCUHWiUXwUutMFqCzC7=dq0_26uk6YqiA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: possible race condition in trigger functions on insert operations?  ("David Johnston" <polobo@yahoo.com>)
Ответы Re: possible race condition in trigger functions on insert operations?  (Kenneth Tilton <ktilton@mcna.net>)
Список pgsql-general
On Tue, Nov 22, 2011 at 2:43 PM, David Johnston <polobo@yahoo.com> wrote:
> Just create a single sequence for each year and then call the proper one
> on-the-fly.  You can create multiple sequences in advance and possible even
> auto-create the sequence the first time one is attempted to be used in a
> given year.  If you can live with possible (but probably unlikely) gaps in
> the sequence then all the concurrency will be handled for you and you can
> focus on writing a function that, given a year, will return the proper
> value.

I personally think the 'record the next to be inserted value' in a
table somewhere is better unless you are trying to support a lot of
concurrent operations.  Also the gap issue is more likely to come up
than you're letting on -- a rolled back transaction is all it takes.

merlin

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

Предыдущее
От: "David Johnston"
Дата:
Сообщение: Re: possible race condition in trigger functions on insert operations?
Следующее
От: Kenneth Tilton
Дата:
Сообщение: Re: possible race condition in trigger functions on insert operations?