Details
Description
Simplified sample query
SELECT greet FROM (SELECT 'hi' AS greet
UNION SELECT 'hello'
FROM (SELECT '') AS _ GROUP BY NULL) AS tbl WHERE greet != ''
Actual result
[mysqli: 1054] Unknown column 'greet' in 'order clause'
Expected result
Query passes (returns 'hihello')
Additional info
The following changes each make the query pass:
- Change line 2 to UNION SELECT 'hello' AS greet
- Remove the GROUP BY NULL clause
Attachments
Issue Links
- duplicates
-
MDEV-19179 Regression: SELECT ... UNION ... with inconsistent column names fails
- Closed