Re: get a pkey/id back from/after an insert - Mailing list pgsql-novice

From Bruno Wolff III
Subject Re: get a pkey/id back from/after an insert
Date
Msg-id 20060620163403.GA7486@wolff.to
Whole thread Raw
In response to Re: get a pkey/id back from/after an insert  (Richard Broersma Jr <rabroersma@yahoo.com>)
Responses Re: get a pkey/id back from/after an insert  (Richard Broersma Jr <rabroersma@yahoo.com>)
Re: get a pkey/id back from/after an insert  (Sean Davis <sdavis2@mail.nih.gov>)
List pgsql-novice
On Mon, Jun 19, 2006 at 19:10:01 -0700,
  Richard Broersma Jr <rabroersma@yahoo.com> wrote:
> Well for testing purposes it should be fine to explicitly call out currentval.  But be careful if
> you are going to be using multiply connections at onces.  I am not sure that currentval will give
> you what you want if another connection calls nextval first before you insert a record to your
> child table.

It will do what is expected. currval returns the last value allocated in
your session. It wouldn't be much use if other connections could change
the value out from under you.

pgsql-novice by date:

Previous
From: Richard Broersma Jr
Date:
Subject: Re: get a pkey/id back from/after an insert
Next
From: Richard Broersma Jr
Date:
Subject: Re: get a pkey/id back from/after an insert