Hi Lukas,

Thanks for the link to the MCVE.  In the process of trying to create a 
minimal example I found what our problem was - a developer had mistakenly 
used DSL.table(...) instead of SCHEMA.getTable(...) to create the join 
query.

When JOOQ came to convert the records into Java objects, it was missing the 
binding and converter information that comes from the correct table 
definition.

The MCVE was useful to compare debug output to see where the two cases were 
different.

Thanks,
Leigh

On Monday, 18 March 2019 19:16:57 UTC+11, Lukas Eder wrote:
>
> Thanks for your message. Would you mind showing your Java / jOOQ code that 
> leads to this problem? If you think this is a bug, one option would also be 
> to provide an MCVE (https://github.com/jOOQ/jOOQ-mcve), which will help 
> reproducing this problem much more easily.
>
> Thanks,
> Lukas
>
> On Mon, Mar 18, 2019 at 9:11 AM <[email protected] <javascript:>> wrote:
>
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

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