xiedeyantu opened a new issue, #22691:
URL: https://github.com/apache/datafusion/issues/22691

   ### Describe the bug
   
   The following query fails during planning:
   ```
   SELECT *
   FROM t1
   WHERE EXISTS (
       SELECT 1
       FROM t2
       WHERE t2.id = t1.id
         AND 1 = 0
   )
   OR t1.flag = TRUE;
   ```
   with:
   ```
   Schema error: No field named __correlated_sq_1.mark.
   Valid fields are t1.id, t1.flag.
   ```
   
   ### To Reproduce
   
   ```
   CREATE TABLE t1 (
       id INT,
       flag BOOLEAN
   );
   
   CREATE TABLE t2 (
       id INT
   );
   
   SELECT *
   FROM t1
   WHERE EXISTS (
       SELECT 1
       FROM t2
       WHERE t2.id = t1.id
         AND 1 = 0
   )
   OR t1.flag = TRUE;
   ```
   
   ### Expected behavior
   
   The query should plan successfully.
   
   ### 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]

Reply via email to