You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The recently implemented #4305 adds support for the ROWS FROM () clause, which is supported only in PostgreSQL and only for table valued functions. It allows for "merging" the rows of several functions in to a single table.
The following two expressions are equivalent:
PostgreSQL / table-valued functions:
SELECT*FROM ROWS FROM (f1(), f2())
Other DBs / other tables:
SELECT*FROM (
SELECT f1.*, ROW_NUMBER() OVER (ORDER BY (SELECT1)) rn FROM f1()
) a
FULL OUTER JOIN (
SELECT f2.*, ROW_NUMBER() OVER (ORDER BY (SELECT1)) rn FROM f2()
) b
USING (rn)
This could be quite useful in some situations
The text was updated successfully, but these errors were encountered:
I thank you for posting this. I saw "ROWS FROM" in the Table Functions section of postgresql documentation, but couldn't find an actual usage of it until I finally found this post.
Something this useful should be more prominently displayed, in my opinion.
Something this useful should be more prominently displayed, in my opinion.
SQL has a ton of very useful features. It is hard to assess, which one is the most useful one. Surely, this doesn't appear to be something that's worth explaining on the jOOQ home page, though. :)
Personally, I'm not convinced this ROWS FROM feature should be used too often. Joining two tables by ordinality seems rather weird, and not very SQL / relational algebra idiomatic, so I'm not sure if we need to document this any more prominently.
The recently implemented #4305 adds support for the
ROWS FROM ()
clause, which is supported only in PostgreSQL and only for table valued functions. It allows for "merging" the rows of several functions in to a single table.The following two expressions are equivalent:
PostgreSQL / table-valued functions:
Other DBs / other tables:
This could be quite useful in some situations
The text was updated successfully, but these errors were encountered: