mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +03:00
MDEV-31240 Crash with condition pushable into derived and containing outer reference
This bug could affect queries containing a subquery over splittable derived
tables and having an outer references in its WHERE clause. If such subquery
contained an equality condition whose left part was a reference to a column
of the derived table and the right part referred only to outer columns
then the server crashed in the function st_join_table::choose_best_splitting()
The crashing code was added in the commit ce7ffe61d8
that made the code of the function sensitive to presence of the flag
OUTER_REF_TABLE_BIT in the KEYUSE_EXT::needed_in_prefix fields.
The field needed_in_prefix of the KEYUSE_EXT structure should not contain
table maps with OUTER_REF_TABLE_BIT or RAND_TABLE_BIT.
Note that this fix is quite conservative: for affected queries it just
returns the query plans that were used before the above mentioned commit.
In fact the equalities causing crashes should be pushed into derived tables
without any usage of split optimization.
Approved by Sergei Petrunia <sergey@mariadb.com>
This commit is contained in:
committed by
Sergei Golubchik
parent
aa713f5ae2
commit
8f3bf593d2
@@ -664,7 +664,8 @@ add_ext_keyuse_for_splitting(Dynamic_array<KEYUSE_EXT> *ext_keyuses,
|
||||
keyuse_ext.cond_guard= added_key_field->cond_guard;
|
||||
keyuse_ext.sj_pred_no= added_key_field->sj_pred_no;
|
||||
keyuse_ext.validity_ref= 0;
|
||||
keyuse_ext.needed_in_prefix= added_key_field->val->used_tables();
|
||||
keyuse_ext.needed_in_prefix= added_key_field->val->used_tables() &
|
||||
~(OUTER_REF_TABLE_BIT | RAND_TABLE_BIT);
|
||||
keyuse_ext.validity_var= false;
|
||||
return ext_keyuses->push(keyuse_ext);
|
||||
}
|
||||
|
Reference in New Issue
Block a user