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
As it stands, UNION, INTERSECT and EXCEPT are implemented and Binary nodes on two ASTs - but the SQL spec and (at least Postgres's) implementations treat them more like a sub-select. Check out:
As it stands, UNION, INTERSECT and EXCEPT are implemented and Binary nodes on two ASTs - but the SQL spec and (at least Postgres's) implementations treat them more like a sub-select. Check out:
http://www.postgresql.org/docs/9.1/static/sql-select.html
and
http://www.contrib.andrew.cmu.edu/~shadow/sql/sql1992.txt (page 195)
Specifically, the only correct way to limit a union is like:
SELECT * FROM table {} UNION SELECT * FROM table LIMIT 100
LIMIT isn't valid (although it's accepted) at {} and it should apply to the overall query, not the second tree.
Regardless, SelectManager#{union,intersect,except} pass in two ASTs to the Binary nodes, so limits get removed anyway.
The text was updated successfully, but these errors were encountered: