Skip to content

Commit 4decc03

Browse files
dmitryshulgavuvova
authored andcommitted
MDEV-16708: Unsupported commands for prepared statements
Fixed the test main.view
1 parent 5478ca7 commit 4decc03

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

mysql-test/main/view.test

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3081,7 +3081,9 @@ create view v1 as select * from t1 order by f2;
30813081
select * from v1;
30823082
explain extended select * from v1;
30833083
select * from v1 order by f1;
3084+
--enable_prepare_warnings
30843085
explain extended select * from v1 order by f1;
3086+
--disable_prepare_warnings
30853087
drop view v1;
30863088
drop table t1;
30873089

@@ -4421,7 +4423,9 @@ CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT f1 FROM t1;
44214423
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1 FROM v1 ORDER BY f1;
44224424

44234425
SELECT * FROM v2 AS a1, v2 AS a2;
4426+
--enable_prepare_warnings
44244427
EXPLAIN EXTENDED SELECT * FROM v2 AS a1, v2 AS a2;
4428+
--disable_prepare_warnings
44254429

44264430
DROP VIEW v1, v2;
44274431
DROP TABLE t1;

sql/item.cc

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5531,9 +5531,12 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference)
55315531
*/
55325532
Name_resolution_context *last_checked_context= context;
55335533
Item **ref= (Item **) not_found_item;
5534+
SELECT_LEX *current_sel= thd->lex->current_select;
55345535
Name_resolution_context *outer_context= 0;
55355536
SELECT_LEX *select= 0;
5536-
outer_context= context->outer_context;
5537+
5538+
if (current_sel->master_unit()->outer_select())
5539+
outer_context= context->outer_context;
55375540

55385541
/*
55395542
This assert is to ensure we have an outer contex when *from_field

0 commit comments

Comments
 (0)