[MDEV-18255] Server crashes in Bitmap<64u>::intersect Created: 2019-01-15 Updated: 2019-02-18 Resolved: 2019-01-24 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.0, 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.4.3, 10.1.38, 10.0.38, 10.2.22, 10.3.13 |
| Type: | Bug | Priority: | Blocker |
| Reporter: | Alice Sherepa | Assignee: | Varun Gupta (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | regression | ||
| Issue Links: |
|
||||||||
| Description |
|
Introduced in commit d0d0f88f2cd4da23c2c2da702da51fb533e7fb8a |
| Comments |
| Comment by Varun Gupta (Inactive) [ 2019-01-17 ] | |||||||||||||||||||||||||||||
|
Approach 1 | |||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2019-01-19 ] | |||||||||||||||||||||||||||||
|
Approach 2 JOIN::optimize_unflattened_subqueries for a certain select $X: | |||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2019-01-19 ] | |||||||||||||||||||||||||||||
|
Also some further details
Case 1
So we have two cases , in case 1 we don't execute the subquery while in the 2nd case we execute the subquery. | |||||||||||||||||||||||||||||
| Comment by Varun Gupta (Inactive) [ 2019-01-19 ] | |||||||||||||||||||||||||||||
|
Patch | |||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2019-01-23 ] | |||||||||||||||||||||||||||||
|
Looking at the patch, this result difference:
The testcase for it is:
The change in .result matche the discussion between Varun and me:
We consider a subquery to be a kind of expression. So, in the above example, the subqueries must be computed, with outside references having NULL values. But when I look at the bug which introduced the testcase: https://bugs.launchpad.net/maria/+bug/985667 I see that Timour has intentionally changed the behavior that we think is correct to something that we think is not correct. This requires careful analysis. | |||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2019-01-23 ] | |||||||||||||||||||||||||||||
|
In MySQL 8.0, one needs to remove ONLY_FULL_GROUP_BY from @@sql_mode to get the
That is, it doesn't compute the subqueries. | |||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2019-01-24 ] | |||||||||||||||||||||||||||||
|
Look at this code in item_subselect.cc:
It makes non-constant subquery in select list to produce NULL value for implict-grouping's NULL-summary-row. const_item gets its value from const_item_cache:
. Here, before the patch we have const_item_cache=false, even if subquery_item->used_tables()=0 and the subquery item is marked as uncorrelated. | |||||||||||||||||||||||||||||
| Comment by Sergei Petrunia [ 2019-01-24 ] | |||||||||||||||||||||||||||||
|
Agreed to push the first patch as it is a more limited, conservative solution. |