> Why is there not some "alias" for the H2 generated sequence
> that is created for an AUTO_INCREMENT PK column,
> that i can use in NEXTVAL()?
Is there something like this in another database? In H2,
auto-increment columns use a sequence, and you could query the
sequence directly, but that is also non-standard.
You could create a sequence of course.
Regards,
Thomas
> sequences essentially
> exist in their own namespace anyway
Yes, but sequence names could collide with other sequence names. One
solution is to use some rule like: AUTO_<tableName> or
AUTO_<schemaName>_<tableName>. This is how it worked in H2 up to some
point. Until it turned out it's a problem sometimes (I don't remember
the details, but it had to do with renaming objects, and RUNSCRIPT to
import data from another database). Anyway, now H2 uses the prefix
'SYSTEM_SEQUENCE' and a UUID. Example:
SYSTEM_SEQUENCE_7167FEA7_4DB8_44CE_92E9_0CE9FB883403. A collision is
very very unlikely. See also
http://www.h2database.com/html/advanced.html#uuid
> "ease of use" feature
There is CALL IDENTITY()
http://www.h2database.com/html/functions.html#identity
> Perhaps you might consider adding alternate syntax of
> AUTO_INCREMENT[('sequencename')], which would essentially allow
> creation of a sequence within the create table, but still retain the
> benefit
> of not having to deal with the type differences of a explicit
> sequence.
There is a 'standard' way to do that:
create sequence abc;
create table test(id bigint default next value for abc);
Regards,
Thomas