diff options
author | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 12:21:08 +0200 |
---|---|---|
committer | Oleksandr Byelkin <sanja@mariadb.com> | 2022-08-10 12:21:08 +0200 |
commit | 65e8506ca9d03967191b6ed207cf107d311f7f99 (patch) | |
tree | 3076ff798884b52655a5961be21e799708a4b628 /mysql-test | |
parent | 6adfce9c8d2a63a259dd0504600271498dcda228 (diff) | |
parent | faddcf3c395da640b760c3f701f5bc1f3baae6c4 (diff) | |
download | mariadb-git-65e8506ca9d03967191b6ed207cf107d311f7f99.tar.gz |
Merge branch '10.3' into bb-10.4-releasemariadb-10.4.26
Diffstat (limited to 'mysql-test')
-rw-r--r-- | mysql-test/lib/My/SafeProcess/safe_process.cc | 11 | ||||
-rw-r--r-- | mysql-test/main/cte_recursive.result | 145 | ||||
-rw-r--r-- | mysql-test/main/cte_recursive.test | 43 | ||||
-rw-r--r-- | mysql-test/main/func_compress.result | 11 | ||||
-rw-r--r-- | mysql-test/main/func_compress.test | 9 | ||||
-rw-r--r-- | mysql-test/main/func_json.result | 4 | ||||
-rw-r--r-- | mysql-test/main/func_json.test | 2 | ||||
-rw-r--r-- | mysql-test/main/mysqltest.result | 2 | ||||
-rwxr-xr-x | mysql-test/mysql-test-run.pl | 2 | ||||
-rw-r--r-- | mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test | 2 |
10 files changed, 216 insertions, 15 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 1eba49b6c29..cb20702b807 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -4873,8 +4873,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 8ac6f841f6e..45eb8918ae3 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -3165,7 +3165,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/func_json.result b/mysql-test/main/func_json.result index b31aed1fe01..a25c0514382 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -765,8 +765,8 @@ DROP TABLE t1; # # MDEV-16054 simple json functions flatline cpu on garbage input. # -select json_array(1,uuid(),compress(5.140264e+307)); -json_array(1,uuid(),compress(5.140264e+307)) +select json_array(1,user(),compress(5.140264e+307)); +json_array(1,user(),compress(5.140264e+307)) NULL # # MDEV-16869 String functions don't respect character set of JSON_VALUE. diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index b710bafc82a..db6a8553073 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -429,7 +429,7 @@ DROP TABLE t1; --echo # MDEV-16054 simple json functions flatline cpu on garbage input. --echo # -select json_array(1,uuid(),compress(5.140264e+307)); +select json_array(1,user(),compress(5.140264e+307)); --echo # --echo # MDEV-16869 String functions don't respect character set of JSON_VALUE. diff --git a/mysql-test/main/mysqltest.result b/mysql-test/main/mysqltest.result index fe269152357..d4309ffe97e 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/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index c37eab68cdd..c2c4332db56 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -4579,7 +4579,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 4563e9b4469..6f67d7292dc 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 @@ -82,7 +82,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; |