summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2021-11-24 23:19:22 -0800
committerIgor Babaev <igor@askmonty.org>2021-11-26 13:02:39 -0800
commitac963142ee351c9359442cbdc1b20ea0283e6a02 (patch)
tree10a0023a0fd0b59e8c2a27de1a6cc076071245be /sql
parentf5441ef4dac9f3fd5dfe1bfa25a514715fee649f (diff)
downloadmariadb-git-ac963142ee351c9359442cbdc1b20ea0283e6a02.tar.gz
MDEV-26553 NOT IN subquery construct crashing 10.1 and up
This bug was introduced by commit be00e279c6061134a33a8099fd69d4304735d02e The commit was applied for the task MDEV-6480 that allowed to remove top level disjuncts from WHERE conditions if the range optimizer evaluated them as always equal to FALSE/NULL. If such disjuncts are removed the WHERE condition may become an AND formula and if this formula contains multiple equalities the field JOIN::item_equal must be updated to refer to these equalities. The above mentioned commit forgot to do this and it could cause crashes for some queries. Approved by Oleksandr Byelkin <sanja@mariadb.com>
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_select.cc6
1 files changed, 6 insertions, 0 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 54a2facfe9f..47422116e38 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -4504,7 +4504,13 @@ make_join_statistics(JOIN *join, List<TABLE_LIST> &tables_list,
if (*s->on_expr_ref)
*s->on_expr_ref= select->cond;
else
+ {
join->conds= select->cond;
+ if (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;