CREATE SEQUENCE START WITH has wrong initial value
--------------------------------------------------
Key: CORE-6084
URL: http://tracker.firebirdsql.org/browse/CORE-6084
Project: Firebird Core
Issue Type: Bug
Components: Engine
Affects Versions: 4.0 Beta 1, 3.0.4
Reporter: Mark Rotteveel
When using CREATE SEQUENCE seq_name START WITH n [INCREMENT BY x], then the
first value generated by the sequence is n + x (where x = 1 when the INCREMENT
BY clause is absent). This is wrong: the first value produced should be n. See
also "9.29 Generation of the next value of a sequence generator" in SQL:2016.
Examples
CREATE SEQUENCE seq_name START WITH 1;
SELECT NEXT VALUE FOR seq_name FROM rdb$database;
-- Result = 2
-- Expected = 1
CREATE SEQUENCE seq_name START WITH 1 INCREMENT BY 2;
SELECT NEXT VALUE FOR seq_name FROM rdb$database;
-- Result = 3
-- Expected = 1
This problem also affects ALTER SEQUENCE RESTART WITH n (see CORE-4349)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://tracker.firebirdsql.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
Firebird-Devel mailing list, web interface at
https://lists.sourceforge.net/lists/listinfo/firebird-devel