My guess: a sequence's initial number denotes the number you'll get
the next time you ask the sequence for a number. You ask a sequence for
a number using NEXTVAL(), not CURRVAL() which is why you're getting N-1.
Gili
On 15/02/2012 5:04 PM, wburzyns wrote:
As of h2-1.3.162 if I do (substitute a non-negative integer for N,
e.g. 5):
CREATE SEQUENCE IF NOT EXISTS A_SEQ_NAME START WITH N
then the created sequence starts with a value that is not N but N - 1;
see a dump from H2 web console on jdbc:h2:mem:test below:
-----
CREATE SEQUENCE IF NOT EXISTS A_SEQ_NAME START WITH 5;
CALL CURRVAL('A_SEQ_NAME');
CURRVAL('A_SEQ_NAME')
4
(1 row, 0 ms)
-----
Isn't it a bug? I'd expect the sequence to return N instead of N - 1,
e.g. as specified here:
http://msdn.microsoft.com/en-us/library/ff878091%28v=sql.110%29.aspx
("START WITH<constant> The first value returned by the sequence
object.").
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.