Skip to content

Commit

Permalink
MDEV-26684: Unexpected ROW_NUMBER in a condition raised by a diagnostics
Browse files Browse the repository at this point in the history
statement

Not repeatable after MDEV-26606. Test case added.
  • Loading branch information
mariadb-RuchaDeodhar committed Oct 6, 2021
1 parent 479e303 commit af95c99
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
30 changes: 30 additions & 0 deletions mysql-test/main/get_diagnostics.result
Expand Up @@ -1608,3 +1608,33 @@ SELECT @var1;
2
DROP TABLE t1;
DROP PROCEDURE sp;
#
# MDEV-26684: Unexpected ROW_NUMBER in a condition raised by a diagnostics statement
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES (1),(2);
GET DIAGNOSTICS CONDITION 5 @msg = MESSAGE_TEXT;
Warnings:
Error 1758 Invalid condition number
SHOW WARNINGS;
Level Code Message
Error 1758 Invalid condition number
GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
SELECT @ind, @msg;
@ind @msg
0 Invalid condition number
INSERT INTO t1 VALUES (3),(4);
GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
Warnings:
Error 1758 Invalid condition number
SELECT @ind, @msg;
@ind @msg
0 Invalid condition number
GET DIAGNOSTICS CONDITION 5 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
Warnings:
Error 1758 Invalid condition number
Error 1758 Invalid condition number
SELECT @ind, @msg;
@ind @msg
0 Invalid condition number
DROP TABLE t1;
24 changes: 24 additions & 0 deletions mysql-test/main/get_diagnostics.test
Expand Up @@ -1496,3 +1496,27 @@ SELECT @var1;

DROP TABLE t1;
DROP PROCEDURE sp;

--echo #
--echo # MDEV-26684: Unexpected ROW_NUMBER in a condition raised by a diagnostics statement
--echo #

CREATE TABLE t1 (a INT);

INSERT INTO t1 VALUES (1),(2);

GET DIAGNOSTICS CONDITION 5 @msg = MESSAGE_TEXT;
SHOW WARNINGS;

GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
SELECT @ind, @msg;

INSERT INTO t1 VALUES (3),(4);

GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
SELECT @ind, @msg;

GET DIAGNOSTICS CONDITION 5 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
SELECT @ind, @msg;

DROP TABLE t1;

0 comments on commit af95c99

Please sign in to comment.