[MDEV-23449] alias do not exist and a query do not report an error Created: 2020-08-11 Updated: 2021-06-30 Resolved: 2021-02-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4, 10.5 |
| Fix Version/s: | 10.2.38, 10.3.29, 10.4.19, 10.5.10 |
| Type: | Bug | Priority: | Major |
| Reporter: | Massimo | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
There is a complex query where there is a internal subquery with no alias reported anywhere and there is not error fire once the query run. Tested a simple case:
So there is no alias and it should fire an error. |
| Comments |
| Comment by Varun Gupta (Inactive) [ 2020-08-13 ] | ||||
|
Some context: There are subquery rewrites done mostly for IN/ALL/ANY/EXISTS subquery at the prepare stage. The rewrites are done in these 2 functions:
2) check_and_do_in_subquery_rewrites
| ||||
| Comment by Varun Gupta (Inactive) [ 2020-08-13 ] | ||||
|
Lets take an example
First such queries are not allowed with sql_mode=ONLY_FULL_GROUP_BY. But after the columns are resolved then there is no need of the grouping operation. So to frame it better:
this means, for each GROUP-BY-group of t1.a get some value of t1.b Now extending this for the query
for each row of t2: so with this the semantics of the query is the same as this query
| ||||
| Comment by Michael Widenius [ 2021-01-29 ] | ||||
|
Patch ok. I have just asked Varun for a small update to the commit message to make more clear why it's safe to move the code over this if: | ||||
| Comment by Michael Widenius [ 2021-01-29 ] | ||||
|
ok to push |