neilconway opened a new issue, #21727:
URL: https://github.com/apache/datafusion/issues/21727
### Describe the bug
```sql
CREATE TABLE t0 (g INT);
CREATE TABLE t1 (a INT);
CREATE TABLE t2 (c INT);
INSERT INTO t0 VALUES (1), (2);
INSERT INTO t1 VALUES (10);
INSERT INTO t2 VALUES (1);
-- Outer-outer column `t0.g` is referenced only at the deepest level
-- (t2.c = t0.g). The middle EXISTS (over t1) has no direct reference
-- to t0, so its Subquery.outer_ref_columns gets populated as empty.
SELECT g FROM t0 WHERE EXISTS (
SELECT 1 FROM t1 WHERE EXISTS (
SELECT 1 FROM t2 WHERE t2.c = t0.g
)
);
```
-->
```
Schema error: No field named t0.g. Valid fields are __correlated_sq_1.c.
```
### To Reproduce
_No response_
### Expected behavior
_No response_
### Additional context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]