Re: How I can read-back a serial value just inserted? - Mailing list pgsql-general

From Russ Brown
Subject Re: How I can read-back a serial value just inserted?
Date
Msg-id 45AF99F4.3070608@gmail.com
Whole thread Raw
In response to Re: How I can read-back a serial value just inserted?  (Robert Treat <xzilla@users.sourceforge.net>)
Responses Re: How I can read-back a serial value just inserted?
List pgsql-general
Robert Treat wrote:
> On Thursday 18 January 2007 00:57, Adam Rich wrote:
>> If it's a recent PG:
>>
>> select lastval()
>>
>> See this:
>>
>> http://www.postgresql.org/docs/8.2/interactive/functions-sequence.html
>>
>
> probably more important that you see this:
> http://people.planetpostgresql.org/xzilla/index.php?/archives/169-Is-lastval-evil.html
>
> :-)
>

lastval's main benefit is in aiding the port of MySQL apps (being a
drop-in replacement for LAST_INSERT_ID()). without lastval such ports
can be really difficult.

So it does have its place. :)

pgsql-general by date:

Previous
From: Robert Treat
Date:
Subject: Re: How I can read-back a serial value just inserted?
Next
From: Devrim GUNDUZ
Date:
Subject: Re: How I can read-back a serial value just inserted?