Re: LAST_INSERT_ID equivalent

From: Darko Prenosil <darko(dot)prenosil(at)finteh(dot)hr>
To: Erik Price <eprice(at)ptc(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: LAST_INSERT_ID equivalent
Date: 2003-06-12 17:50:23
Message-ID: 200306121950.23885.darko.prenosil@finteh.hr
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Thursday 12 June 2003 19:14, Erik Price wrote:
> I have a table with a SEQUENCE on it that increments the primary key (a
> BIGINT column) of the table whenever a new insert is performed.
>
> Is there a way to determine the last incremented value, so that if I do
> an insert, I can record the primary key of the record somewhere? I'm
> interested in any technique for doing this, but especially a
> JDBC-specific solution.
>
> Sorry if the answer should be obvious but I am coming from MySQL and
> trying to learn the ANSI equivalent of the MySQL features.
>
>
>

SELECT * FROM sequence_name;

and You got all data about sequence. There are also nextval, curval and setval
functions operating on the sequences.

Regards !

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ian Harding 2003-06-12 17:57:47 Re: Postgres performance comments from a MySQL user
Previous Message Sean Chittenden 2003-06-12 17:45:57 Re: Running two versions on same server