From: | "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: Get the last inserted id |
Date: | 2008-04-11 17:48:06 |
Message-ID: | 20080411174806.GA21064@a-kretschmer.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
am Fri, dem 11.04.2008, um 19:23:04 +0200 mailte Nacef LABIDI folgendes:
> Hi all,
>
> I was wondering if postgres can return the last ID inserted for a table which
> the primary key is autoincremented. I need to retrieve this ID in my code to
> continue processing on that inserted row.
Either with RETURNING:
http://www.postgresql.org/docs/current/static/sql-insert.html
or with currval():
http://www.postgresql.org/docs/current/static/functions-sequence.html
HTH, Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net
From | Date | Subject | |
---|---|---|---|
Next Message | Andrew Sullivan | 2008-04-11 17:57:44 | Re: Get the last inserted id |
Previous Message | Nacef LABIDI | 2008-04-11 17:43:56 | Re: Get the last inserted id |