Skip to content

Commit af95c99

Browse files
MDEV-26684: Unexpected ROW_NUMBER in a condition raised by a diagnostics
statement Not repeatable after MDEV-26606. Test case added.
1 parent 479e303 commit af95c99

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

mysql-test/main/get_diagnostics.result

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,3 +1608,33 @@ SELECT @var1;
16081608
2
16091609
DROP TABLE t1;
16101610
DROP PROCEDURE sp;
1611+
#
1612+
# MDEV-26684: Unexpected ROW_NUMBER in a condition raised by a diagnostics statement
1613+
#
1614+
CREATE TABLE t1 (a INT);
1615+
INSERT INTO t1 VALUES (1),(2);
1616+
GET DIAGNOSTICS CONDITION 5 @msg = MESSAGE_TEXT;
1617+
Warnings:
1618+
Error 1758 Invalid condition number
1619+
SHOW WARNINGS;
1620+
Level Code Message
1621+
Error 1758 Invalid condition number
1622+
GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
1623+
SELECT @ind, @msg;
1624+
@ind @msg
1625+
0 Invalid condition number
1626+
INSERT INTO t1 VALUES (3),(4);
1627+
GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
1628+
Warnings:
1629+
Error 1758 Invalid condition number
1630+
SELECT @ind, @msg;
1631+
@ind @msg
1632+
0 Invalid condition number
1633+
GET DIAGNOSTICS CONDITION 5 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
1634+
Warnings:
1635+
Error 1758 Invalid condition number
1636+
Error 1758 Invalid condition number
1637+
SELECT @ind, @msg;
1638+
@ind @msg
1639+
0 Invalid condition number
1640+
DROP TABLE t1;

mysql-test/main/get_diagnostics.test

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1496,3 +1496,27 @@ SELECT @var1;
14961496

14971497
DROP TABLE t1;
14981498
DROP PROCEDURE sp;
1499+
1500+
--echo #
1501+
--echo # MDEV-26684: Unexpected ROW_NUMBER in a condition raised by a diagnostics statement
1502+
--echo #
1503+
1504+
CREATE TABLE t1 (a INT);
1505+
1506+
INSERT INTO t1 VALUES (1),(2);
1507+
1508+
GET DIAGNOSTICS CONDITION 5 @msg = MESSAGE_TEXT;
1509+
SHOW WARNINGS;
1510+
1511+
GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
1512+
SELECT @ind, @msg;
1513+
1514+
INSERT INTO t1 VALUES (3),(4);
1515+
1516+
GET DIAGNOSTICS CONDITION 1 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
1517+
SELECT @ind, @msg;
1518+
1519+
GET DIAGNOSTICS CONDITION 5 @ind = ROW_NUMBER, @msg = MESSAGE_TEXT;
1520+
SELECT @ind, @msg;
1521+
1522+
DROP TABLE t1;

0 commit comments

Comments
 (0)