MDEV-25012 Server crash in find_field_in_tables, Assertion `name'

failed in find_field_in_table_ref

The main crash with segfault in find_field_in_tables() was fixed by
6aa47fae30 (MDEV-35276). This fix is for debug assertion.

Since Item_default_value is also Item_field there is nothing to be
done except adding DEFAULT_VALUE_ITEM type check.
This commit is contained in:
Aleksey Midenkov
2025-04-14 18:49:39 +03:00
committed by Oleksandr Byelkin
parent 952ffb55f9
commit a96c094d1b
3 changed files with 45 additions and 1 deletions

View File

@ -19132,4 +19132,25 @@ FROM cte2
GROUP BY 1 ;
( SELECT 1 FROM ( SELECT 1 FROM cte1) dt GROUP BY x HAVING x= 1 )
1
create table t1 (f int);
create view v1 as select f, count(*) c from t1 group by f;
#
# MDEV-25012 Server crash in find_field_in_tables, Assertion `name' failed in find_field_in_table_ref
#
select * from v1 where export_set(1, default(f), 'x', aes_decrypt('secret', f));
f c
show warnings;
Level Code Message
drop view v1;
drop table t1;
create table t(c3 longtext) ;
with cte1 as
(
select default(c3) as a
from t group by 1
)
select * from cte1
where cte1.a >= 1;
a
drop table t;
# End of 10.5 tests

View File

@ -4270,4 +4270,26 @@ SELECT
FROM cte2
GROUP BY 1 ;
create table t1 (f int);
create view v1 as select f, count(*) c from t1 group by f;
--echo #
--echo # MDEV-25012 Server crash in find_field_in_tables, Assertion `name' failed in find_field_in_table_ref
--echo #
select * from v1 where export_set(1, default(f), 'x', aes_decrypt('secret', f));
show warnings;
# cleanup
drop view v1;
drop table t1;
create table t(c3 longtext) ;
with cte1 as
(
select default(c3) as a
from t group by 1
)
select * from cte1
where cte1.a >= 1;
drop table t;
--echo # End of 10.5 tests

View File

@ -11064,7 +11064,8 @@ st_select_lex::build_pushable_cond_for_having_pushdown(THD *thd, Item *cond)
Field_pair *get_corresponding_field_pair(Item *item,
List<Field_pair> pair_list)
{
DBUG_ASSERT(item->type() == Item::FIELD_ITEM ||
DBUG_ASSERT(item->type() == Item::DEFAULT_VALUE_ITEM ||
item->type() == Item::FIELD_ITEM ||
(item->type() == Item::REF_ITEM &&
((((Item_ref *) item)->ref_type() == Item_ref::VIEW_REF) ||
(((Item_ref *) item)->ref_type() == Item_ref::REF))));