mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
Bug#27415 Text Variables in stored procedures
- Problem was reported as a SP variable using itself as right value inside SUBSTR caused corruption of data. - This bug could not be verified in either 5.0bk or 5.1bk - Added test case to prevent future regressions.
This commit is contained in:
parent
35616ba5c7
commit
ed43ceb178
2 changed files with 85 additions and 0 deletions
|
@ -1161,3 +1161,44 @@ CALL p1();
|
|||
v_text
|
||||
abc|def
|
||||
DROP PROCEDURE p1;
|
||||
DROP PROCEDURE IF EXISTS bug27415_text_test|
|
||||
DROP PROCEDURE IF EXISTS bug27415_text_test2|
|
||||
CREATE PROCEDURE bug27415_text_test(entity_id_str_in text)
|
||||
BEGIN
|
||||
DECLARE str_remainder text;
|
||||
SET str_remainder = entity_id_str_in;
|
||||
select 'before substr', str_remainder;
|
||||
SET str_remainder = SUBSTRING(str_remainder, 3);
|
||||
select 'after substr', str_remainder;
|
||||
END|
|
||||
CREATE PROCEDURE bug27415_text_test2(entity_id_str_in text)
|
||||
BEGIN
|
||||
DECLARE str_remainder text;
|
||||
DECLARE str_remainder2 text;
|
||||
SET str_remainder2 = entity_id_str_in;
|
||||
select 'before substr', str_remainder2;
|
||||
SET str_remainder = SUBSTRING(str_remainder2, 3);
|
||||
select 'after substr', str_remainder;
|
||||
END|
|
||||
CALL bug27415_text_test('a,b,c')|
|
||||
before substr str_remainder
|
||||
before substr a,b,c
|
||||
after substr str_remainder
|
||||
after substr b,c
|
||||
CALL bug27415_text_test('a,b,c')|
|
||||
before substr str_remainder
|
||||
before substr a,b,c
|
||||
after substr str_remainder
|
||||
after substr b,c
|
||||
CALL bug27415_text_test2('a,b,c')|
|
||||
before substr str_remainder2
|
||||
before substr a,b,c
|
||||
after substr str_remainder
|
||||
after substr b,c
|
||||
CALL bug27415_text_test('a,b,c')|
|
||||
before substr str_remainder
|
||||
before substr a,b,c
|
||||
after substr str_remainder
|
||||
after substr b,c
|
||||
DROP PROCEDURE bug27415_text_test|
|
||||
DROP PROCEDURE bug27415_text_test2|
|
||||
|
|
|
@ -1367,4 +1367,48 @@ CALL p1();
|
|||
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
#
|
||||
# Bug #27415 Text Variables in stored procedures
|
||||
# If the SP varible was also referenced on the right side
|
||||
# the result was corrupted.
|
||||
#
|
||||
DELIMITER |;
|
||||
|
||||
--disable_warnings
|
||||
DROP PROCEDURE IF EXISTS bug27415_text_test|
|
||||
DROP PROCEDURE IF EXISTS bug27415_text_test2|
|
||||
--enable_warnings
|
||||
|
||||
CREATE PROCEDURE bug27415_text_test(entity_id_str_in text)
|
||||
BEGIN
|
||||
DECLARE str_remainder text;
|
||||
|
||||
SET str_remainder = entity_id_str_in;
|
||||
|
||||
select 'before substr', str_remainder;
|
||||
SET str_remainder = SUBSTRING(str_remainder, 3);
|
||||
select 'after substr', str_remainder;
|
||||
END|
|
||||
|
||||
CREATE PROCEDURE bug27415_text_test2(entity_id_str_in text)
|
||||
BEGIN
|
||||
DECLARE str_remainder text;
|
||||
DECLARE str_remainder2 text;
|
||||
|
||||
SET str_remainder2 = entity_id_str_in;
|
||||
select 'before substr', str_remainder2;
|
||||
SET str_remainder = SUBSTRING(str_remainder2, 3);
|
||||
select 'after substr', str_remainder;
|
||||
END|
|
||||
|
||||
CALL bug27415_text_test('a,b,c')|
|
||||
CALL bug27415_text_test('a,b,c')|
|
||||
CALL bug27415_text_test2('a,b,c')|
|
||||
CALL bug27415_text_test('a,b,c')|
|
||||
|
||||
DROP PROCEDURE bug27415_text_test|
|
||||
DROP PROCEDURE bug27415_text_test2|
|
||||
|
||||
DELIMITER ;|
|
||||
|
||||
# End of 5.0 tests.
|
||||
|
|
Loading…
Reference in a new issue