defaultValue for BOOLEAN does not work for PostgreSQL

203 views
Skip to first unread message

thomas....@gmail.com

unread,
Jun 19, 2018, 4:11:22 AM6/19/18
to jOOQ User Group
When I try to set a default value for a boolean column on postgres, the generated DDL statement contains a not replaced binding.
I tried with version 3.11.0, 3.10.1, 3.10.7 and always got the same exception.

I do something like:

getContext()
        .createTable("mytable")
        ....
        .column("is_active", SQLDataType.BOOLEAN.defaultValue(true))
        .constraints(
            DSL.constraint(getPKName()).primaryKey("id"))
        .getSQL();

and get this exception:


exception in thread "main" org.jooq.exception.DataAccessException: SQL [create table "myschema"."mytable"("....., "is_active" boolean null default ?, ...... ))]; No value specified for parameter 1.
    at org.jooq_3.11.0.POSTGRES.debug(Unknown Source)
    at org.jooq.impl.Tools.translate(Tools.java:2380)
    at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:737)
    at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:364)
    at org.jooq.impl.DefaultDSLContext.execute(DefaultDSLContext.java:1071)
    ...
Caused by: org.postgresql.util.PSQLException: No value specified for parameter 1.
    at org.postgresql.core.v3.SimpleParameterList.checkAllParametersSet(SimpleParameterList.java:257)
    at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:290)
    at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:441)
    at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:365)
    at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:155)
    at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:144)
    at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:209)
    at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:432)
    at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:350)
    ... 5 more

Lukas Eder

unread,
Jun 19, 2018, 5:29:05 AM6/19/18
to jooq...@googlegroups.com
Hi Thomas,

Thanks for your message.

Unfortunately, I cannot reproduce this with jOOQ 3.11, regardless of the data type that is being used there. DDL statements should always produce inline bind variables. Can you perhaps give a more complete example? Probably the issue might be caused by a bug in what you omitted through  ....  E.g. do you have any custom bindings? Custom settings, etc.?

Thanks,
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