summaryrefslogtreecommitdiff
path: root/mysql-test/main/insert_select.test
diff options
context:
space:
mode:
Diffstat (limited to 'mysql-test/main/insert_select.test')
-rw-r--r--mysql-test/main/insert_select.test54
1 files changed, 54 insertions, 0 deletions
diff --git a/mysql-test/main/insert_select.test b/mysql-test/main/insert_select.test
index 91b2cc6f981..1f672acc203 100644
--- a/mysql-test/main/insert_select.test
+++ b/mysql-test/main/insert_select.test
@@ -459,4 +459,58 @@ INSERT INTO t1 SELECT a*2 FROM t1 ORDER BY a;
DROP TABLE t1;
+#
+# MDEV-26427 MariaDB Server SEGV on INSERT .. SELECT
+#
+CREATE TABLE t1 (a INT, b INT);
+INSERT INTO t1 (a) SELECT SUM(1);
+INSERT INTO t1 (a, b) SELECT AVG(2), MIN(3);
+
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t1 (b) SELECT AVG('x') OVER ();
+INSERT INTO t1 SELECT MIN(7) OVER (), MAX(8) OVER();
+SELECT * FROM t1;
+
+PREPARE stmt FROM 'INSERT INTO t1 (a) SELECT AVG(?)';
+EXECUTE stmt USING 9;
+EXECUTE stmt USING 10;
+
+PREPARE stmt FROM 'INSERT INTO t1 SELECT MIN(?), MAX(?)';
+EXECUTE stmt USING 11, 12;
+EXECUTE stmt USING 13, 14;
+DEALLOCATE PREPARE stmt;
+SELECT * FROM t1;
+
+DELIMITER //;
+CREATE PROCEDURE p1(param_a INT, param_b INT)
+BEGIN
+INSERT INTO t1 SELECT MIN(param_a) OVER (), MAX(param_b);
+END//
+DELIMITER ;//
+CALL p1(21, 22);
+CALL p1(23, 24);
+SELECT * FROM t1;
+
+CREATE TABLE t2 (
+ a DECIMAL UNIQUE CHECK (CASE 0 * 27302337.000000 WHEN 34 THEN
+ + 'x' LIKE 'x' OR a NOT IN (-1 / TRUE ^ 2) ELSE 7105743.000000 END));
+INSERT INTO t2 VALUES (90),( -1),(31152443.000000),(-32768),(NULL),(NULL);
+--error ER_TRUNCATED_WRONG_VALUE
+INSERT INTO t2 SELECT AVG('x') OVER (
+ PARTITION BY ((NOT AVG(76698761.000000))) IS NOT NULL);
+INSERT IGNORE INTO t2 () VALUES (0),('x'),(3751286.000000),
+ ('x'),((a = 'x' AND 0 AND 0));
+INSERT INTO t2 VALUES (127);
+--error ER_DUP_ENTRY
+INSERT INTO t2 SELECT -2147483648 END FROM t2 AS TEXT JOIN t2 JOIN t2 TABLES;
+--error ER_TRUNCATED_WRONG_VALUE
+ALTER TABLE t2 ADD (
+ b INT UNIQUE CHECK ((a = 'x' AND ((-(+(BINARY 49730460.000000)))) = 'x'
+ BETWEEN 'x' AND 'x')));
+--error ER_DUP_ENTRY
+UPDATE t2 SET a = -128 WHERE a IS NULL ORDER BY 78 IN ('x','x'),a;
+
+DROP TABLE t1, t2;
+DROP PROCEDURE p1;
+
--echo # End of 10.2 test