New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ALTER SEQUENCE RESTART statement does not conform to SQL standard [CORE4349] #4671
Comments
Commented by: @dyemanov I foresee a minor problem here. RESTART WITH 1 means that the generator is reset to zero. And GEN_ID(G, 0) will surely return zero after such an ALTER. Is this acceptable? |
Commented by: Lukas Eder (lukas.eder) I'm not sure about GEN_ID, but clearly, if I say that I want the first sequence value to be 1 and then I get 2, I'm a bit confused :-) |
Commented by: Nick (nick) >>RESTART WITH 1 means that the generator is reset to zero. |
Commented by: @dyemanov The generated value is incremented before being returned, this is how GEN_ID works and NEXT VALUE FOR follows the same approach. So if you want 1 to be returned after RESTART WITH 1, the counter must be reset to 0. |
Commented by: Nick (nick) >>So if you want 1 to be returned after RESTART WITH 1, the counter must be reset to 0. And another example: create table objects ( I expect that after first insert there will be id = 101. But I get 102. |
Commented by: @mrotteveel This was fixed by CORE6084 |
Modified by: @mrotteveel |
Modified by: @mrotteveelstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 4.0 RC 1 [ 10930 ] |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Resolved [ 5 ] QA Status: Covered by another test(s) Test Details: See test for CORE6084 |
Modified by: @pavel-zotovstatus: Resolved [ 5 ] => Closed [ 6 ] |
Submitted by: Lukas Eder (lukas.eder)
Is replaced by CORE6084
When I'm running these statements:
create sequence s_author_id
alter sequence s_author_id restart with 1
select next value for s_author_id from "RDB$DATABASE"
I'd expect to get 1 as a result for the last query. However, I get 2. While this matches what is documented in the manual...
http://www.firebirdsql.org/refdocs/langrefupd20-alter-seq.html
... I do believe that this is wrong. Instead, 1 should really be the next value. This observation matches the behaviour of these databases:
- DB2
- H2
- HSQLDB
- Ingres
- PostgreSQL
- SQL Server
- Sybase SQL Anywhere
====== Test Details ======
See test for CORE6084
The text was updated successfully, but these errors were encountered: