[MDEV-20356] Subquery syntax differences between 10.1/10.4 and 10.2/10.3 Created: 2019-08-15 Updated: 2020-08-25 Resolved: 2020-03-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Data Manipulation - Subquery |
| Affects Version/s: | 10.2.26, 10.2.31, 10.3.17, 10.3.22 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Hartmut Holzgraefe | Assignee: | Oleksandr Byelkin |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Description |
|
With 10.2 and 10.3, a subquery can't refer to columns of the outer query,
Expected result, as seen with MariaDB 10.1.x and 10.4.7:
Actual result with 10.2 and 10.3 GA versions:
|
| Comments |
| Comment by Hartmut Holzgraefe [ 2019-08-15 ] | |||||||||||
|
It still works in 10.2.0, but fails starting with 10.2.1, then again it works again starting from 10.4.0. I tried to track the actual change down with git bisect, but failed | |||||||||||
| Comment by Hartmut Holzgraefe [ 2019-08-15 ] | |||||||||||
|
I also tested this on MySQL, where it is supported starting with 5.7, and with postgreSQL 10.6, which also supports it. | |||||||||||
| Comment by Elena Stepanova [ 2019-08-15 ] | |||||||||||
|
There was a discussion about WHERE without FROM triggered by Assigning to bar for further handling. | |||||||||||
| Comment by Oleksandr Byelkin [ 2019-10-11 ] | |||||||||||
|
WHERE and FROM in not usual order | |||||||||||
| Comment by Hartmut Holzgraefe [ 2019-10-11 ] | |||||||||||
|
sanja the WHERE is on a different SELECT than the two FROMs:
| |||||||||||
| Comment by Oleksandr Byelkin [ 2019-11-27 ] | |||||||||||
|
SELECT 1 WHERE 1; was never working, so actually we should fix cases where it was allowed in subqueries (something completely different from the author wish) | |||||||||||
| Comment by Oleksandr Byelkin [ 2019-11-27 ] | |||||||||||
|
The question is do we really want fix it is vaerions < 10.2, also how urgent is to prohoibing it in 10.4+ ? | |||||||||||
| Comment by Hartmut Holzgraefe [ 2020-02-13 ] | |||||||||||
|
I re-tested on other databases, with the result: MySQL -> query works in 5.7. and 8.0, but not in earlier versions PostgreSQL -> works with 10.6 and 11.5 SQLite -> does not work with 2.8, but does with 3.29 So we may change this back to "not working"; but I'd probably have a hard time to convince the customer that we are doing "the right" thing while at least all major other open source contenders, even pgsql who are usually more strict on such things that we are, decided to do the opposite ...? PS: I don't remember having changed the priority? | |||||||||||
| Comment by Oleksandr Byelkin [ 2020-02-13 ] | |||||||||||
|
It is 10.2:
So what is working in 10.2? | |||||||||||
| Comment by Oleksandr Byelkin [ 2020-02-13 ] | |||||||||||
|
Other example from 10.2:
| |||||||||||
| Comment by Hartmut Holzgraefe [ 2020-03-16 ] | |||||||||||
|
As it works the same as it did in 10.2 and 10.3 with current versions of MySQL, PostgreSQL, SQLite I still think the current 10.4 behavior is a regression bug, and the 10.2/10.3 behavior should be restored ... | |||||||||||
| Comment by Sergei Golubchik [ 2020-03-16 ] | |||||||||||
|
I don't quite understand from the bug report, could you elaborate please? What worked in 10.2 and 10.3 and doesn't work in 10.4? | |||||||||||
| Comment by Hartmut Holzgraefe [ 2020-03-16 ] | |||||||||||
|
The test case given in the initial description as "how to reproduce" works fine on MariaDB 10.2, 10.3 – and also on current versions of MySQL, PostgreSQL and SQLite--, but with 10.4 it gives the shown syntax error again, as it did in 10.1 ... | |||||||||||
| Comment by Hartmut Holzgraefe [ 2020-03-16 ] | |||||||||||
|
Ok, now I confused myself, too. 10.1, 10.4 and 10.5 work, it is 10.2 and 10.3 where the syntax error is thrown, so this is a regression in 10.2 and 10.3 that was only fixed in 10.4 again somehow (the "Affected versions" field, and the very first sentence in the initial description, say so, looks as if I got confused about this over time myself ...) So what's actually wrong IMHO is the fix version. There's nothing to be fixed in 10.4, it's behaving fine in this respect. It is 10.2 and 10.3 that need fixing, or a clear "won't fix, upgrade to 10.4 if affected by this" |