Hi,
I am not sure it is a bug or a mistake on my side, but I think it was working in the past. I am now using jOOQ 3.13.0.
I have the following code:
Table<Record> table = DSL.table(DSL.name("stuffs"));
Field<Integer> idField = DSL.field("id", SQLDataType.INTEGER);
Field<String> nameField = DSL.field("name", SQLDataType.VARCHAR);
tx.createTableIfNotExists(table)
.column(idField, SQLDataType.INTEGER.identity(true))
.column(nameField, SQLDataType.VARCHAR.nullable(false))
.constraint(DSL.constraint("pk_" + table.getName()).primaryKey(idField))
.execute();
And I get the following error when it is executed:
org.jooq.exception.DataAccessException: SQL [create table if not exists "stuffs"(id int generated by default as identity not null, name varchar not null, constraint "pk_table" primary key (id))]; ERROR: syntax error at or near "generated"
Position: 58
at org.jooq_3.13.0.POSTGRES.debug(Unknown Source)
at org.jooq.impl.Tools.translate(Tools.java:2751)
at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:755)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:385)
...
Caused by: org.postgresql.util.PSQLException: ERROR: syntax error at or near "generated"
Position: 58
at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2510)
at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:2245)
at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:311)
at org.postgresql.jdbc.PgStatement.executeInternal(PgStatement.java:447)
at org.postgresql.jdbc.PgStatement.execute(PgStatement.java:368)
at org.postgresql.jdbc.PgPreparedStatement.executeWithFlags(PgPreparedStatement.java:159)
at org.postgresql.jdbc.PgPreparedStatement.execute(PgPreparedStatement.java:148)
at com.zaxxer.hikari.pool.ProxyPreparedStatement.execute(ProxyPreparedStatement.java:44)
at com.zaxxer.hikari.pool.HikariProxyPreparedStatement.execute(HikariProxyPreparedStatement.java)
at org.jooq.tools.jdbc.DefaultPreparedStatement.execute(DefaultPreparedStatement.java:209)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:453)
at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:371)
... 16 common frames omitted