Hi,

I am doing what I thought was something fairly simple: Executing a join 
query that returns a record with all fields from two tables and then using 
Record.into(Table<R> table) to "trim down" that record to just the fields 
from one of the tables.

Database is PostgreSql 9.5, JOOQ version is 3.11.7.

The field that causes the problem is a Postgres UDT Array.  When the 
conversion is attempted the from object is still of type PgObject and JOOQ 
doesn't know what to do with it.
When I fetch records directly from the table (it ends up being via 
CursorImpl) the implementation uses the proper binding/converter for the 
field, first converting the PGobject to a Java array (via pgGetArray in 
DefaultBinding), then converting the array to the custom type.
The object in this case happens to be an empty PgArray.

Here's the neatened stack track I'm seeing, from where it enters JOOQ:

org.jooq.exception.MappingException: An error ocurred when mapping record 
to... <stuff>
at 
org.jooq.impl.AbstractRecord$TransferRecordState.operate(AbstractRecord.java:777)
at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:125)
at org.jooq.impl.AbstractRecord.into(AbstractRecord.java:720)
Caused by: org.jooq.exception.DataTypeException: Cannot convert from {} 
(class org.postgresql.util.PGobject) to class 
[Lxxx.xxx.xxx.udt.records.xxxRecord;
at org.jooq.tools.Convert$ConvertAll.fail(Convert.java:1166)
at org.jooq.tools.Convert$ConvertAll.from(Convert.java:1055)
at org.jooq.tools.Convert.convert0(Convert.java:321)
at org.jooq.tools.Convert.convert(Convert.java:313)
at org.jooq.tools.Convert.convert(Convert.java:385)
at org.jooq.impl.DefaultDataType.convert(DefaultDataType.java:768)
at 
org.jooq.impl.AbstractRecord$TransferRecordState.operate(AbstractRecord.java:755)

Do I need to provide some extra context somehow to Record.into() to get it 
to properly convert the table fields?

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to