Part of #21868
Minimalist reproduction:
on cockroach:
root@:26257/db> CREATE SEQUENCE t;
CREATE SEQUENCE
Time: 182.330804ms
root@:26257/db> SELECT nextval('t');
+---------+
| nextval |
+---------+
| 1 |
+---------+
(1 row)
Time: 42.495924ms
root@:26257/db> SELECT nextval('t');
+---------+
| nextval |
+---------+
| 2 |
+---------+
(1 row)
Time: 41.213481ms
root@:26257/db> ALTER SEQUENCE t MAXVALUE 1;
ALTER SEQUENCE
Time: 427.045439ms
root@:26257/db> SELECT nextval('t');
pq: nextval(): reached maximum value of sequence "t" (1)
The same occurs with a decrementing sequence and setting a minvalue.
On postgres, this fails on the ALTER SEQUENCE statement instead:
postgres=# CREATE SEQUENCE t;
CREATE SEQUENCE
postgres=# SELECT nextval('t');
nextval
---------
1
(1 row)
postgres=# SELECT nextval('t');
nextval
---------
2
(1 row)
postgres=# ALTER SEQUENCE t MAXVALUE 1;
ERROR: MINVALUE (1) must be less than MAXVALUE (1)
Thanks for finding this @mberhault. Fix coming soon.
if you're not working on a fix for this feel free to punt to 2.1
Focused on clusterviz right now; punting.
I'll chime in and say that this is not a critical issue and can definitely be pushed back.
@bobvawter Can I get a quick blurb describing this known limitation w/r/t the impact to user experience? Ideally, we need it by Friday 10/26 for the 2.1 Known Limitations page. Posting it on this issue and/or pinging me would be great.
@sploiselle,
Altering the minimum or maximum value of a series does not check the current value of a series. This means that it is possible to silently set the maximum to a value less than, or a minimum value greater than, the current value.
Most helpful comment
@sploiselle,
Altering the minimum or maximum value of a series does not check the current value of a series. This means that it is possible to silently set the maximum to a value less than, or a minimum value greater than, the current value.