Re: get a pkey/id back from/after an insert

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
Cc: Corey <corey(at)bitworthy(dot)net>, pgsql-novice(at)postgresql(dot)org
Subject: Re: get a pkey/id back from/after an insert
Date: 2006-06-20 16:34:03
Message-ID: 20060620163403.GA7486@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Mon, Jun 19, 2006 at 19:10:01 -0700,
Richard Broersma Jr <rabroersma(at)yahoo(dot)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.

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Richard Broersma Jr 2006-06-20 16:36:07 Re: get a pkey/id back from/after an insert
Previous Message satheesh Gnanasekaran 2006-06-20 06:25:03 Doubt in stored procedure