summaryrefslogtreecommitdiff
path: root/mysql-test/main/sp.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/sp.test')
-rw-r--r--mysql-test/main/sp.test35
1 files changed, 35 insertions, 0 deletions
diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test
index cfd6604acce..c4d85f63498 100644
--- a/mysql-test/main/sp.test
+++ b/mysql-test/main/sp.test
@@ -9869,6 +9869,41 @@ CALL foo( LAST_INSERT_ID() );
DROP PROCEDURE foo;
--echo #
+--echo # MDEV-15870 Using aggregate and window function in unexpected places can crash the server
+--echo #
+
+CREATE PROCEDURE p1 (a TEXT) BEGIN END;
+--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
+CALL p1(RANK() OVER (ORDER BY 1));
+--error ER_WRONG_PLACEMENT_OF_WINDOW_FUNCTION
+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;
+
+--echo #
--echo # Start of 10.3 tests
--echo #