[MDEV-32609] Derived subquery selecting from dummy table causes segv Created: 2023-10-27 Updated: 2024-02-08 |
|
| Status: | Confirmed |
| Project: | MariaDB Server |
| Component/s: | Optimizer - Window functions, Storage Engine - InnoDB |
| Affects Version/s: | 10.4, 10.5, 10.6, 10.9, 10.10, 10.11, 11.1, 11.2 |
| Fix Version/s: | 10.4, 10.5, 10.6, 10.11, 11.1, 11.2 |
| Type: | Bug | Priority: | Critical |
| Reporter: | csfuzz | Assignee: | Yuchen Pei |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||
| Description |
|
Attempting backtrace. You can use the following information to find out |
| Comments |
| Comment by Yuchen Pei [ 2024-02-06 ] | ||||||||||||
|
In the original case, if I change to default mtr engine (myisam) then the crash does not happen. | ||||||||||||
| Comment by Yuchen Pei [ 2024-02-07 ] | ||||||||||||
|
Some low level analysis. Consider the simplified case (SELECT 5 a FROM dual ORDER BY a) ORDER BY AVG(a) OVER () ; The subquery (SELECT 5 a FROM dual ORDER BY a) is marked as For comparison, the following works, with the same query marked as
To take a step back, why is the subquery marked as derived in the The kb[1] says > Derived tables are subqueries in the FROM clause. But there's no FROM before (SELECT 5 a ORDER BY a). Is there a [1] https://mariadb.com/kb/en/optimizations-for-derived-tables/ | ||||||||||||
| Comment by Yuchen Pei [ 2024-02-07 ] | ||||||||||||
|
The reason that the original case fails under innodb but not myisam is
Perhaps we could fix it by skipping make_aggr_tables_info() for |