Bug #99971 colmn name from outer query cannot be resolved in the subquery
| Submitted: | 24 Jun 2020 11:50 | Modified: | 25 Jun 2020 12:14 |
|---|---|---|---|
| Reporter: | Yushan ZHANG | Email Updates: | |
| Status: | Not a Bug | Impact on me: | |
| Category: | MySQL Server: Parser | Severity: | S3 (Non-critical) |
| Version: | 5.7, 8.0 | OS: | Any |
| Assigned to: | CPU Architecture: | Any | |
| Tags: | parser, subquery | ||
[24 Jun 2020 11:50]
Yushan ZHANG
[24 Jun 2020 14:25]
MySQL Verification Team
Hi Mr. ZHANG, Thank you for your bug report. I repeated your bug in both latest 5.7 and 8.0. I have analysed latest SQL standard and I do not see any reason why an alias column could not be used in the nested query. Verified as reported.
[25 Jun 2020 0:15]
Øystein Grøvlen
Why should it be allowed in subquery when it is generally not allowed in WHERE clause: mysql> select a+1 as c from t1 where c = 2; ERROR 1054 (42S22): Unknown column 'c' in 'where clause'
[25 Jun 2020 11:53]
MySQL Verification Team
Hi Øystein Grøvlen, I have analysed SQL standard. Could not find anything on why would this be prohibited. Can you provided a reasoning behind it ????
[25 Jun 2020 12:14]
MySQL Verification Team
Actually, this turned out to be documented limitation and it will stay so indefinitely. https://dev.mysql.com/doc/refman/8.0/en/problems-with-alias.html
Portions of this website are copyright © 2001, 2002 The PHP Group
Page generated in 0.041 sec. using MySQL 8.4.7-u6-cloud
Timestamp references displayed by the system are UTC.
Content reproduced on this site is the property of the
respective copyright holders.
It is not reviewed in advance
by Oracle and does not necessarily represent the opinion of
Oracle or any other party.