Re: Question re: serial

Поиск
Список
Период
Сортировка
Искать
От
Devrim GUNDUZ
Тема
Re: Question re: serial
Дата
Msg-id
Pine.LNX.4.44.0404242035380.16587-100000@emo.org.tr
Ответ на
Question re: serial (Michael Satterwhite)
Список
Дерево обсуждения
Question re: serial Michael Satterwhite <michael@weblore.com>
Re: Question re: serial Bruno Wolff III <bruno@wolff.to>
Re: Question re: serial Devrim GUNDUZ <devrim@gunduz.org>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Sat, 24 Apr 2004, Michael Satterwhite wrote:

> I have a table with a primary key defined as serial unique. When I insert a
> row into the table, I need to get the value of that row back so that I can
> use it to link rows in another table to it. How do I do that in Postgresql? I
> know that I can define a sequence and insert the value manually, but is there
> a way to query the value of the most recently inserted serial column of a
> row?

See currval() and nextval() functions:

Regards,
- -- 
Devrim GUNDUZ	       
devrim@gunduz.org				devrim.gunduz@linux.org.tr 		http://www.TDMSoft.com		http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFAiqXrtl86P3SPfQ4RAsxkAKCQ9oL9Jo4a7VZwqyI4YU6L7i3nEACgv/wM
0ce7up3AVctCYyksk7OYIpY=
=8Hr5
-----END PGP SIGNATURE-----


В списке pgsql-sql по дате отправления
От: Michael Satterwhite
Дата:
Сообщение: Question re: serial
От: Bruno Wolff III
Дата:
Сообщение: Re: Question re: serial
FAQ