Bug #116343 | An unexpected result occurs when using an alias within a subquery in SQL | ||
---|---|---|---|
Submitted: | 11 Oct 2024 12:08 | Modified: | 14 Oct 2024 7:22 |
Reporter: | ru tu | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: Optimizer | Severity: | S3 (Non-critical) |
Version: | 8.0 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[11 Oct 2024 12:08]
ru tu
[11 Oct 2024 12:58]
MySQL Verification Team
Hi Mr. tu, Thank you for your bug report. We have successfully reproduced it on the latest 8.0, 8.4 and 9.0. This is now a verified bug report. Thank you.
[14 Oct 2024 7:22]
Roy Lyseng
Posted by developer: This is not a bug. Using correlation names or range variables as aliases for table expressions is defined by the SQL standard, and is the way that you can refer to multiple instances of a table within a query block (self join), or in an inner and an outer query block (the latter being used for outer references). But to get the query semantics right, it is very important that these names are used consistently when referencing columns.
[14 Oct 2024 9:45]
MySQL Verification Team
Thank you, Roy.