summaryrefslogtreecommitdiff
path: root/sql/sql_select.h
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-06-07 12:45:09 -0700
committerIgor Babaev <igor@askmonty.org>2017-06-07 12:45:32 -0700
commitc258ca2463947fcc3d69bb50a8b5cf6906778508 (patch)
tree67109ac2bccfda94c8b2cad15eed21e3003275fa /sql/sql_select.h
parent2cb94aa1b70fa01d9e5c1d8a7625415a0220a3d9 (diff)
downloadmariadb-git-c258ca2463947fcc3d69bb50a8b5cf6906778508.tar.gz
Fixed the bug mdev-12838.
If the optimizer chose an execution plan where a semi-join nest were materialized and the result of materialization was scanned to access other tables by ref access it could build a key over columns of the tables from the nest that were actually inaccessible. The patch performs a proper check whether a key that uses columns of the tables from a materialized semi-join nest can be employed to access outer tables.
Diffstat (limited to 'sql/sql_select.h')
-rw-r--r--sql/sql_select.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 0623672840e..1bc1e4c2b7a 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -540,6 +540,8 @@ typedef struct st_join_table {
!(used_sjm_lookup_tables & ~emb_sj_nest->sj_inner_tables));
}
+ bool keyuse_is_valid_for_access_in_chosen_plan(JOIN *join, KEYUSE *keyuse);
+
} JOIN_TAB;
@@ -1003,6 +1005,11 @@ public:
to materialize and access by lookups
*/
table_map sjm_lookup_tables;
+ /**
+ Bitmap of semijoin tables that the chosen plan decided
+ to materialize to scan the results of materialization
+ */
+ table_map sjm_scan_tables;
/*
Constant tables for which we have found a row (as opposed to those for
which we didn't).
@@ -1331,6 +1338,7 @@ public:
pre_sort_join_tab= NULL;
emb_sjm_nest= NULL;
sjm_lookup_tables= 0;
+ sjm_scan_tables= 0;
/*
The following is needed because JOIN::cleanup(true) may be called for
joins for which JOIN::optimize was aborted with an error before a proper