Re: [GENERAL] getting the currval of a sequence

From: Vadim Mikheev <vadim(at)krs(dot)ru>
To: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
Cc: James Oden <joden(at)Lee(dot)k12(dot)nc(dot)us>, dustin sallings <dustin(at)spy(dot)net>, Fran Fabrizio <fran(at)primary(dot)net>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] getting the currval of a sequence
Date: 1998-08-15 15:13:14
Message-ID: 35D5A58A.FDB222E9@krs.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Jackson, DeJuan wrote:
>
> I think you should just go with what Vadim suggested and use:
> select currval('my_sequence');
> This will be the same within a transaction, even if there is another
^^^^^^^^^^^
session

> transaction using the same sequence.
> But (if memory servers), you have to have had select a nextval from that
> same sequence within the transaction.
^^^^^^^^^^^
session!

This is from create_sequence manual:

"...Function currval ('sequence_name') may be used
to determine number returned by last call to nextval for
specified sequence in current session."

Vadim

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Thomas Schoessow 1998-08-16 07:02:23 Delphi 3 and Postgres
Previous Message Peter T Mount 1998-08-15 10:47:46 Re: [INTERFACES] No DB connection in Netscape ? Please help.