Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

non-join query expressions incorrectly implemented #10

Open
nyarly opened this issue Feb 17, 2012 · 0 comments
Open

non-join query expressions incorrectly implemented #10

nyarly opened this issue Feb 17, 2012 · 0 comments

Comments

@nyarly
Copy link

nyarly commented Feb 17, 2012

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant