summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-05-17 10:45:20 +0300
committerunknown <sanja@montyprogram.com>2012-05-17 10:45:20 +0300
commit0520825803c76be46e5d8a3d62d9d1149fe523c7 (patch)
treed529819c084e5fbeada2e98c8cc41ed58a5c9b91 /mysql-test/t/sp.test
parent3d37b67b2bf978c6755508aef0e0a1e64257f41c (diff)
downloadmariadb-git-0520825803c76be46e5d8a3d62d9d1149fe523c7.tar.gz
Test suite of fixed bug (LP bug#993459).
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test36
1 files changed, 36 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index bbbb9784d35..d403e94ebbb 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -8441,3 +8441,39 @@ DROP FUNCTION f1;
--echo # ------------------------------------------------------------------
--echo # -- End of 5.1 tests
--echo # ------------------------------------------------------------------
+
+--echo #
+--echo # LP bug#993459 Execution of PS for a query with GROUP BY
+--echo # returns wrong result (see also mysql bug#13805127)
+--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;