Search Postgresql Archives

Re: How I can read-back a serial value just inserted?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx
[mailto:pgsql-general-owner@xxxxxxxxxxxxxx] On Behalf Of dfx
Sent: Monday, January 01, 2007 11:46 AM
To: pgsql-general@xxxxxxxxxxxxxx
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



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux