2010YOUY01 opened a new issue, #12013:
URL: https://github.com/apache/datafusion/issues/12013

   ### Describe the bug
   
   The following 2 queries can not be executed in DuckDB/Postgres, but can be 
executed without error in DataFusion.
   
   See reproducer in datafusion-cli
   ```
   DataFusion CLI v41.0.0
   > create table t1(v1 int);
   0 row(s) fetched.
   Elapsed 0.069 seconds.
   
   > insert into t1 values (1),(2),(3);
   +-------+
   | count |
   +-------+
   | 3     |
   +-------+
   1 row(s) fetched.
   Elapsed 0.049 seconds.
   
   > select * from t1 having max(v1)=3;
   +------------+
   | max(t1.v1) |
   +------------+
   | 3          |
   +------------+
   1 row(s) fetched.
   Elapsed 0.037 seconds.
   
   > select * from t1 having max(v1)=1;
   +------------+
   | max(t1.v1) |
   +------------+
   +------------+
   0 row(s) fetched.
   Elapsed 0.006 seconds.
   ```
   
   Looks like `*` is expanded to the aggregate function expression i.e. 
`max(v1)` inside `HAVING` clause.
   I think such semantics is not meaningful so report it as a potential bug.
   
   ### To Reproduce
   
   _No response_
   
   ### Expected behavior
   
   _No response_
   
   ### Additional context
   
   Found by SQLancer https://github.com/apache/datafusion/issues/11030


-- 
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