diff options
author | Dmitry Shulga <dmitry.shulga@mariadb.com> | 2021-05-06 13:55:57 +0700 |
---|---|---|
committer | Sergei Golubchik <serg@mariadb.org> | 2021-06-17 19:30:24 +0200 |
commit | 4decc03b285d4a1c42750d6f29c5f0c3a25cd1c4 (patch) | |
tree | ee6112a2ce5c9c4c248233c0e94675952ebaa6d7 | |
parent | 5478ca779a8769c4ebdf03ba5f5d7be9fdcf7ef5 (diff) | |
download | mariadb-git-4decc03b285d4a1c42750d6f29c5f0c3a25cd1c4.tar.gz |
MDEV-16708: Unsupported commands for prepared statements
Fixed the test main.view
-rw-r--r-- | mysql-test/main/view.test | 4 | ||||
-rw-r--r-- | sql/item.cc | 5 |
2 files changed, 8 insertions, 1 deletions
diff --git a/mysql-test/main/view.test b/mysql-test/main/view.test index 805afedc8ae..73322d97591 100644 --- a/mysql-test/main/view.test +++ b/mysql-test/main/view.test @@ -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; diff --git a/sql/item.cc b/sql/item.cc index 3cede11a415..252135f50ad 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -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 |