summaryrefslogtreecommitdiff
path: root/sql/opt_split.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2018-08-03 14:54:02 -0700
committerIgor Babaev <igor@askmonty.org>2018-08-03 15:09:49 -0700
commitd453374fc480112266996a1026b97654cc174c09 (patch)
treee3dbc26ed568dec0c2c86b3d11ed88dc72c06c86 /sql/opt_split.cc
parent7749745b7d688bd35d92219869f93dd0b44117fc (diff)
downloadmariadb-git-d453374fc480112266996a1026b97654cc174c09.tar.gz
MDEV-16801 seg_fault on a query
The bug was in the in the code of JOIN::check_for_splittable_materialized() where the structures describing the fields of a materialized derived table that potentially could be used in split optimization were build. As a result of this bug some fields that were not usable for splitting were detected as usable. This could trigger crashes further in st_join_table::choose_best_splitting().
Diffstat (limited to 'sql/opt_split.cc')
-rw-r--r--sql/opt_split.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/opt_split.cc b/sql/opt_split.cc
index 37853bdbbe9..611e70376c8 100644
--- a/sql/opt_split.cc
+++ b/sql/opt_split.cc
@@ -413,7 +413,8 @@ bool JOIN::check_for_splittable_materialized()
for (cand= cand_start; cand < cand_end; cand++)
{
- if (cand->underlying_field->field_index + 1 == fldnr)
+ if (cand->underlying_field->table == table &&
+ cand->underlying_field->field_index + 1 == fldnr)
{
cand->is_usable_for_ref_access= true;
break;