summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorTor Didriksen <tor.didriksen@oracle.com>2012-04-18 13:14:05 +0200
committerTor Didriksen <tor.didriksen@oracle.com>2012-04-18 13:14:05 +0200
commit11b2cf4f03b7c4b84c26d3c95cdf6f8fa6322349 (patch)
tree4d01c9aee49ac506a5ef0f801599bedd03001e6e /mysql-test/t/sp.test
parent448c3d627542c835ac7ea1851e8e019596e377fd (diff)
downloadmariadb-git-11b2cf4f03b7c4b84c26d3c95cdf6f8fa6322349.tar.gz
Backport 5.5=>5.1 Patch for Bug#13805127:
Stored program cache produces wrong result in same THD.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test37
1 files changed, 37 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index ae4e1dd588e..75d290f7c8b 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -8429,3 +8429,40 @@ DROP FUNCTION f1;
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------
+
+--echo
+--echo # Bug#13805127: Stored program cache produces wrong result in same THD
+--echo
+
+delimiter |;
+
+CREATE PROCEDURE p1(x INT UNSIGNED)
+BEGIN
+ 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
+ ;
+END|
+
+delimiter ;|
+
+--echo
+CALL p1(1);
+CALL p1(2);
+CALL p1(1);
+
+DROP PROCEDURE p1;
+