Re: Return the primary key of a newly inserted row?

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: Return the primary key of a newly inserted row?
Дата
Msg-id 449FA974.7060205@magproductions.nl
обсуждение исходный текст
Ответ на Re: Return the primary key of a newly inserted row?  (John Tregea <john@debraneys.com>)
Ответы Re: Return the primary key of a newly inserted row?  (Martijn van Oosterhout <kleptog@svana.org>)
Re: Return the primary key of a newly inserted row?  (Scott Ribe <scott_ribe@killerbytes.com>)
Список pgsql-general
John Tregea wrote:
> The example of
>
> select id1 = nextval(somesequence)
>
> could work for me. I have multiple users with our GUI and imagine I
> could use transaction protection to ensure no duplicates between
> selecting and incrementing the somesequence...

You won't have duplicates[1], it's a sequence. It's its purpose.

Now I may have missed something, I didn't follow this thread.

[1] Unless you manage to make it wrap around after 2^32 (or 2^64?) calls
of nextval. But that's quite unlikely.
--
Alban Hertroys
alban@magproductions.nl

magproductions b.v.

T: ++31(0)534346874
F: ++31(0)534346876
M:
I: www.magproductions.nl
A: Postbus 416
    7500 AK Enschede

// Integrate Your World //

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

Предыдущее
От: chrisek@poczta.neostrada.pl
Дата:
Сообщение: "Ghost" colmumn with primary key
Следующее
От: Martijn van Oosterhout
Дата:
Сообщение: Re: update impossible, constraint prevents it but it shouldn't