MDEV-4593: p_s: crash in simplify_joins with delete using subselect from view
mysql_derived_merge_for_insert() should not be called for views or derived tables which are not put (directly or via other views) in main SELECT_LEX "join list".
This commit is contained in:
parent
fce7fc43ba
commit
ad947563ac
@ -4651,6 +4651,18 @@ a
|
|||||||
1
|
1
|
||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
#
|
||||||
|
# MDEV-4593: p_s: crash in simplify_joins with delete using subselect
|
||||||
|
# from view
|
||||||
|
#
|
||||||
|
create table `t1`(`a` int);
|
||||||
|
create table `t2`(`a` int);
|
||||||
|
create or replace view `v1` as select `a` from `t1`;
|
||||||
|
prepare s from "delete from `t2` order by (select 1 from `v1`)";
|
||||||
|
execute s;
|
||||||
|
deallocate prepare s;
|
||||||
|
drop view v1;
|
||||||
|
drop tables t1,t2;
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
# -- End of 5.3 tests.
|
# -- End of 5.3 tests.
|
||||||
# -----------------------------------------------------------------
|
# -----------------------------------------------------------------
|
||||||
|
@ -4596,6 +4596,20 @@ WHERE a = alias.a );
|
|||||||
drop view v1;
|
drop view v1;
|
||||||
drop table t1,t2;
|
drop table t1,t2;
|
||||||
|
|
||||||
|
--echo #
|
||||||
|
--echo # MDEV-4593: p_s: crash in simplify_joins with delete using subselect
|
||||||
|
--echo # from view
|
||||||
|
--echo #
|
||||||
|
|
||||||
|
create table `t1`(`a` int);
|
||||||
|
create table `t2`(`a` int);
|
||||||
|
create or replace view `v1` as select `a` from `t1`;
|
||||||
|
prepare s from "delete from `t2` order by (select 1 from `v1`)";
|
||||||
|
execute s;
|
||||||
|
deallocate prepare s;
|
||||||
|
drop view v1;
|
||||||
|
drop tables t1,t2;
|
||||||
|
|
||||||
--echo # -----------------------------------------------------------------
|
--echo # -----------------------------------------------------------------
|
||||||
--echo # -- End of 5.3 tests.
|
--echo # -- End of 5.3 tests.
|
||||||
--echo # -----------------------------------------------------------------
|
--echo # -----------------------------------------------------------------
|
||||||
|
@ -83,7 +83,16 @@ mysql_handle_derived(LEX *lex, uint phases)
|
|||||||
sl && !res;
|
sl && !res;
|
||||||
sl= sl->next_select_in_list())
|
sl= sl->next_select_in_list())
|
||||||
{
|
{
|
||||||
for (TABLE_LIST *cursor= sl->get_table_list();
|
TABLE_LIST *cursor= sl->get_table_list();
|
||||||
|
/*
|
||||||
|
DT_MERGE_FOR_INSERT is not needed for views/derived tables inside
|
||||||
|
subqueries. Views and derived tables of subqueries should be
|
||||||
|
processed normally.
|
||||||
|
*/
|
||||||
|
if (phases == DT_MERGE_FOR_INSERT &&
|
||||||
|
cursor && cursor->top_table()->select_lex != &lex->select_lex)
|
||||||
|
continue;
|
||||||
|
for (;
|
||||||
cursor && !res;
|
cursor && !res;
|
||||||
cursor= cursor->next_local)
|
cursor= cursor->next_local)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user