SELECT @@IDENTITY

Поиск
Список
Период
Сортировка
От Robert J. Sanford, Jr.
Тема SELECT @@IDENTITY
Дата
Msg-id 002501c339b1$114253e0$67010a0a@nls.nlsholdings.com
обсуждение исходный текст
Ответы Re: SELECT @@IDENTITY
Список pgsql-general
Okay, I did a quick search through both the general and SQL lists(1,2)
trying to determine if there is a PostgreSQL construct equivalent to
Microsoft SQL Server's "SELECT @@IDENTITY". After performing an insert the
database caches the last sequence number for each connection and the select
retrieves that value. Thus if connection A and connection B each inserted
into the same table they would each know what the value of the sequence was
immediately after their insert.

Is there any direct support for this? I know that I can manually code to
select the nextval of a sequence but the syntactic sugar of SELECT
@@IDENTITY is really nice.

Many thanks!

rjsjr

1 - The only valid query I could find was
http://archives.postgresql.org/pgsql-general/2001-09/msg00523.php which is
unanswered.
2 - The search engine for the archives seems to ignore the "@@" in the
search string so I ended up with a LOT of information on corporate identity
and identity columns.


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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: A creepy story about dates. How to prevent it?
Следующее
От: Dennis Gearon
Дата:
Сообщение: Re: [pgsql-advocacy] interesting PHP/MySQL thread