summaryrefslogtreecommitdiff
path: root/mysql-test/t/sp.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/t/sp.test')
-rw-r--r--mysql-test/t/sp.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/sp.test b/mysql-test/t/sp.test
index e8b63c4d791..a2155d3fe79 100644
--- a/mysql-test/t/sp.test
+++ b/mysql-test/t/sp.test
@@ -9879,3 +9879,25 @@ CALL p1(ROW_NUMBER() OVER ());
--error ER_INVALID_GROUP_FUNC_USE
CALL p1(SUM(1));
DROP PROCEDURE p1;
+
+
+--echo #
+--echo # MDEV-16311 Server crash when using a NAME_CONST() with a CURSOR
+--echo #
+
+SET sql_mode=STRICT_ALL_TABLES;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (10);
+DELIMITER $$;
+--error ER_TRUNCATED_WRONG_VALUE_FOR_FIELD
+BEGIN NOT ATOMIC
+ DECLARE a INT;
+ DECLARE c CURSOR FOR SELECT NAME_CONST('x','y') FROM t1;
+ OPEN c;
+ FETCH c INTO a;
+ CLOSE c;
+END;
+$$
+DELIMITER ;$$
+DROP TABLE t1;
+SET sql_mode=DEFAULT;