Re: [GENERAL] getting the currval of a sequence - Mailing list pgsql-general

From Vadim Mikheev
Subject Re: [GENERAL] getting the currval of a sequence
Date
Msg-id 35D5A58A.FDB222E9@krs.ru
Whole thread Raw
In response to RE: [GENERAL] getting the currval of a sequence  ("Jackson, DeJuan" <djackson@cpsgroup.com>)
List 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

pgsql-general by date:

Previous
From: JohnDz
Date:
Subject: interfaces mailing
Next
From: Peter T Mount
Date:
Subject: Re: [INTERFACES] No DB connection in Netscape ? Please help.