diff options
Diffstat (limited to 'mysql-test/t/ps.test')
-rw-r--r-- | mysql-test/t/ps.test | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/mysql-test/t/ps.test b/mysql-test/t/ps.test index 58e85c7a3a1..b2f64b8172b 100644 --- a/mysql-test/t/ps.test +++ b/mysql-test/t/ps.test @@ -1,5 +1,6 @@ -- source include/not_embedded.inc -- source include/have_log_bin.inc +call mtr.add_suppression('Unsafe statement written to the binary log using statement format since BINLOG_FORMAT = STATEMENT.'); # # SQL Syntax for Prepared Statements test # @@ -249,8 +250,10 @@ prepare stmt1 from "select 1 into @var"; execute stmt1; execute stmt1; prepare stmt1 from "create table t1 select 1 as i"; +--disable_warnings ONCE execute stmt1; drop table t1; +--disable_warnings ONCE execute stmt1; prepare stmt1 from "insert into t1 select i from t1"; execute stmt1; @@ -443,6 +446,7 @@ deallocate prepare stmt; create table t1 (a int); insert into t1 values (1),(2),(3); create table t2 select * from t1; +--disable_warnings prepare stmt FROM 'create table t2 select * from t1'; drop table t2; execute stmt; @@ -452,6 +456,7 @@ execute stmt; execute stmt; drop table t2; execute stmt; +--enable_warnings drop table t1,t2; deallocate prepare stmt; @@ -1187,6 +1192,7 @@ create database mysqltest character set utf8; prepare stmt1 from "create table mysqltest.t1 (c char(10))"; prepare stmt2 from "create table mysqltest.t2 select 'test'"; execute stmt1; +--disable_warnings ONCE execute stmt2; show create table mysqltest.t1; show create table mysqltest.t2; @@ -1194,6 +1200,7 @@ drop table mysqltest.t1; drop table mysqltest.t2; alter database mysqltest character set latin1; execute stmt1; +--disable_warnings ONCE execute stmt2; show create table mysqltest.t1; show create table mysqltest.t2; @@ -3370,6 +3377,94 @@ disconnect con1; SELECT * FROM (SELECT 1 UNION SELECT 2) t; +--echo +--echo # Bug#13805127: Stored program cache produces wrong result in same THD +--echo + +PREPARE s1 FROM +" +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2 +"; + +--echo +SET @x = 1; +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +--echo +EXECUTE s1; + +--echo +SET @x = 2; +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +--echo +EXECUTE s1; + +--echo +SET @x = 1; +SELECT c1, t2.c2, count(c3) +FROM + ( + SELECT 3 as c2 FROM dual WHERE @x = 1 + UNION + SELECT 2 FROM dual WHERE @x = 1 OR @x = 2 + ) AS t1, + ( + SELECT '2012-03-01 01:00:00' AS c1, 3 as c2, 1 as c3 FROM dual + UNION + SELECT '2012-03-01 02:00:00', 3, 2 FROM dual + UNION + SELECT '2012-03-01 01:00:00', 2, 1 FROM dual + ) AS t2 +WHERE t2.c2 = t1.c2 +GROUP BY c1, c2; +--echo +EXECUTE s1; + +DEALLOCATE PREPARE s1; --echo # --echo # End of 5.5 tests. |