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

Regression when referencing outer joined column from correlated subquery #3227

Closed
Tracked by #9609
lukaseder opened this issue Nov 30, 2021 · 1 comment · Fixed by #3240
Closed
Tracked by #9609

Regression when referencing outer joined column from correlated subquery #3227

lukaseder opened this issue Nov 30, 2021 · 1 comment · Fixed by #3240

Comments

@lukaseder
Copy link
Contributor

This query used to work just fine in 1.4.200:

with t (a, b, c) as (select 1, 1, 1)
select t1.a 
from t t1 
  left outer join t t2 
  on t1.b = t2.a
where (select t2.c) is not null
order by t1.A

Producing

|A  |
|---|
|1  |

In H2 2.0.202, it produces the following error:

SQL Error [90016] [90016]: Column "T2.C" must be in the GROUP BY list;
@katzyn
Copy link
Contributor

katzyn commented Dec 2, 2021

This issue is caused by a single-row subquery optimization. (SELECT T2.C) is replaced with T2.C and replacement expression doesn't work because ExpressionColumn.queryLevel also needs to be decremented by 1.

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

Successfully merging a pull request may close this issue.

2 participants