-
Notifications
You must be signed in to change notification settings - Fork 466
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
Multiple instances of pg_typeof inside a GROUP BY clause result in a bogus "column does not exist" error #8302
Comments
This issue is not specific to using GROUP BY with column numbers, it also happens with actual expressions in the GROUP BY column. However, it seems to require the following to reproduce:
This fails:
But all of those work:
|
@pH14 is taking a look |
What I'm seeing so far -- When we're computing the GROUP BY plan, we intentionally drop repeated expressions: materialize/src/sql/src/plan/query.rs Lines 1638 to 1647 in cf095ba
This causes us to omit generating and storing the ScopeItem for all but the first materialize/src/sql/src/plan/query.rs Lines 1745 to 1747 in cf095ba
The difference in behavior between I tried a few quick naive fixes here, like removing the dedupping entirely, but those ran amuck of several assumptions about the output from the current GROUP BY handling. Will revisit this one next week |
So, the issue is that Does this happen when grouping by any constant expressions multiple times? |
(I'm not actually sure how to construct another example of expressions in SQL that are planned as constants and have the same constant value but different names.) |
Okay
|
What version of Materialize are you using?
How did you install Materialize?
Built from source
What was the issue?
The text was updated successfully, but these errors were encountered: