summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2021-12-07 09:47:42 +0100
committerSergei Golubchik <serg@mariadb.org>2021-12-07 09:47:42 +0100
commite8a91c18ea136f54a53ae19c6f41482a1b855cff (patch)
treef300f9a1135ab44d329efd60bedc59e4c36e9bdc /sql
parentf458acc81e805d148e01f60fe5c2ded622df7c01 (diff)
parent153b75b5762eacff1ab257e6e22522efd53e7c3e (diff)
downloadmariadb-git-e8a91c18ea136f54a53ae19c6f41482a1b855cff.tar.gz
Merge branch '10.3' into 10.4
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc7
1 files changed, 7 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3272f8b7f65..27fc27f242a 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -5506,6 +5506,7 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (!s->const_keys.is_clear_all())
{
sargable_cond= get_sargable_cond(join, s->table);
+ bool is_sargable_cond_of_where= sargable_cond == &join->conds;
select= make_select(s->table, found_const_table_map,
found_const_table_map,
@@ -5522,6 +5523,12 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
*/
*sargable_cond= select->cond;
+ if (is_sargable_cond_of_where &&
+ join->conds && join->conds->type() == Item::COND_ITEM &&
+ ((Item_cond*) (join->conds))->functype() ==
+ Item_func::COND_AND_FUNC)
+ join->cond_equal= &((Item_cond_and*) (join->conds))->m_cond_equal;
+
s->quick=select->quick;
s->needed_reg=select->needed_reg;
select->quick=0;