If it's a recent PG: select lastval()
See this: http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of dfx Sent: Monday, January 01, 2007 11:46 AM To: pgsql-general@postgresql.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 ---------------------------(end of broadcast)--------------------------- TIP 5: don't forget to increase your free space map settings