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

From Jackson, DeJuan
Subject RE: [GENERAL] getting the currval of a sequence
Date
Msg-id F10BB1FAF801D111829B0060971D839F39B4A7@cpsmail
Whole thread Raw
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
>
Vadim, what's a session?
    -DEJ

pgsql-general by date:

Previous
From: TSchoessow@t-online.de (Thomas Schoessow)
Date:
Subject: Delphi 3 and Postgres
Next
From: Dario Besseghini
Date:
Subject: CREATE TABLE ... CONSTRAINT