sequence last_value not accurate if sequence has never been used

From: Wayne Schroeder <raz(at)chewies(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: sequence last_value not accurate if sequence has never been used
Date: 2003-08-31 23:01:59
Message-ID: 20030831230159.GA4457@chewies.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

IMHO, it would be good for the last_value to come back null if is_called
is false. Don't know if that's possible or even a good idea -- but
figured it was worth a note since the following psql log raised my eye
brow a bit.

Wayne

-------------------------------------
policy=> create sequence a start 1;
CREATE SEQUENCE
policy=> select last_value from a;
last_value
------------
1
(1 row)

policy=> select nextval('a');
nextval
---------
1
(1 row)

policy=> select last_value from a;
last_value
------------
1
(1 row)

policy=> select nextval('a');
nextval
---------
2
(1 row)

policy=>
--------------------------------

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2003-09-01 00:28:58 Re: sequence last_value not accurate if sequence has never been used
Previous Message pgsql-bugs 2003-08-31 05:24:44 "Returned due to virus; was:" Re: Your application