summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
authorunknown <anozdrin@mysql.com>2006-05-18 14:44:15 +0400
committerunknown <anozdrin@mysql.com>2006-05-18 14:44:15 +0400
commit02bacd818d750c3763e4496692dd577cd790f132 (patch)
tree6d74403713850dbe045b2739b23f06110c5f28ff /mysql-test/t/sp.test
parentab9eadf21551e0465ac1523b82741e2fc51621ba (diff)
downloadmariadb-git-02bacd818d750c3763e4496692dd577cd790f132.tar.gz
Test case for BUG#18037: Server crash when returning system
variable in stored procedures.
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test46
1 files changed, 46 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index 9995ff5a9ad..1d21a5da187 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -5844,6 +5844,52 @@ DROP PROCEDURE bug18589_p2|
#
+# BUG#18037: Server crash when returning system variable in stored procedures
+# BUG#19633: Stack corruption in fix_fields()/THD::rollback_item_tree_changes()
+#
+
+# Prepare.
+
+--disable_warnings
+DROP FUNCTION IF EXISTS bug18037_f1|
+DROP PROCEDURE IF EXISTS bug18037_p1|
+DROP PROCEDURE IF EXISTS bug18037_p2|
+--enable_warnings
+
+# Test case.
+
+CREATE FUNCTION bug18037_f1() RETURNS INT
+BEGIN
+ RETURN @@server_id;
+END|
+
+CREATE PROCEDURE bug18037_p1()
+BEGIN
+ DECLARE v INT DEFAULT @@server_id;
+END|
+
+CREATE PROCEDURE bug18037_p2()
+BEGIN
+ CASE @@server_id
+ WHEN -1 THEN
+ SELECT 0;
+ ELSE
+ SELECT 1;
+ END CASE;
+END|
+
+SELECT bug18037_f1()|
+CALL bug18037_p1()|
+CALL bug18037_p2()|
+
+# Cleanup.
+
+DROP FUNCTION bug18037_f1|
+DROP PROCEDURE bug18037_p1|
+DROP PROCEDURE bug18037_p2|
+
+
+#
# BUG#NNNN: New bug synopsis
#
#--disable_warnings