Skip to content

Commit

Permalink
MDEV-16708: Unsupported commands for prepared statements
Browse files Browse the repository at this point in the history
Fixed the test main.view
  • Loading branch information
dmitryshulga authored and vuvova committed Jun 17, 2021
1 parent 5478ca7 commit 4decc03
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
4 changes: 4 additions & 0 deletions mysql-test/main/view.test
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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;
Expand Down
5 changes: 4 additions & 1 deletion sql/item.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4decc03

Please sign in to comment.