Hi Lukas Thanks for creating a Github issue for this. The reason I have to list the types is given in the Postgres documentation for the jsonb_to_recordset function: "As with all functions returning record, the caller must explicitly define the structure of the record with an AS clause." (see https://www.postgresql.org/docs/current/static/functions-json.html).
On Monday, February 27, 2017 at 7:06:47 AM UTC, Lukas Eder wrote: > > Hello, > > Yes, your solution looks reasonable. jOOQ supports the derived column list > syntax "as t(id, name)", but not with data types associated with the > columns. That's an interesting PostgreSQL specific extension. Perhaps we > should support that too. I've registered a feature request for this: > https://github.com/jOOQ/jOOQ/issues/5926 > > What's the reason why you explicitly name the "text" data types? > > If you didn't need that, you could also write: > > table("json_to_recordset({0})", DATA.HABITAS).as("t", "id", "name") > > > Lukas > > 2017-02-26 21:27 GMT+01:00 Emrul Islam <[email protected] <javascript:>>: > >> I think I'm on the right track with this (Kotlin): >> >> fun crossJoinSpec(): TableLike<Record> { >> val _sb = StringBuilder("{json_to_recordset}({0}) as {1}(") >> columns.forEachIndexed { i, selectField -> >> if ( i != 0 ) _sb.append(", ") >> _sb.append(selectField) >> _sb.append(" ") >> _sb.append(selectField.dataType.castTypeName) >> } >> _sb.append(")") >> return DSL.table(_sb.toString(), sourceField, columns.first()) >> } >> >> >> -- >> 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.
