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

From: Robert Treat <xzilla(at)users(dot)sourceforge(dot)net>
To: pgsql-general(at)postgresql(dot)org
Cc: "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net>, dfx(at)dfx(dot)it
Subject: Re: How I can read-back a serial value just inserted?
Date: 2007-01-18 15:43:06
Message-ID: 200701181043.06643.xzilla@users.sourceforge.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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

:-)

--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Russ Brown 2007-01-18 16:01:56 Re: How I can read-back a serial value just inserted?
Previous Message Alvaro Herrera 2007-01-18 15:16:51 Re: [1/2 OFF] Varlena.com inaccessible from .br (Blocked?)