Jooq 3.8.x HSQLdb codegen uses incorrect syntax when defaulting column

30 views
Skip to first unread message

tro-tro

unread,
Jun 21, 2016, 8:35:03 AM6/21/16
to jOOQ User Group, evan. richards
In needing to upgrade to Jooq 3.8.x to make use of the newly added range functions, the additional feature of allowing "DEFAULT" keywords in the code-generated create table statements has caused a side-effect in our HSQLdb embedded database implementation.

Since HSQLdb is a bit unorthodox with having the DEFAULT... statement preceding the NOT NULL statement, an "unexpected token: DEFAULT" error is thrown. For example, Jooq>=3.8.0 code-generates create table statements similar to the following for HSQLdb:

create table schema_name.table_name(col_name varchar(255) not null default NULL, ...)

But for HSQLdb, the order in the column definition needs to be:

create table schema_name.table_name(col_name varchar(255) default NULL not null, ...)


Or simply, the default statement just shouldn't be included. I've tried to narrow-down where this statement gets injected, and I'm presuming it is here: https://github.com/jOOQ/jOOQ/blob/master/jOOQ/src/main/java/org/jooq/impl/CreateTableImpl.java#L298



How could I disable/prevent/suppress default statements in column definitions of the code-generated create table SQL commands? 
If disabling them isn't possible without patching Jooq, how else could the ordering be corrected such that minimal code changes are necessary?

eva...@gmail.com

unread,
Jun 22, 2016, 8:07:48 AM6/22/16
to jOOQ User Group, evan.r...@dealertrack.com, eva...@gmail.com
I found a work around to this issue and filed an issue in github here: https://github.com/jOOQ/jOOQ/issues/5356

Lukas Eder

unread,
Jun 25, 2016, 8:13:14 AM6/25/16
to jooq...@googlegroups.com
Thank you very much for reporting this issue. It has now been fixed for the next version of jOOQ.
Another workaround would be to use alter table statements in order to add DEFAULT and/or NOT NULL clauses separately.

Best Regards,
Lukas

--
You received this message because you are subscribed to the Google Groups "jOOQ User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jooq-user+...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages