So far, we don't explicitly support this syntax for PostgreSQL. While we
could support it, I'd strongly re-consider using it, because the syntax is
a "lie". It is short for:

SELECT unnest FROM t CROSS JOIN LATERAL unnest(string_array);


Except that the SQL standard LATERAL JOIN wasn't introduced until
PostgreSQL 9.3:
http://www.postgresql.org/docs/9.3/static/queries-table-expressions.html#QUERIES-LATERAL

I strongly suggest using LATERAL instead of the PostgreSQL-specific
unnesting in the SELECT clause. It makes no sense for the SELECT clause to
produce additional cartesian product factors, especially in larger queries.

jOOQ supports lateral join, although I just noticed that the DSL.unnest()
implementation is a bit hairy. Will have to review this - I guess for now,
you'll have to resort to using plain SQL:
http://www.jooq.org/doc/latest/manual/sql-building/plain-sql

The easiest solution would be:

DSL.using(configuration)

   .select(DSL.field("unnest({0})", String.class, t.col)) // Assuming
String here

   .from(t)

   .fetch();


Hope this helps,
Lukas

2015-05-13 16:14 GMT+02:00 Julian Backes <julianbac...@gmail.com>:

> Hi all,
>
> in Postgres, I can write a query like
>
> select unnest(col) from t;
>
> (col is an array column) The result is all selected arrays as rows. Is
> this possible using jooq? I found some DSL.unnest functions but they don't
> seem to fit. Is there a different way to achieve the same result? Or am I
> doing something wrong? :-)
>
> Regards
> Julian
>
> --
> 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 jooq-user+unsubscr...@googlegroups.com.
> 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 jooq-user+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to