Re: Retrieving PK of inserted row

From: cedric <cedric(at)over-blog(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Retrieving PK of inserted row
Date: 2007-01-30 11:30:05
Message-ID: 200701301230.05767.cedric@over-blog.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Le mardi 30 janvier 2007 12:19, woger151 a écrit :
> (3) Use LASTVAL
for this one : look at
http://people.planetpostgresql.org/xzilla/index.php?/archives/169-Is-lastval-evil.html
>
> My questions:
> * Are any of these methods flawed?
> * Is there any reason to prefer (1) to (2)?
> * I'm not sure whether LASTVAL is guaranteed to work outside of a
> transaction. Its description in the 8.1 manual starts with "Return the
> value most recently returned by nextval in the current session. ..." but
> I'm not sure of the formal sense in which "session" is being used. (I'm
> connecting to the DB from mod_php in apache, so I guess "session" could
> mean "during the existence of a given db connection," but I'm not sure.)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Florian Weimer 2007-01-30 12:33:36 Foreign keys, table inheritance, and TRUNCATE
Previous Message Willy-Bas Loos 2007-01-30 11:26:51 Re: Unauthorized users can see db schema and read functions