Re: getting back autonumber just inserted

From: Michael Fuhr <mike(at)fuhr(dot)org>
To: lmeadors(at)apache(dot)org
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: getting back autonumber just inserted
Date: 2005-07-07 20:57:25
Message-ID: 20050707205725.GA28200@winnie.fuhr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On Thu, Jul 07, 2005 at 02:47:23PM -0600, Larry Meadors wrote:
>
> If you have a trigger on your table that inserts a record in a table
> and shares the same sequence, what value do you get back, the
> triggered curval, or the currently inserted one?

That's a different issue than whether currval() is subject to
interference from other transactions. And just wait until PostgreSQL
8.1 comes out and people start using lastval() -- then it could get
*really* confusing which sequence value you're getting.

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

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Riya Verghese 2005-07-07 21:01:39 ORDER records based on parameters in IN clause
Previous Message Larry Meadors 2005-07-07 20:47:23 Re: getting back autonumber just inserted