Hi,

> If I create a table with an AUTO_INCREMENT field, I see it
> automatically creates a sequence. The sequence name is something like
> SYSTEM_SEQUENCE_.....................

Yes, auto-increment columns are implemented using a sequence.

> How is the sequence name generated?

The name is randomly generated now (using the UUID generator). To
understand why this is required see
http://en.wikipedia.org/wiki/Universally_Unique_Identifier#Random_UUID_probability_of_duplicates
(disclaimer: I originally wrote that paragraph). In early versions of
H2 the sequence name contained the table name, but that was
problematic when renaming tables.

> Is there a way to know what's the sequence name associated to a table
> and the auto increment field?

Yes, but it's a bit complicated. You are not the first that asks for
this, I will add a column 'sequence_name' to
information_schema.columns as in:

drop table test;
create table test(id int identity);
select * from information_schema.columns c where c.sequence_name is not null

This will be available in the next release. For now, you need to parse
the column COLUMN_DEFAULT. Why do you need the sequence?

Regards,
Thomas

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to