MDEV-16708: Unsupported commands for prepared statements

Fixed the test main.view
This commit is contained in:
Dmitry Shulga 2021-05-06 13:55:57 +07:00 committed by Sergei Golubchik
parent 5478ca779a
commit 4decc03b28
2 changed files with 8 additions and 1 deletions

View File

@ -3081,7 +3081,9 @@ create view v1 as select * from t1 order by f2;
select * from v1;
explain extended select * from v1;
select * from v1 order by f1;
--enable_prepare_warnings
explain extended select * from v1 order by f1;
--disable_prepare_warnings
drop view v1;
drop table t1;
@ -4421,7 +4423,9 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT f1 FROM t1;
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1 FROM v1 ORDER BY f1;
SELECT * FROM v2 AS a1, v2 AS a2;
--enable_prepare_warnings
EXPLAIN EXTENDED SELECT * FROM v2 AS a1, v2 AS a2;
--disable_prepare_warnings
DROP VIEW v1, v2;
DROP TABLE t1;

View File

@ -5531,9 +5531,12 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
*/
Name_resolution_context *last_checked_context= context;
Item **ref= (Item **) not_found_item;
SELECT_LEX *current_sel= thd->lex->current_select;
Name_resolution_context *outer_context= 0;
SELECT_LEX *select= 0;
outer_context= context->outer_context;
if (current_sel->master_unit()->outer_select())
outer_context= context->outer_context;
/*
This assert is to ensure we have an outer contex when *from_field