Link a sequence with to an identity in hsqldb
Posted
by Candy Chiu
on Stack Overflow
See other posts from Stack Overflow
or by Candy Chiu
Published on 2010-06-01T23:25:49Z
Indexed on
2010/06/01
23:33 UTC
Read the original article
Hit count: 237
hsqldb
In PostgreSql, one can define a sequence and use it as the primary key of a table. In HsqlDB, one can still accomplish creating an auto-increment identity column which doesn't link to any user defined sequence. Is it possible to use a user defined sequence as the generator of an auto-increment identity column in HsqlDB?
Sample sql in PostgreSql:
CREATE SEQUENCE seq_company_id START WITH 1;
CREATE TABLE company ( id bigint PRIMARY KEY DEFAULT nextval('seq_company_id'), name varchar(128) NOT NULL CHECK (name <> '') );
What's the equivalent in HsqlDB?
Thanks.
© Stack Overflow or respective owner