maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #13152
Re: 4ba5b444b4b: MDEV-28437: Assertion `!eliminated' failed in Item_subselect::exec
Hi, Sergei,
On May 04, Sergei Petrunia wrote:
> revision-id: 4ba5b444b4b (mariadb-10.2.43-97-g4ba5b444b4b)
> parent(s): 70555454b4c
> author: Sergei Petrunia
> committer: Sergei Petrunia
> timestamp: 2022-05-04 12:24:48 +0300
> message:
>
> 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.
>
> 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)
> {
can embedding be eliminated?
if yes - does it make sense to do anything in tl's below that eliminated
embedding? Perhaps it should be (in the do..while above), like
do
{
bool maybe_null;
if ((maybe_null= MY_TEST(embedding->outer_join)))
{
tl->table->maybe_null= maybe_null;
break;
}
+ if (is_eliminated_table(join->eliminated_tables, embedding))
+ tl= embedding->embedding;
}
while ((embedding= embedding->embedding));
> + 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;
Regards,
Sergei
VP of MariaDB Server Engineering
and security@xxxxxxxxxxx