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
Unexpected result of subquery #42912
Comments
This is an alias resolution issue. If an alias, e.g.
As shown, the (non-correlated) subquery is evaluated in place and emits 0 rows as expected. However the plan of the query in question is:
As shown, it is recognized as a correlated subquery (and the consequential de-correlated plan), with the correlated condition being More specifically, when the
where the subquery emits 1 row, thus Not sure this is a parser or planner issue. Add both labels for the corresponding people to future categorize. |
@zanmato1984 @chrysan I believe this is related to the de-correlation of subqueries. |
However, I doubt if this could be treat as 'critical bug' since it looks like an edge-case. |
Downgrade to |
a traditional name resolution priority problem as we talked before for the cases, when building a where clause
the sequence is not that right, we can simply move 3 forward 2 to make this right. PS. Every outer scope layer should also think about nature-join folding, we didn't think about that as yet. |
Bug Report
1. Minimal reproduce step (Required)
Consider the following program:
The first query produce empty result, I put the first query in an
EXISTS
expression, which should be equals toFALSE
, but the second query produce1
.2. What did you expect to see? (Required)
The second query produce
0
.I run this query in MySQL, and it produce
0
. https://www.db-fiddle.com/f/wNt1byF7hj6NXEDKDEsp4B/03. What did you see instead (Required)
The second query produce
1
.4. What is your TiDB version? (Required)
c233969
The text was updated successfully, but these errors were encountered: