[MDEV-19179] Regression: SELECT ... UNION ... with inconsistent column names fails Created: 2019-04-04 Updated: 2021-02-03 Resolved: 2020-11-23 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.3.9, 10.3.10, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.2.37, 10.3.28, 10.4.18, 10.5.9 |
| Type: | Bug | Priority: | Major |
| Reporter: | Gisbert W. Selke | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 4 |
| Labels: | regression | ||
| Environment: |
Windows 64bit |
||
| Issue Links: |
|
||||||||
| Description |
|
A SELECT from a subquery containing a UNION with inconsistent result column names fails with an ill-fitting error message, but only when used with a WHERE clause.
yields: ERROR 1054 (42S22): Unknown column 'x' in 'order clause' This slightly different statement, however, works fine:
(Note: second branch of UNION has no aggregate function)
Omitting the WHERE clause from the first query allows it to succeed, too. This seems to be a regression. My original query (much longer) used to work with an older 10.x version, but I cannot reconstruct any more which version that was. Of course, a workaround is easy: use consistent aliases:
|
| Comments |
| Comment by Alice Sherepa [ 2019-04-09 ] |
|
Thanks! Repeatable on 10.2-10.4 |
| Comment by Oleksandr Byelkin [ 2020-11-19 ] |
|
OK to push |
| Comment by Igor Babaev [ 2020-11-23 ] |
|
A fix for this bug was pushed into 10.2 |
| Comment by Gisbert W. Selke [ 2020-11-23 ] |
|
A big "thank you" to everyone involved! |