From: | "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net> |
---|---|
To: | <dfx(at)dfx(dot)it>, <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: How I can read-back a serial value just inserted? |
Date: | 2007-01-18 05:57:41 |
Message-ID: | 096901c73ac5$9126dcc0$6400a8c0@dualcore |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
If it's a recent PG:
select lastval()
See this:
http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html
-----Original Message-----
From: pgsql-general-owner(at)postgresql(dot)org
[mailto:pgsql-general-owner(at)postgresql(dot)org] On Behalf Of dfx
Sent: Monday, January 01, 2007 11:46 AM
To: pgsql-general(at)postgresql(dot)org
Subject: [GENERAL] How I can read-back a serial value just inserted?
Dear Sirs,
my question is very simple:
when I insert a row whith a serial field, a value is automatically
generated; how can I know this value, strictly of my row, without the
risk
of to read the value of another subsequent insertion?
Thank you.
Domenico
---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match
From | Date | Subject | |
---|---|---|---|
Next Message | Gene | 2007-01-18 06:15:02 | datatype advice numeric vs. varchar |
Previous Message | Madison Kelly | 2007-01-18 05:53:40 | Re: How I can read-back a serial value just inserted? |