From: Devrim GUNDUZ <devrim@gunduz.org>
To: Michael Satterwhite <michael@weblore.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: Question re: serial
Date: Sat, 24 Apr 2004 20:37:44 +0300 (EEST)
Message-ID: <Pine.LNX.4.44.0404242035380.16587-100000@emo.org.tr> (raw)
In-Reply-To: <200404241224.05079.michael@weblore.com>
-----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.comhttp://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQFAiqXrtl86P3SPfQ4RAsxkAKCQ9oL9Jo4a7VZwqyI4YU6L7i3nEACgv/wM
0ce7up3AVctCYyksk7OYIpY=
=8Hr5
-----END PGP SIGNATURE-----
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: devrim@gunduz.org, michael@weblore.com
Subject: Re: Question re: serial
In-Reply-To: <Pine.LNX.4.44.0404242035380.16587-100000@emo.org.tr>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox