summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
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/func_json.result4
-rw-r--r--mysql-test/main/func_json.test2
-rw-r--r--mysql-test/main/mysqltest.result2
-rwxr-xr-xmysql-test/mysql-test-run.pl2
-rw-r--r--mysql-test/suite/sys_vars/t/innodb_fatal_semaphore_wait_threshold.test2
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 24dff8967a5..3e5ca178b41 100644
--- a/mysql-test/main/cte_recursive.result
+++ b/mysql-test/main/cte_recursive.result
@@ -4872,8 +4872,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/func_json.result b/mysql-test/main/func_json.result
index d072b9f59ad..079b3add1a8 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 db474e38a2c..07860766294 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 39c01331b9e..dfe8c20a8ee 100755
--- a/mysql-test/mysql-test-run.pl
+++ b/mysql-test/mysql-test-run.pl
@@ -4613,7 +4613,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;