Commit 02bacd81 authored by unknown's avatar unknown

Test case for BUG#18037: Server crash when returning system

variable in stored procedures.

parent ab9eadf2
......@@ -4960,4 +4960,34 @@ aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP FUNCTION bug18589_f1|
DROP PROCEDURE bug18589_p1|
DROP PROCEDURE bug18589_p2|
DROP FUNCTION IF EXISTS bug18037_f1|
DROP PROCEDURE IF EXISTS bug18037_p1|
DROP PROCEDURE IF EXISTS bug18037_p2|
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()|
bug18037_f1()
1
CALL bug18037_p1()|
CALL bug18037_p2()|
1
1
DROP FUNCTION bug18037_f1|
DROP PROCEDURE bug18037_p1|
DROP PROCEDURE bug18037_p2|
drop table t1,t2;
......@@ -5843,6 +5843,52 @@ DROP PROCEDURE bug18589_p1|
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
#
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment