hsqldb - How to insert using a sequence with Liquibase -
i liquibase insert primary key being auto generated sequence defined in database. target database hsqldb.
it works insert specifying value primary key
<insert ...> <column name="tag_id" valuenumeric="2"/>
i found (admittedly older) conversation it issue still same. suggested fix doesn't work hsqldb.
looking @ the docs i've tried things
<column name="tag_id" defaultvaluesequencenext="tag_id_seq" /> <column name="tag_id" defaultvaluesequencenext="tag_id_seq.nextval" /> <column name="tag_id" valuecomputed="tag_id_seq.nextval" /> <column name="tag_id" autoincrement="true" />
but none of put in key when insert (the insert fails on null primary key).
how 1 accomplish this?
hsqldb has setting use oracle syntax. can set hsqldb use oracle syntax so:
<changeset ... <sql dbms="hsqldb" >set database sql syntax ora true</sql> </changeset>
after that, works insert this:
<insert ... <column name="tag_id" valuecomputed="tag_id_seq.nextval"/>
Comments
Post a Comment