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

Re: MySQL LAST_INSERT_ID() to Postgres

From: Joshua Drake <jd(at)commandprompt(dot)com>
To: Bill <pg(at)dbginc(dot)com>
Cc: Scott Marlowe <scott(dot)marlowe(at)gmail(dot)com>, Steve Atkins <steve(at)blighty(dot)com>, pgsql-general General <pgsql-general(at)postgresql(dot)org>
Subject: Re: MySQL LAST_INSERT_ID() to Postgres
Date: 2008-08-28 22:44:53
Message-ID: 20080828154453.42a08d83@jd-laptop (view raw or whole thread)
Lists: pgsql-general
On Thu, 28 Aug 2008 15:29:51 -0700
Bill <pg(at)dbginc(dot)com> wrote:

> The PostgresSQL 8.3 help file clearly shows that lastval() does not
> take a sequence as a parameter and the description i is "Return the
> value most recently returned by |nextval| in the current session.
> This function is identical to |currval|, except that instead of
> taking the sequence name as an argument it fetches the value of the
> last sequence that |nextval| was used on in the current session. It
> is an error to call |lastval| if |nextval| has not yet been called in
> the current session." Is the help incorrect?


Joshua D. Drake

> Bill

The PostgreSQL Company since 1997: 
PostgreSQL Community Conference:
United States PostgreSQL Association:
Donate to the PostgreSQL Project:

In response to

pgsql-general by date

Next:From: Scott MarloweDate: 2008-08-28 22:46:19
Subject: Re: MySQL LAST_INSERT_ID() to Postgres
Previous:From: ChristopheDate: 2008-08-28 22:32:32
Subject: Re: indexes on functions and create or replace function

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