Re: system table storing sequence attributes

From: "A(dot) Kretschmer" <andreas(dot)kretschmer(at)schollglas(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: system table storing sequence attributes
Date: 2007-05-22 12:38:04
Message-ID: 20070522123804.GH32759@a-kretschmer.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

am Tue, dem 22.05.2007, um 15:23:44 +0300 mailte Sabin Coanda folgendes:
> ...
> > select last_value from sequence_name
>
> Unfortunately there is the same problem. The documentation say: "It is an
> error to call lastval if nextval has not yet been called in the current
> session." .... and I don't want to call nextval before.

No, you can select last_value from a sequence.

Welcome to psql 8.1.4, the PostgreSQL interactive terminal.

Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit

test=# select last_value from t2_seq;
last_value
------------
3
(1 row)

Andreas
--
Andreas Kretschmer
Kontakt: Heynitz: 035242/47150, D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID: 0x3FFF606C, privat 0x7F4584DA http://wwwkeys.de.pgp.net

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Marcin Stępnicki 2007-05-22 12:41:38 Re: system table storing sequence attributes
Previous Message Sabin Coanda 2007-05-22 12:23:44 Re: system table storing sequence attributes