MDEV-4665 crash when referencing missing function in a subquery
don't ignore the return value fix_fields()
This commit is contained in:
parent
782d86af44
commit
d3157e239a
6
mysql-test/r/sp_missing_4665.result
Normal file
6
mysql-test/r/sp_missing_4665.result
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
create table t (a int);
|
||||||
|
create or replace view v as select 1 from t where a;
|
||||||
|
delete from v where (select g());
|
||||||
|
ERROR 42000: FUNCTION test.g does not exist
|
||||||
|
drop view v;
|
||||||
|
drop table t;
|
9
mysql-test/t/sp_missing_4665.test
Normal file
9
mysql-test/t/sp_missing_4665.test
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
#
|
||||||
|
# MDEV-4665 crash when referencing missing function in a subquery
|
||||||
|
#
|
||||||
|
create table t (a int);
|
||||||
|
create or replace view v as select 1 from t where a;
|
||||||
|
--error ER_SP_DOES_NOT_EXIST
|
||||||
|
delete from v where (select g());
|
||||||
|
drop view v;
|
||||||
|
drop table t;
|
12
sql/table.cc
12
sql/table.cc
@ -3683,6 +3683,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
|
|||||||
bool no_where_clause)
|
bool no_where_clause)
|
||||||
{
|
{
|
||||||
DBUG_ENTER("TABLE_LIST::prep_where");
|
DBUG_ENTER("TABLE_LIST::prep_where");
|
||||||
|
bool res= FALSE;
|
||||||
|
|
||||||
for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local)
|
for (TABLE_LIST *tbl= merge_underlying_list; tbl; tbl= tbl->next_local)
|
||||||
{
|
{
|
||||||
@ -3731,10 +3732,11 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
|
|||||||
if (tbl == 0)
|
if (tbl == 0)
|
||||||
{
|
{
|
||||||
if (*conds && !(*conds)->fixed)
|
if (*conds && !(*conds)->fixed)
|
||||||
(*conds)->fix_fields(thd, conds);
|
res= (*conds)->fix_fields(thd, conds);
|
||||||
*conds= and_conds(*conds, where->copy_andor_structure(thd));
|
if (!res)
|
||||||
if (*conds && !(*conds)->fixed)
|
*conds= and_conds(*conds, where->copy_andor_structure(thd));
|
||||||
(*conds)->fix_fields(thd, conds);
|
if (*conds && !(*conds)->fixed && !res)
|
||||||
|
res= (*conds)->fix_fields(thd, conds);
|
||||||
}
|
}
|
||||||
if (arena)
|
if (arena)
|
||||||
thd->restore_active_arena(arena, &backup);
|
thd->restore_active_arena(arena, &backup);
|
||||||
@ -3742,7 +3744,7 @@ bool TABLE_LIST::prep_where(THD *thd, Item **conds,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DBUG_RETURN(FALSE);
|
DBUG_RETURN(res);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user