Skip site navigation (1) Skip section navigation (2)

Re: MySQL LAST_INSERT_ID() to Postgres

From: Raymond O'Donnell <rod(at)iol(dot)ie>
To: Bill <pg(at)dbginc(dot)com>
Cc: "Masis, Alexander \(US SSA\)" <alexander(dot)masis(at)baesystems(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: MySQL LAST_INSERT_ID() to Postgres
Date: 2008-08-28 21:37:23
Message-ID: (view raw, whole thread or download thread mbox)
Lists: 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:

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.



Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
Galway Cathedral Recitals:

In response to


pgsql-general by date

Next:From: BillDate: 2008-08-28 21:38:54
Subject: Re: MySQL LAST_INSERT_ID() to Postgres
Previous:From: BillDate: 2008-08-28 21:32:41
Subject: Re: SQL optimization - WHERE SomeField STARTING WITH ...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group