summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Shulga <dmitry.shulga@mariadb.com>2021-04-28 12:44:46 +0700
committerSergei Golubchik <serg@mariadb.org>2021-06-17 19:30:24 +0200
commit8754fce8b086911a2446cb414f770ece13ef1d27 (patch)
treec074df6e0f750772b8772359d36efa455797e5d6
parentaeca826c5fe9e6709bbdb7f89c12a8c4df31c84f (diff)
downloadmariadb-git-8754fce8b086911a2446cb414f770ece13ef1d27.tar.gz
MDEV-16708: Unsupported commands for prepared statements
Fixed test failures caused by missing output of warnings that got on prepare phase
-rw-r--r--mysql-test/main/derived.test2
-rw-r--r--mysql-test/main/derived_cond_pushdown.test3
-rw-r--r--mysql-test/main/having_cond_pushdown.test4
-rw-r--r--mysql-test/main/subselect.test10
-rw-r--r--mysql-test/main/subselect4.test2
-rw-r--r--mysql-test/main/table_value_constr.test2
6 files changed, 22 insertions, 1 deletions
diff --git a/mysql-test/main/derived.test b/mysql-test/main/derived.test
index 8c41f80ffbd..0d2efca1a26 100644
--- a/mysql-test/main/derived.test
+++ b/mysql-test/main/derived.test
@@ -475,8 +475,10 @@ CREATE TABLE t1 (a INT) ENGINE=MyISAM;
INSERT INTO t1 VALUES (8);
CREATE TABLE t2 (b INT) ENGINE=MyISAM;
INSERT INTO t2 VALUES (1),(7);
+--enable_prepare_warnings
EXPLAIN SELECT * FROM (SELECT * FROM t1) AS table1,
(SELECT DISTINCT * FROM t2) AS table2 WHERE b = a AND a <> ANY (SELECT 9);
+--disable_prepare_warnings
DROP TABLE t1, t2;
set optimizer_switch=@save_derived_optimizer_switch_bug;
diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test
index fb227e85ee6..e6ee05dd644 100644
--- a/mysql-test/main/derived_cond_pushdown.test
+++ b/mysql-test/main/derived_cond_pushdown.test
@@ -1064,9 +1064,10 @@ DROP TABLE t1,t2;
CREATE TABLE t1 (i INT);
CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1;
INSERT INTO t1 VALUES (1),(2);
-
+--enable_prepare_warnings
EXPLAIN FORMAT=JSON
SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
+--disable_prepare_warnings
SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 );
diff --git a/mysql-test/main/having_cond_pushdown.test b/mysql-test/main/having_cond_pushdown.test
index fc75122615c..60ed7ebb660 100644
--- a/mysql-test/main/having_cond_pushdown.test
+++ b/mysql-test/main/having_cond_pushdown.test
@@ -73,14 +73,18 @@ GROUP BY t1.a
HAVING (t1.a>1) OR (a IN (SELECT 3));
eval $no_pushdown $query;
eval $query;
+--enable_prepare_warnings
eval explain $query;
eval explain format=json $query;
+--disable_prepare_warnings
let $query=
SELECT t1.a,MAX(t1.b)
FROM t1
WHERE (t1.a>1) OR (a IN (SELECT 3))
GROUP BY t1.a;
+--enable_prepare_warnings
eval $no_pushdown explain format=json $query;
+--disable_prepare_warnings
let $query=
SELECT t1.a,MAX(t1.b),MIN(t1.c)
diff --git a/mysql-test/main/subselect.test b/mysql-test/main/subselect.test
index a58a08e1a58..19c30bd6dc8 100644
--- a/mysql-test/main/subselect.test
+++ b/mysql-test/main/subselect.test
@@ -30,11 +30,15 @@ SET optimizer_switch='mrr=on,mrr_sort_keys=on,index_condition_pushdown=on';
SET optimizer_use_condition_selectivity=4;
select (select 2);
+
+--enable_prepare_warnings
explain extended select (select 2);
SELECT (SELECT 1) UNION SELECT (SELECT 2);
explain extended SELECT (SELECT 1) UNION SELECT (SELECT 2);
SELECT (SELECT (SELECT 0 UNION SELECT 0));
explain extended SELECT (SELECT (SELECT 0 UNION SELECT 0));
+--disable_prepare_warnings
+
-- error ER_ILLEGAL_REFERENCE
SELECT (SELECT 1 FROM (SELECT 1) as b HAVING a=1) as a;
-- error ER_ILLEGAL_REFERENCE
@@ -441,11 +445,15 @@ SELECT * FROM (SELECT 1) b WHERE 1 IN (SELECT *);
CREATE TABLE t2 (id int(11) default NULL, KEY id (id)) ENGINE=MyISAM CHARSET=latin1;
INSERT INTO t2 VALUES (1),(2);
SELECT * FROM t2 WHERE id IN (SELECT 1);
+--enable_prepare_warnings
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1);
+--disable_prepare_warnings
SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
+--enable_prepare_warnings
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1+(select 1));
EXPLAIN EXTENDED SELECT * FROM t2 WHERE id IN (SELECT 1 UNION SELECT 3);
+--disable_prepare_warnings
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 3);
SELECT * FROM t2 WHERE id IN (SELECT 5 UNION SELECT 2);
-- error ER_UPDATE_TABLE_USED
@@ -501,7 +509,9 @@ select 1.5 > ALL (SELECT * from t1);
select 10.5 > ALL (SELECT * from t1);
select 1.5 > ANY (SELECT * from t1);
select 10.5 > ANY (SELECT * from t1);
+--enable_prepare_warnings
explain extended select (select a+1) from t1;
+--disable_prepare_warnings
select (select a+1) from t1;
drop table t1;
diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test
index 2f65db875f8..8be44f214f0 100644
--- a/mysql-test/main/subselect4.test
+++ b/mysql-test/main/subselect4.test
@@ -104,8 +104,10 @@ DROP TABLE t1,t2;
--echo # Bug#54568: create view cause Assertion failed: 0,
--echo # file .\item_subselect.cc, line 836
--echo #
+--enable_prepare_warnings
EXPLAIN SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
DESCRIBE SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
+--disable_prepare_warnings
--echo # None of the below should crash
CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
diff --git a/mysql-test/main/table_value_constr.test b/mysql-test/main/table_value_constr.test
index ddc949d8c00..9f06be800e6 100644
--- a/mysql-test/main/table_value_constr.test
+++ b/mysql-test/main/table_value_constr.test
@@ -1471,7 +1471,9 @@ insert into t2 values (1), (2);
let $q1=
select (values ((select 2))) from t2;
eval $q1;
+--enable_prepare_warnings
eval explain $q1;
+--disable_prepare_warnings
eval prepare stmt from "$q1";
execute stmt;
execute stmt;