jOOQ / jOOQ

jOOQ is the best way to write SQL in Java
https://www.jooq.org
Other
6.17k stars 1.21k forks source link

Postgres enum arrays and R2DBC. #16684

Open spheenik opened 5 months ago

spheenik commented 5 months ago

Expected behavior

Querying a record which contains an enum array in R2DBC works.

Actual behavior

Querying a record which contains an enum array using R2DBC fails with

...
Caused by: java.lang.ClassCastException: class java.lang.String cannot be cast to class [Ljava.lang.Object; (java.lang.String and [Ljava.lang.Object; are in module java.base of loader 'bootstrap')
    at org.jooq.impl.R2DBC$R2DBCResultSet.getArray(R2DBC.java:1311)
    at org.jooq.impl.DefaultBinding$DefaultArrayBinding.pgGetArray(DefaultBinding.java:1465)
    at org.jooq.impl.DefaultBinding$DefaultArrayBinding.get0(DefaultBinding.java:1419)
    at org.jooq.impl.DefaultBinding$DefaultArrayBinding.get0(DefaultBinding.java:1280)
    at org.jooq.impl.DefaultBinding$InternalBinding.get(DefaultBinding.java:1129)
    at org.jooq.impl.CursorImpl$CursorRecordInitialiser.setValue(CursorImpl.java:1582)

I've read the issue about the R2DBC restrictions here: https://github.com/jOOQ/jOOQ/issues/13590

It mentions an issue with enum arrays in R2DBC: https://github.com/pgjdbc/r2dbc-postgresql/issues/391

But this issue has long been resolved.

Steps to reproduce the problem

unfortunately none atm

jOOQ Version

3.19.7 (OSS)

Database product and version

Postgres 16.2

Java Version

OpenJDK 17

JDBC / R2DBC driver name and version (include name if unofficial driver)

postgresql 42.6.2 // r2dbc-postgresql 1.0.4.RELEASE

lukaseder commented 5 months ago

Thanks for your report. Neither enum types nor arrays are currently explicitly supported, see the list of known limitations here:

spheenik commented 5 months ago

Thanks Lukas. We settled on using JDBC for the affected queries for the time being, and will patiently wait for your fix.