Re: Help with pre-loaded arbitrary key sequences

Поиск
Список
Период
Сортировка
От Scott Marlowe
Тема Re: Help with pre-loaded arbitrary key sequences
Дата
Msg-id dcc563d10801170731h455de400t2b59642f3c005b78@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Help with pre-loaded arbitrary key sequences  ("James B. Byrne" <byrnejb@harte-lyne.ca>)
Список pgsql-general
On Jan 17, 2008 9:19 AM, James B. Byrne <byrnejb@harte-lyne.ca> wrote:
>
> On Thu, January 17, 2008 10:15, Scott Marlowe wrote:
> >
> > If race conditions are a possible issue, you use a sequence and
> > increment that until you get a number that isn't used.  That way two
> > clients connecting at the same time can get different, available
> > numbers.
> >
>
> That is close to the idea that I originally had.  I was simply wondering
> if the built-in sequencer could handle this case or whether I need to roll
> my own.

Yeah, the built in sequencer just increments by one, nothing else.
But it should be pretty easy to write a pl/pgsql function that grabs
the next value and loop until it finds one that's available.

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

Предыдущее
От: "James B. Byrne"
Дата:
Сообщение: Re: Help with pre-loaded arbitrary key sequences
Следующее
От: Richard Huxton
Дата:
Сообщение: Re: Can't make backup (again)