Jooq: KotlinGenerator produces invalid syntax for PostgreSQL enum types

Created on 20 Oct 2020  路  7Comments  路  Source: jOOQ/jOOQ

Expected behavior

Generated code:

override fun getCatalog(): Catalog? = getSchema()?.getCatalog()

Actual behavior

Generated code:

override fun getCatalog(): Catalog? = getSchema() == null ? null : getSchema().getCatalog()

Steps to reproduce the problem

Add an enum in a PostgreSQL database and generate Kotlin source code.

Versions

  • jOOQ: 3.14
  • Java: 13
  • Kotlin: 1.4.10
  • Database (include vendor): PostgreSQL 11.6
  • OS: Linux
  • JDBC Driver (include name if inofficial driver): org.postgresql:postgresql:42.2.12
  • Gradle plugin: etiennestuder/gradle-jooq-plugin v5.2
Code Generation C Kotlin All Editions High Fixed Defect

Most helpful comment

Thanks a lot for your report. Our integration tests only covered enums without schema (H2, MySQL), which is why this was undetected. Will fix ASAP for jOOQ 3.15.0 and 3.14.2 (#10765).

All 7 comments

Thanks a lot for your report. Our integration tests only covered enums without schema (H2, MySQL), which is why this was undetected. Will fix ASAP for jOOQ 3.15.0 and 3.14.2 (#10765).

Right... when following the code, it's apparent that it's not nullable so it should just use getSchema().getCatalog() right away.

This slipped by 3.14.1 - sorry for the inconvenience. Will fix this now

Right... when following the code, it's apparent that it's not nullable so it should just use getSchema().getCatalog() right away.

Agreed

Fixed for jOOQ 3.15.0 and 3.14.2 (#10765).

Fixed for jOOQ 3.15.0 and 3.14.2 (#10765).

Cool! When do you expect 3.14.2 will be released?

Fixed for jOOQ 3.15.0 and 3.14.2 (#10765).

Cool! When do you expect 3.14.2 will be released?

Yes

Was this page helpful?
0 / 5 - 0 ratings