[MDEV-13704] Nested query does not give same result as subquery and an outer query Created: 2017-09-01 Updated: 2020-07-08 Resolved: 2020-07-08 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.2.6, 10.2.7, 10.2.8, 10.3.1 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Jose Costa Teixeira | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | innodb | ||
| Environment: |
Windows 64 |
||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
A nested query does not return correct results in at least one case. Scenario:
This is not happening in 10.1 but only on 102 onwards. I could not reproduce in a simpler scenario. Perhaps this is due to using fulltext search in the subquery, or any other reason. Details: Tables are innodb. Attached the cfg settings I added to my.ini. |
| Comments |
| Comment by Jose Costa Teixeira [ 2017-09-05 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Update: After checking the result of EXPLAIN, it seems that this is related to the use of temporary tables The query that works is (in bold underlined the addition to make it work) is: Select table1.entityKey | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Elena Stepanova [ 2017-09-19 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Thanks for the report. As a workaround, you can set optimizer_switch=orderby_uses_equalities=off in the config file, it should help.
After fixing, please also check this test case. It differs from the first one only in the highlighted line, one extra value is inserted:
With optimizer_switch=orderby_uses_equalities=off both test cases return expected results. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Jose Costa Teixeira [ 2017-09-25 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Hi. The workaround does not work in my specific case. I will have to wait for a fix. Thanks! | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2018-04-20 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
It is possibly a duplicate of |