Re: Getting Primary Key Value After Insert

From: Greg Stark <gsstark(at)mit(dot)edu>
To: Richard Broersma Jr <rabroersma(at)yahoo(dot)com>
Cc: Adam <adam(at)spatialsystems(dot)org>, Postgres general mailing list <pgsql-general(at)postgresql(dot)org>
Subject: Re: Getting Primary Key Value After Insert
Date: 2006-07-09 05:45:48
Message-ID: 8764i7l4ab.fsf@stark.xeocode.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Broersma Jr <rabroersma(at)yahoo(dot)com> writes:

> > 3. If you call currval() will it return 20? I would think it does.

Yes it does.

> My understanding is that it will provided your are within a transaction.

As long as you're in the same session you're fine. You would have to go out of
your way to break it but if you're using some sort of connection pooling you
wouldn't want to pull a fresh connection from the pool, for example.

--
greg

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Richard Broersma Jr 2006-07-09 06:02:26 Re: Getting Primary Key Value After Insert
Previous Message Michael Glaesemann 2006-07-09 05:34:52 Re: Is OpenFTS dead?