Re: MySQL LAST_INSERT_ID() to Postgres - Mailing list pgsql-general

From Raymond O'Donnell
Subject Re: MySQL LAST_INSERT_ID() to Postgres
Date
Msg-id 48B71A93.1030909@iol.ie
Whole thread Raw
In response to Re: MySQL LAST_INSERT_ID() to Postgres  (Bill <pg@dbginc.com>)
Responses Re: MySQL LAST_INSERT_ID() to Postgres  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 28/08/2008 22:26, Bill wrote:

> someone confirm that currval() returns the the value for the connection
> from which it is called?

Yes, see here:

  http://www.postgresql.org/docs/8.3/static/functions-sequence.html

and specifically a little further down the page on "currval":

  Return the value most recently obtained by nextval for
  this sequence in the current session. (An error is reported
  if nextval has never been called for this sequence in this
  session.) Notice that because this is returning a session-local
  value, it gives a predictable answer whether or not other
  sessions have executed nextval since the current session did.

HTH,

Ray.

------------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
Galway Cathedral Recitals: http://www.galwaycathedral.org/recitals
------------------------------------------------------------------

pgsql-general by date:

Previous
From: Bill
Date:
Subject: Re: SQL optimization - WHERE SomeField STARTING WITH ...
Next
From: Bill
Date:
Subject: Re: MySQL LAST_INSERT_ID() to Postgres