Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Duplicate
-
12.3.2
-
None
-
Not for Release Notes
Description
Description
MariaDB Server 12.3.2 rejects a qualified column reference in HAVING even though the column is present in GROUP BY. The reduced query groups two derived tables by their respective `a` columns, and projects only a constant. Both qualified group keys are valid and unambiguous, but `HAVING x.a > 0` raises ERROR 1054.
Projecting `x.a`, or giving the other table's group key a different name, makes the query succeed. A correlated subquery inside HAVING encounters the same problem, reported as an unknown column in WHERE.
How to repeat
SELECT 1 AS result |
FROM (SELECT 1 AS a) AS x |
CROSS JOIN (SELECT 2 AS a) AS y |
GROUP BY x.a, y.a
|
HAVING x.a > 0; |
Actual result
 |
ERROR 1054 (42S22): Unknown column 'x.a' in 'HAVING' |
Attachments
Issue Links
- duplicates
-
MDEV-19678 Unknown Column in 'having clause' on qualified access
-
- Confirmed
-