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

Parser cannot parse set operations combining SELECT * with SELECT <column list> #10699

Closed
lukaseder opened this issue Sep 28, 2020 · 3 comments
Closed

Comments

@lukaseder
Copy link
Member

The following valid SQL query fails to parse:

select *
from t1
union all
select a
from t2

The error is:

Select list must contain 0 columns. Got: 1: [5:1] select *
from t1
union all
select a
[*]from t2

We must not check for column size correctness in set operations when we don't know the row size of one of the subqueries

@lukaseder
Copy link
Member Author

The degree check is generally implemented wrong / too early.

We're currently checking for the correct degree of a SELECT subquery in a set operation already when the select list has been parsed. But at this point, we can't resolve asterisks yet, so we don't know the degree, which is one of the reasons why this special case here doesn't parse.

We can check things once we have parsed the entire set operation subquery, prior to assembling the subqueries in a combined query.

@lukaseder
Copy link
Member Author

I'll keep the old degree check for now to double-check. Removing it breaks a few test assertions, e.g. when this isn't expected to parse: (a, b) = any (select 1)

lukaseder added a commit that referenced this issue Nov 18, 2020
lukaseder added a commit that referenced this issue Nov 18, 2020
@lukaseder lukaseder added this to To do in 3.15 Other improvements via automation Nov 18, 2020
3.15 Other improvements automation moved this from To do to Done Nov 18, 2020
@lukaseder
Copy link
Member Author

Fixed in 3.15.0 and 3.14.4 (#10973)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Development

No branches or pull requests

1 participant