summaryrefslogtreecommitdiff
path: root/sql/sql_lex.cc
diff options
context:
space:
mode:
authorSergei Petrunia <sergey@mariadb.com>2022-05-04 12:24:14 +0300
committerSergei Petrunia <sergey@mariadb.com>2022-05-05 18:58:25 +0300
commit8dbfaa2aa4d6158f81bba3f5a46d683912b06868 (patch)
treeea6f1b05a09de77fad46b750412617652380976f /sql/sql_lex.cc
parentba4927e520190bbad763bb5260ae154f29a61231 (diff)
downloadmariadb-git-8dbfaa2aa4d6158f81bba3f5a46d683912b06868.tar.gz
MDEV-28437: Assertion `!eliminated' failed in Item_subselect::exec
(This is the assert that was added in fix for MDEV-26047) Table elimination may remove an ON expression from an outer join. However SELECT_LEX::update_used_tables() will still call item->walk(&Item::eval_not_null_tables) for eliminated expressions. If the subquery is constant and cheap Item_cond_and will attempt to evaluate it, which will trigger an assert. The fix is not to call update_used_tables() or eval_not_null_tables() for ON expressions that were eliminated.
Diffstat (limited to 'sql/sql_lex.cc')
-rw-r--r--sql/sql_lex.cc9
1 files changed, 6 insertions, 3 deletions
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index 22ee8801e3a..8e718f2a942 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -4229,7 +4229,7 @@ void SELECT_LEX::update_used_tables()
}
}
while ((embedding= embedding->embedding));
- if (tl->on_expr)
+ if (tl->on_expr && !is_eliminated_table(join->eliminated_tables, tl))
{
tl->on_expr->update_used_tables();
tl->on_expr->walk(&Item::eval_not_null_tables, 0, NULL);
@@ -4253,8 +4253,11 @@ void SELECT_LEX::update_used_tables()
if (embedding->on_expr &&
embedding->nested_join->join_list.head() == tl)
{
- embedding->on_expr->update_used_tables();
- embedding->on_expr->walk(&Item::eval_not_null_tables, 0, NULL);
+ if (!is_eliminated_table(join->eliminated_tables, embedding))
+ {
+ embedding->on_expr->update_used_tables();
+ embedding->on_expr->walk(&Item::eval_not_null_tables, 0, NULL);
+ }
}
tl= embedding;
embedding= tl->embedding;