mihaibudiu commented on code in PR #4417:
URL: https://github.com/apache/calcite/pull/4417#discussion_r2152778599


##########
core/src/test/java/org/apache/calcite/test/SqlValidatorTest.java:
##########
@@ -6806,12 +6829,13 @@ public boolean isBangEqualAllowed() {
     sql("select ^e.empno^ from emp as e group by 1 having e.empno > 10")
         .withConformance(strict).fails("Expression 'E.EMPNO' is not being 
grouped")
         .withConformance(lenient).ok();
-    // When alias is equal to one or more columns in the query then giving
-    // priority to alias, but PostgreSQL throws ambiguous column error or gives
-    // priority to column name.
+    // When alias matches multiple columns in the query, alias has priority.
+    sql("select ename AS deptno FROM emp, dept GROUP BY ^deptno^ HAVING deptno 
= 2")
+        .withConformance(strict).fails("Column 'DEPTNO' is ambiguous")
+        .withConformance(lenient).ok();
     sql("select count(empno) as deptno from emp having ^deptno^ > 10")
         .withConformance(strict).fails("Expression 'DEPTNO' is not being 
grouped")
-        .withConformance(lenient).ok();
+        .withConformance(lenient).fails("Expression 'DEPTNO' is not being 
grouped");

Review Comment:
   it looks like my handling of HAVING is not compatible with MySQL, I will try 
to improve it.



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

Reply via email to