1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-23723: Crash when test_if_skip_sort_order() is checked for derived ...

The problem was caused by the following scenario:

Subquery's table has two indexes, KEY a(a), KEY a_b(a,b)

- LATERAL DERIVED optimization decides to use index a.
  = The subquery uses ref access over key a.
- test_if_skip_sort_order() sees that KEY a_b satisfies the
  subquery's GROUP BY clause, and attempts to switch to it.
  = It fails to do so, because KEYUSE objects for index a_b
    are switched off.

Fixed by disallowing to change the ref access key if it uses KEYUSE
objects injected by LATERAL DERIVED optimization.
This commit is contained in:
Sergei Petrunia
2021-04-29 19:30:07 +03:00
parent 8f9a72a150
commit 2820f30dde
4 changed files with 70 additions and 1 deletions

View File

@ -178,6 +178,12 @@ typedef struct st_table_ref
*/
bool disable_cache;
/*
If true, this ref access was constructed from equalities generated by
LATERAL DERIVED (aka GROUP BY splitting) optimization
*/
bool uses_splitting;
bool tmp_table_index_lookup_init(THD *thd, KEY *tmp_key, Item_iterator &it,
bool value, uint skip= 0);
bool is_access_triggered();