Search Postgresql Archives

Re: Value of serial data type after insert.

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

 



On Wed, Nov 10, 2004 at 02:34:22PM -0500, Ernest Kim wrote:

> I was wondering if there was a way to get the value of serial data
> type after an insert.

Use currval():

http://www.postgresql.org/docs/7.4/static/functions-sequence.html

Race condtions aren't a problem:

"Notice that because this is returning a session-local value, it
gives a predictable answer even if other sessions are executing
nextval meanwhile."

-- 
Michael Fuhr
http://www.fuhr.org/~mfuhr/

---------------------------(end of broadcast)---------------------------
TIP 6: Have you searched our list archives?

               http://archives.postgresql.org

[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