[MDEV-24840] Crash caused by query with IN subquery containing union of two table value costructors Created: 2021-02-11 Updated: 2021-06-10 Resolved: 2021-02-16 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | None |
| Fix Version/s: | 10.3.29, 10.4.19, 10.5.10, 10.6.0 |
| Type: | Bug | Priority: | Major |
| Reporter: | Igor Babaev | Assignee: | Igor Babaev |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Description |
|
The following test case causes a crash of the server:
|
| Comments |
| Comment by Igor Babaev [ 2021-02-11 ] | ||||||||||
|
The crash happens for the following reason.
that is supposed to look trough all union operands at the top level of the processed IN/ALL/ANY subquery and wrap each table value constructor into a select:
This transformation allows us to use all optimizations applied to multi-select IN subqueries.
Such queries are not expected by the optimizer phase and cause crashes. | ||||||||||
| Comment by Igor Babaev [ 2021-02-11 ] | ||||||||||
|
The easiest solution for the problem is to use the loop
Yet I prefer to return the new wrapping select by the function Item_subselect::wrap_tvc_into_select in the case of success. In the case of failure the function will return 0; | ||||||||||
| Comment by Oleksandr Byelkin [ 2021-02-11 ] | ||||||||||
|
OK to push |