summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorOleksandr Byelkin <sanja@mariadb.com>2022-08-10 14:19:15 +0200
committerOleksandr Byelkin <sanja@mariadb.com>2022-08-10 14:19:15 +0200
commit1c192843f2619f528aaf334d0346cf14976b3845 (patch)
tree76570a260ad1ffe19508b89cdfe0a70c4c86f59e /mysql-test
parent47d5cfc650688a0748d40df53a4752fa2892c303 (diff)
parent10ed52767d25f3f9b9f5eee4983a3dee612ed2c6 (diff)
downloadmariadb-git-1c192843f2619f528aaf334d0346cf14976b3845.tar.gz
Merge branch '10.9' into 10.10
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/lib/My/SafeProcess/safe_process.cc11
-rw-r--r--mysql-test/main/cte_recursive.result145
-rw-r--r--mysql-test/main/cte_recursive.test43
-rw-r--r--mysql-test/main/func_compress.result11
-rw-r--r--mysql-test/main/func_compress.test9
-rw-r--r--mysql-test/main/mysqltest.result2
-rwxr-xr-xmysql-test/mariadb-test-run.pl2
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test2
8 files changed, 213 insertions, 12 deletions
diff --git a/mysql-test/lib/My/SafeProcess/safe_process.cc b/mysql-test/lib/My/SafeProcess/safe_process.cc
index 4d0d1e2a3a0..dcf9491d2d6 100644
--- a/mysql-test/lib/My/SafeProcess/safe_process.cc
+++ b/mysql-test/lib/My/SafeProcess/safe_process.cc
@@ -140,13 +140,20 @@ void handle_core(pid_t pid __attribute__((unused))) {}
static int kill_child(bool was_killed)
{
int status= 0;
+ pid_t ret_pid= 0;
message("Killing child: %d", child_pid);
// Terminate whole process group
if (! was_killed)
- kill(-child_pid, SIGKILL);
+ {
+ kill(-child_pid, SIGTERM);
+ sleep(10); // will be interrupted by SIGCHLD
+ if (!(ret_pid= waitpid(child_pid, &status, WNOHANG)))
+ kill(-child_pid, SIGKILL);
+ }
- pid_t ret_pid= waitpid(child_pid, &status, 0);
+ if (!ret_pid)
+ ret_pid= waitpid(child_pid, &status, 0);
if (ret_pid == child_pid)
{
int exit_code= 1;
diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result
index bb01d0d69a2..b38b5a149a0 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -4972,8 +4972,153 @@ a
0
NULL
DROP TABLE t1;
+#
+# MDEV-12325 Unexpected data type and truncation when using CTE
+#
+CREATE TABLE t1
+(
+id INT, mid INT, name TEXT
+);
+INSERT INTO t1 VALUES (0,NULL,'Name'),(1,0,'Name1'),(2,0,'Name2'),(11,1,'Name11'),(12,1,'Name12');
+WITH RECURSIVE
+cteReports (level, id, mid, name) AS
+(
+SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL
+UNION ALL
+SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e
+INNER JOIN cteReports r ON e.mid = r.id
+)
+SELECT
+level, id, mid, name,
+(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname
+FROM cteReports ORDER BY level, mid;
+ERROR 22003: Out of range value for column 'mid' at row 2
+create table t2 as WITH RECURSIVE
+cteReports (level, id, mid, name) AS
+(
+SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL
+UNION ALL
+SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e
+INNER JOIN cteReports r ON e.mid = r.id
+)
+SELECT
+level, id, mid, name,
+(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname
+FROM cteReports ORDER BY level, mid;;
+ERROR 22003: Out of range value for column 'mid' at row 2
+create table t2 ignore as WITH RECURSIVE
+cteReports (level, id, mid, name) AS
+(
+SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL
+UNION ALL
+SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e
+INNER JOIN cteReports r ON e.mid = r.id
+)
+SELECT
+level, id, mid, name,
+(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname
+FROM cteReports ORDER BY level, mid;;
+Warnings:
+Warning 1264 Out of range value for column 'mid' at row 2
+Warning 1264 Out of range value for column 'mid' at row 3
+Warning 1264 Out of range value for column 'mid' at row 4
+Warning 1264 Out of range value for column 'mid' at row 5
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `level` int(1) DEFAULT NULL,
+ `id` int(11) DEFAULT NULL,
+ `mid` int(11) DEFAULT NULL,
+ `name` text DEFAULT NULL,
+ `mname` text DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+insert into t2 WITH RECURSIVE
+cteReports (level, id, mid, name) AS
+(
+SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL
+UNION ALL
+SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e
+INNER JOIN cteReports r ON e.mid = r.id
+)
+SELECT
+level, id, mid, name,
+(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname
+FROM cteReports ORDER BY level, mid;;
+ERROR 22003: Out of range value for column 'mid' at row 2
+insert ignore into t2 WITH RECURSIVE
+cteReports (level, id, mid, name) AS
+(
+SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL
+UNION ALL
+SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e
+INNER JOIN cteReports r ON e.mid = r.id
+)
+SELECT
+level, id, mid, name,
+(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname
+FROM cteReports ORDER BY level, mid;;
+Warnings:
+Warning 1264 Out of range value for column 'mid' at row 2
+Warning 1264 Out of range value for column 'mid' at row 3
+Warning 1264 Out of range value for column 'mid' at row 4
+Warning 1264 Out of range value for column 'mid' at row 5
+drop table t2;
+set @@sql_mode="";
+WITH RECURSIVE
+cteReports (level, id, mid, name) AS
+(
+SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL
+UNION ALL
+SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e
+INNER JOIN cteReports r ON e.mid = r.id
+)
+SELECT
+level, id, mid, name,
+(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname
+FROM cteReports ORDER BY level, mid;
+level id mid name mname
+1 0 NULL Name NULL
+2 1 2147483647 Name1 NULL
+2 2 2147483647 Name2 NULL
+3 11 2147483647 Name11 NULL
+3 12 2147483647 Name12 NULL
+Warnings:
+Warning 1264 Out of range value for column 'mid' at row 2
+Warning 1264 Out of range value for column 'mid' at row 3
+Warning 1264 Out of range value for column 'mid' at row 4
+Warning 1264 Out of range value for column 'mid' at row 5
+create table t2 as WITH RECURSIVE
+cteReports (level, id, mid, name) AS
+(
+SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL
+UNION ALL
+SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e
+INNER JOIN cteReports r ON e.mid = r.id
+)
+SELECT
+level, id, mid, name,
+(SELECT name FROM t1 WHERE id= cteReports.mid) AS mname
+FROM cteReports ORDER BY level, mid;;
+Warnings:
+Warning 1264 Out of range value for column 'mid' at row 2
+Warning 1264 Out of range value for column 'mid' at row 3
+Warning 1264 Out of range value for column 'mid' at row 4
+Warning 1264 Out of range value for column 'mid' at row 5
+show create table t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `level` int(1) DEFAULT NULL,
+ `id` int(11) DEFAULT NULL,
+ `mid` int(11) DEFAULT NULL,
+ `name` text DEFAULT NULL,
+ `mname` text DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+set @@sql_mode=default;
+drop table t1,t2;
+#
# End of 10.3 tests
#
+#
# MDEV-26108: Recursive CTE embedded into another CTE which is used twice
#
create table t1 (a int);
diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test
index 5964c32061b..5afd445ead0 100644
--- a/mysql-test/main/cte_recursive.test
+++ b/mysql-test/main/cte_recursive.test
@@ -3168,7 +3168,50 @@ SELECT * FROM cte;
DROP TABLE t1;
+--echo #
+--echo # MDEV-12325 Unexpected data type and truncation when using CTE
+--echo #
+
+CREATE TABLE t1
+(
+ id INT, mid INT, name TEXT
+);
+INSERT INTO t1 VALUES (0,NULL,'Name'),(1,0,'Name1'),(2,0,'Name2'),(11,1,'Name11'),(12,1,'Name12');
+
+let $query=
+WITH RECURSIVE
+cteReports (level, id, mid, name) AS
+(
+ SELECT 1, id, mid, name FROM t1 WHERE mid IS NULL
+ UNION ALL
+ SELECT r.level + 1, e.id, e.mid + 1000000000000, e.name FROM t1 e
+ INNER JOIN cteReports r ON e.mid = r.id
+)
+SELECT
+ level, id, mid, name,
+ (SELECT name FROM t1 WHERE id= cteReports.mid) AS mname
+FROM cteReports ORDER BY level, mid;
+
+--error ER_WARN_DATA_OUT_OF_RANGE
+--eval $query
+--error ER_WARN_DATA_OUT_OF_RANGE
+--eval create table t2 as $query;
+--eval create table t2 ignore as $query;
+show create table t2;
+--error ER_WARN_DATA_OUT_OF_RANGE
+--eval insert into t2 $query;
+--eval insert ignore into t2 $query;
+drop table t2;
+set @@sql_mode="";
+--eval $query
+--eval create table t2 as $query;
+show create table t2;
+set @@sql_mode=default;
+drop table t1,t2;
+
+--echo #
--echo # End of 10.3 tests
+--echo #
--echo #
--echo # MDEV-26108: Recursive CTE embedded into another CTE which is used twice
diff --git a/mysql-test/main/func_compress.result b/mysql-test/main/func_compress.result
index 065b68b4979..dde7080fb2a 100644
--- a/mysql-test/main/func_compress.result
+++ b/mysql-test/main/func_compress.result
@@ -193,9 +193,6 @@ DROP TABLE t1;
# End of 10.1 tests
#
#
-# Start of 10.2 tests
-#
-#
# MDEV-10134 Add full support for DEFAULT
#
CREATE TABLE t1 (a TEXT, b BLOB DEFAULT COMPRESS(a), bl INT DEFAULT UNCOMPRESSED_LENGTH(b), a1 TEXT DEFAULT UNCOMPRESS(b));
@@ -213,5 +210,13 @@ bl a1
100 aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
DROP TABLE t1;
#
+# MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn
+#
+select 'foo' in (cast(compress('bar') as char(4)), 'qux');
+'foo' in (cast(compress('bar') as char(4)), 'qux')
+0
+Warnings:
+Warning 1292 Truncated incorrect CHAR(4) value: '\x03\x00\x00\x00x\x9CKJ,\x02\x00\x02]\x016'
+#
# End of 10.2 tests
#
diff --git a/mysql-test/main/func_compress.test b/mysql-test/main/func_compress.test
index 983b792f4c4..2a6c0276705 100644
--- a/mysql-test/main/func_compress.test
+++ b/mysql-test/main/func_compress.test
@@ -174,10 +174,6 @@ DROP TABLE t1;
--echo #
--echo #
---echo # Start of 10.2 tests
---echo #
-
---echo #
--echo # MDEV-10134 Add full support for DEFAULT
--echo #
CREATE TABLE t1 (a TEXT, b BLOB DEFAULT COMPRESS(a), bl INT DEFAULT UNCOMPRESSED_LENGTH(b), a1 TEXT DEFAULT UNCOMPRESS(b));
@@ -187,5 +183,10 @@ SELECT bl, a1 FROM t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-23149 Server crashes in my_convert / ErrConvString::ptr / Item_char_typecast::check_truncation_with_warn
+--echo #
+select 'foo' in (cast(compress('bar') as char(4)), 'qux');
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/mysqltest.result b/mysql-test/main/mysqltest.result
index c8fe81c4d77..73f2c8851f9 100644
--- a/mysql-test/main/mysqltest.result
+++ b/mysql-test/main/mysqltest.result
@@ -500,7 +500,7 @@ anything goes
0 != string
mysqltest: At line 2: Only == and != are supported for string values
mysqltest: At line 2: Found junk '~= 6' after $variable in condition
-mysqltest: At line 2: Expression in if/while must beging with $, ` or a number
+mysqltest: At line 2: Expression in if/while must begin with $, ` or a number
mysqltest: At line 1: Missing right operand in comparison
mysqltest: At line 1: Missing right operand in comparison
counter is 2
diff --git a/mysql-test/mariadb-test-run.pl b/mysql-test/mariadb-test-run.pl
index f5f99e911e5..16f4164061e 100755
--- a/mysql-test/mariadb-test-run.pl
+++ b/mysql-test/mariadb-test-run.pl
@@ -4638,7 +4638,7 @@ sub check_warnings ($) {
$tinfo->{comment}.=
"Could not execute 'check-warnings' for ".
"testcase '$tname' (res: $res) server: '".
- $mysqld->name() .":\n";
+ $mysqld->name() ."':\n";
$tinfo->{comment}.= $report;
$result= 2;
diff --git a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test
index 9cff94ed5bc..b1b2f9fdda9 100644
--- a/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test
+++ b/mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test
@@ -43,7 +43,7 @@ let $counter= 80;
let $mysql_errno= 0;
while (!$mysql_errno)
{
- --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013
+ --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,2002,2006,2013,5014
show status;
dec $counter;