summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/violite.h3
-rw-r--r--mysql-test/include/ctype_numconv.inc4
-rw-r--r--mysql-test/main/ctype_binary.result10
-rw-r--r--mysql-test/main/ctype_cp1251.result10
-rw-r--r--mysql-test/main/ctype_filename.result7
-rw-r--r--mysql-test/main/ctype_filename.test10
-rw-r--r--mysql-test/main/ctype_latin1.result10
-rw-r--r--mysql-test/main/ctype_ucs.result10
-rw-r--r--mysql-test/main/ctype_utf8.result10
-rw-r--r--mysql-test/main/func_math.result240
-rw-r--r--mysql-test/main/func_str.result2
-rw-r--r--mysql-test/main/grant.result18
-rw-r--r--mysql-test/main/grant.test25
-rw-r--r--mysql-test/main/information_schema.result15
-rw-r--r--mysql-test/main/information_schema.test14
-rw-r--r--mysql-test/main/mysql_tzinfo_to_sql_symlink.result18
-rw-r--r--mysql-test/main/mysqld--help,win.rdiff14
-rw-r--r--mysql-test/main/mysqld--help.result4
-rw-r--r--mysql-test/main/mysqld--help.test4
-rw-r--r--mysql-test/main/parser.result7
-rw-r--r--mysql-test/main/parser.test9
-rw-r--r--mysql-test/main/subselect4.result66
-rw-r--r--mysql-test/main/subselect4.test48
-rw-r--r--mysql-test/main/type_date.result30
-rw-r--r--mysql-test/main/type_date.test22
-rw-r--r--mysql-test/main/type_float.result170
-rw-r--r--mysql-test/main/type_float.test20
-rw-r--r--mysql-test/main/type_newdecimal.result367
-rw-r--r--mysql-test/main/type_newdecimal.test93
-rw-r--r--mysql-test/main/win.result16
-rw-r--r--mysql-test/main/win.test16
-rw-r--r--mysql-test/suite/galera/disabled.def1
-rw-r--r--mysql-test/suite/galera/r/galera_bf_lock_wait.result29
-rw-r--r--mysql-test/suite/galera/t/galera_bf_lock_wait.test47
-rw-r--r--mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result3
-rw-r--r--mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test16
-rw-r--r--mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result18
-rw-r--r--sql/item_func.cc55
-rw-r--r--sql/item_func.h3
-rw-r--r--sql/item_strfunc.cc32
-rw-r--r--sql/item_subselect.h4
-rw-r--r--sql/records.cc20
-rw-r--r--sql/records.h1
-rw-r--r--sql/share/errmsg-utf8.txt38
-rw-r--r--sql/sql_lex.cc11
-rw-r--r--sql/sql_select.cc53
-rw-r--r--sql/sql_select.h2
-rw-r--r--sql/sql_show.cc6
-rw-r--r--sql/sql_string.cc11
-rw-r--r--sql/sql_string.h6
-rw-r--r--sql/sql_type.cc29
-rw-r--r--sql/sql_type.h7
-rw-r--r--sql/sql_union.cc22
-rw-r--r--sql/table.h13
-rw-r--r--sql/tztime.cc19
-rw-r--r--storage/innobase/fil/fil0crypt.cc122
-rw-r--r--storage/innobase/fil/fil0fil.cc114
-rw-r--r--storage/innobase/include/fil0fil.h54
-rw-r--r--storage/innobase/include/sync0types.h1
-rw-r--r--storage/innobase/lock/lock0lock.cc22
-rw-r--r--storage/innobase/sync/sync0debug.cc2
-rw-r--r--strings/decimal.c18
-rw-r--r--vio/vio.c1
-rw-r--r--vio/viopipe.c16
64 files changed, 1622 insertions, 466 deletions
diff --git a/include/violite.h b/include/violite.h
index fa154ac28b8..28e3ca08b0a 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates.
- Copyright (c) 2012, 2017, MariaDB Corporation.
+ Copyright (c) 2012, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -278,6 +278,7 @@ struct st_vio
#ifdef _WIN32
HANDLE hPipe;
OVERLAPPED overlapped;
+ int shutdown_flag;
#endif
};
#endif /* vio_violite_h_ */
diff --git a/mysql-test/include/ctype_numconv.inc b/mysql-test/include/ctype_numconv.inc
index 07298b1d47b..889c80cc477 100644
--- a/mysql-test/include/ctype_numconv.inc
+++ b/mysql-test/include/ctype_numconv.inc
@@ -194,12 +194,12 @@ show create table t1;
drop table t1;
select hex(concat(ceiling(0.5)));
-create table t1 as select concat(ceiling(0.5)) as c1;
+create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
drop table t1;
select hex(concat(floor(0.5)));
-create table t1 as select concat(floor(0.5)) as c1;
+create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
drop table t1;
diff --git a/mysql-test/main/ctype_binary.result b/mysql-test/main/ctype_binary.result
index c0bbb8ff4ff..05f31f13dc7 100644
--- a/mysql-test/main/ctype_binary.result
+++ b/mysql-test/main/ctype_binary.result
@@ -345,21 +345,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
31
-create table t1 as select concat(ceiling(0.5)) as c1;
+create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
30
-create table t1 as select concat(floor(0.5)) as c1;
+create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varbinary(4) DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
diff --git a/mysql-test/main/ctype_cp1251.result b/mysql-test/main/ctype_cp1251.result
index 9f11301f63b..7d9b47f1f54 100644
--- a/mysql-test/main/ctype_cp1251.result
+++ b/mysql-test/main/ctype_cp1251.result
@@ -757,21 +757,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
31
-create table t1 as select concat(ceiling(0.5)) as c1;
+create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
30
-create table t1 as select concat(floor(0.5)) as c1;
+create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
diff --git a/mysql-test/main/ctype_filename.result b/mysql-test/main/ctype_filename.result
index 1064ef95cae..2eee5d2888e 100644
--- a/mysql-test/main/ctype_filename.result
+++ b/mysql-test/main/ctype_filename.result
@@ -22,6 +22,13 @@ SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a
@a BINARY @a REVERSE(@a) HEX(@a) HEX(REVERSE(@a))
aя a@r1 яa 61407231 40723161
#
+# MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug builds
+#
+SET CHARACTER_SET_CLIENT=17;
+SELECT doc.`Children`.0 FROM t1;
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?Children??0?FROM?t1' at line 1
+SET NAMES latin1;
+#
# Start of 10.5 tests
#
#
diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test
index 940be6a7c24..17ab71e3985 100644
--- a/mysql-test/main/ctype_filename.test
+++ b/mysql-test/main/ctype_filename.test
@@ -30,6 +30,16 @@ SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a
--echo #
+--echo # MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug builds
+--echo #
+
+SET CHARACTER_SET_CLIENT=17;
+--error ER_PARSE_ERROR
+SELECT doc.`Children`.0 FROM t1;
+SET NAMES latin1;
+
+
+--echo #
--echo # Start of 10.5 tests
--echo #
diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result
index 263afe4f584..68870bbeea8 100644
--- a/mysql-test/main/ctype_latin1.result
+++ b/mysql-test/main/ctype_latin1.result
@@ -1066,21 +1066,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
31
-create table t1 as select concat(ceiling(0.5)) as c1;
+create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
30
-create table t1 as select concat(floor(0.5)) as c1;
+create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result
index 48b866b64f5..dc3ed0cf7a9 100644
--- a/mysql-test/main/ctype_ucs.result
+++ b/mysql-test/main/ctype_ucs.result
@@ -1950,21 +1950,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
0031
-create table t1 as select concat(ceiling(0.5)) as c1;
+create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
0030
-create table t1 as select concat(floor(0.5)) as c1;
+create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result
index bc951600319..419f64d1489 100644
--- a/mysql-test/main/ctype_utf8.result
+++ b/mysql-test/main/ctype_utf8.result
@@ -2817,21 +2817,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
31
-create table t1 as select concat(ceiling(0.5)) as c1;
+create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
30
-create table t1 as select concat(floor(0.5)) as c1;
+create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
+ `c0` int(3) NOT NULL,
+ `c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result
index 460157df263..5da1ab02159 100644
--- a/mysql-test/main/func_math.result
+++ b/mysql-test/main/func_math.result
@@ -1080,7 +1080,7 @@ Create Table CREATE TABLE `t2` (
`a` decimal(38,0) DEFAULT NULL,
`b` decimal(38,0) unsigned DEFAULT NULL,
`fa` decimal(38,0) DEFAULT NULL,
- `fb` decimal(38,0) DEFAULT NULL
+ `fb` decimal(38,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999999999999999999
b 99999999999999999999999999999999999999
@@ -1090,8 +1090,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,1) DEFAULT NULL,
`b` decimal(38,1) unsigned DEFAULT NULL,
- `fa` decimal(37,0) DEFAULT NULL,
- `fb` decimal(37,0) DEFAULT NULL
+ `fa` decimal(38,0) DEFAULT NULL,
+ `fb` decimal(37,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999999999999999999.9
b 9999999999999999999999999999999999999.9
@@ -1101,8 +1101,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,2) DEFAULT NULL,
`b` decimal(38,2) unsigned DEFAULT NULL,
- `fa` decimal(36,0) DEFAULT NULL,
- `fb` decimal(36,0) DEFAULT NULL
+ `fa` decimal(37,0) DEFAULT NULL,
+ `fb` decimal(36,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999999999999999999.99
b 999999999999999999999999999999999999.99
@@ -1112,8 +1112,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,3) DEFAULT NULL,
`b` decimal(38,3) unsigned DEFAULT NULL,
- `fa` decimal(35,0) DEFAULT NULL,
- `fb` decimal(35,0) DEFAULT NULL
+ `fa` decimal(36,0) DEFAULT NULL,
+ `fb` decimal(35,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999999999999999.999
b 99999999999999999999999999999999999.999
@@ -1123,8 +1123,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,4) DEFAULT NULL,
`b` decimal(38,4) unsigned DEFAULT NULL,
- `fa` decimal(34,0) DEFAULT NULL,
- `fb` decimal(34,0) DEFAULT NULL
+ `fa` decimal(35,0) DEFAULT NULL,
+ `fb` decimal(34,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999999999999999.9999
b 9999999999999999999999999999999999.9999
@@ -1134,8 +1134,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,5) DEFAULT NULL,
`b` decimal(38,5) unsigned DEFAULT NULL,
- `fa` decimal(33,0) DEFAULT NULL,
- `fb` decimal(33,0) DEFAULT NULL
+ `fa` decimal(34,0) DEFAULT NULL,
+ `fb` decimal(33,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999999999999999.99999
b 999999999999999999999999999999999.99999
@@ -1145,8 +1145,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,6) DEFAULT NULL,
`b` decimal(38,6) unsigned DEFAULT NULL,
- `fa` decimal(32,0) DEFAULT NULL,
- `fb` decimal(32,0) DEFAULT NULL
+ `fa` decimal(33,0) DEFAULT NULL,
+ `fb` decimal(32,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999999999999.999999
b 99999999999999999999999999999999.999999
@@ -1156,8 +1156,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,7) DEFAULT NULL,
`b` decimal(38,7) unsigned DEFAULT NULL,
- `fa` decimal(31,0) DEFAULT NULL,
- `fb` decimal(31,0) DEFAULT NULL
+ `fa` decimal(32,0) DEFAULT NULL,
+ `fb` decimal(31,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999999999999.9999999
b 9999999999999999999999999999999.9999999
@@ -1167,8 +1167,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,8) DEFAULT NULL,
`b` decimal(38,8) unsigned DEFAULT NULL,
- `fa` decimal(30,0) DEFAULT NULL,
- `fb` decimal(30,0) DEFAULT NULL
+ `fa` decimal(31,0) DEFAULT NULL,
+ `fb` decimal(30,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999999999999.99999999
b 999999999999999999999999999999.99999999
@@ -1178,8 +1178,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,9) DEFAULT NULL,
`b` decimal(38,9) unsigned DEFAULT NULL,
- `fa` decimal(29,0) DEFAULT NULL,
- `fb` decimal(29,0) DEFAULT NULL
+ `fa` decimal(30,0) DEFAULT NULL,
+ `fb` decimal(29,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999999999.999999999
b 99999999999999999999999999999.999999999
@@ -1189,8 +1189,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,10) DEFAULT NULL,
`b` decimal(38,10) unsigned DEFAULT NULL,
- `fa` decimal(28,0) DEFAULT NULL,
- `fb` decimal(28,0) DEFAULT NULL
+ `fa` decimal(29,0) DEFAULT NULL,
+ `fb` decimal(28,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999999999.9999999999
b 9999999999999999999999999999.9999999999
@@ -1200,8 +1200,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,11) DEFAULT NULL,
`b` decimal(38,11) unsigned DEFAULT NULL,
- `fa` decimal(27,0) DEFAULT NULL,
- `fb` decimal(27,0) DEFAULT NULL
+ `fa` decimal(28,0) DEFAULT NULL,
+ `fb` decimal(27,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999999999.99999999999
b 999999999999999999999999999.99999999999
@@ -1211,8 +1211,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,12) DEFAULT NULL,
`b` decimal(38,12) unsigned DEFAULT NULL,
- `fa` decimal(26,0) DEFAULT NULL,
- `fb` decimal(26,0) DEFAULT NULL
+ `fa` decimal(27,0) DEFAULT NULL,
+ `fb` decimal(26,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999999.999999999999
b 99999999999999999999999999.999999999999
@@ -1222,8 +1222,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,13) DEFAULT NULL,
`b` decimal(38,13) unsigned DEFAULT NULL,
- `fa` decimal(25,0) DEFAULT NULL,
- `fb` decimal(25,0) DEFAULT NULL
+ `fa` decimal(26,0) DEFAULT NULL,
+ `fb` decimal(25,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999999.9999999999999
b 9999999999999999999999999.9999999999999
@@ -1233,8 +1233,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,14) DEFAULT NULL,
`b` decimal(38,14) unsigned DEFAULT NULL,
- `fa` decimal(24,0) DEFAULT NULL,
- `fb` decimal(24,0) DEFAULT NULL
+ `fa` decimal(25,0) DEFAULT NULL,
+ `fb` decimal(24,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999999.99999999999999
b 999999999999999999999999.99999999999999
@@ -1244,8 +1244,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,15) DEFAULT NULL,
`b` decimal(38,15) unsigned DEFAULT NULL,
- `fa` decimal(23,0) DEFAULT NULL,
- `fb` decimal(23,0) DEFAULT NULL
+ `fa` decimal(24,0) DEFAULT NULL,
+ `fb` decimal(23,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999.999999999999999
b 99999999999999999999999.999999999999999
@@ -1255,8 +1255,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,16) DEFAULT NULL,
`b` decimal(38,16) unsigned DEFAULT NULL,
- `fa` decimal(22,0) DEFAULT NULL,
- `fb` decimal(22,0) DEFAULT NULL
+ `fa` decimal(23,0) DEFAULT NULL,
+ `fb` decimal(22,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999.9999999999999999
b 9999999999999999999999.9999999999999999
@@ -1266,8 +1266,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,17) DEFAULT NULL,
`b` decimal(38,17) unsigned DEFAULT NULL,
- `fa` decimal(21,0) DEFAULT NULL,
- `fb` decimal(21,0) DEFAULT NULL
+ `fa` decimal(22,0) DEFAULT NULL,
+ `fb` decimal(21,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999.99999999999999999
b 999999999999999999999.99999999999999999
@@ -1277,8 +1277,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,18) DEFAULT NULL,
`b` decimal(38,18) unsigned DEFAULT NULL,
- `fa` decimal(20,0) DEFAULT NULL,
- `fb` decimal(20,0) DEFAULT NULL
+ `fa` decimal(21,0) DEFAULT NULL,
+ `fb` decimal(20,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999.999999999999999999
b 99999999999999999999.999999999999999999
@@ -1288,8 +1288,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,19) DEFAULT NULL,
`b` decimal(38,19) unsigned DEFAULT NULL,
- `fa` decimal(19,0) DEFAULT NULL,
- `fb` decimal(19,0) DEFAULT NULL
+ `fa` decimal(20,0) DEFAULT NULL,
+ `fb` decimal(19,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999.9999999999999999999
b 9999999999999999999.9999999999999999999
@@ -1299,8 +1299,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,20) DEFAULT NULL,
`b` decimal(38,20) unsigned DEFAULT NULL,
- `fa` decimal(18,0) DEFAULT NULL,
- `fb` bigint(17) unsigned DEFAULT NULL
+ `fa` decimal(19,0) DEFAULT NULL,
+ `fb` bigint(18) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999.99999999999999999999
b 999999999999999999.99999999999999999999
@@ -1310,7 +1310,7 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,21) DEFAULT NULL,
`b` decimal(38,21) unsigned DEFAULT NULL,
- `fa` bigint(17) DEFAULT NULL,
+ `fa` bigint(19) DEFAULT NULL,
`fb` bigint(17) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999.999999999999999999999
@@ -1321,8 +1321,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,22) DEFAULT NULL,
`b` decimal(38,22) unsigned DEFAULT NULL,
- `fa` bigint(17) DEFAULT NULL,
- `fb` bigint(17) unsigned DEFAULT NULL
+ `fa` bigint(18) DEFAULT NULL,
+ `fb` bigint(16) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999.9999999999999999999999
b 9999999999999999.9999999999999999999999
@@ -1333,7 +1333,7 @@ Create Table CREATE TABLE `t2` (
`a` decimal(38,23) DEFAULT NULL,
`b` decimal(38,23) unsigned DEFAULT NULL,
`fa` bigint(17) DEFAULT NULL,
- `fb` bigint(17) unsigned DEFAULT NULL
+ `fb` bigint(15) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999.99999999999999999999999
b 999999999999999.99999999999999999999999
@@ -1343,8 +1343,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,24) DEFAULT NULL,
`b` decimal(38,24) unsigned DEFAULT NULL,
- `fa` bigint(17) DEFAULT NULL,
- `fb` bigint(16) unsigned DEFAULT NULL
+ `fa` bigint(16) DEFAULT NULL,
+ `fb` bigint(14) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999.999999999999999999999999
b 99999999999999.999999999999999999999999
@@ -1354,8 +1354,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,25) DEFAULT NULL,
`b` decimal(38,25) unsigned DEFAULT NULL,
- `fa` bigint(16) DEFAULT NULL,
- `fb` bigint(15) unsigned DEFAULT NULL
+ `fa` bigint(15) DEFAULT NULL,
+ `fb` bigint(13) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999.9999999999999999999999999
b 9999999999999.9999999999999999999999999
@@ -1365,8 +1365,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,26) DEFAULT NULL,
`b` decimal(38,26) unsigned DEFAULT NULL,
- `fa` bigint(15) DEFAULT NULL,
- `fb` bigint(14) unsigned DEFAULT NULL
+ `fa` bigint(14) DEFAULT NULL,
+ `fb` bigint(12) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999.99999999999999999999999999
b 999999999999.99999999999999999999999999
@@ -1376,8 +1376,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,27) DEFAULT NULL,
`b` decimal(38,27) unsigned DEFAULT NULL,
- `fa` bigint(14) DEFAULT NULL,
- `fb` bigint(13) unsigned DEFAULT NULL
+ `fa` bigint(13) DEFAULT NULL,
+ `fb` bigint(11) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999.999999999999999999999999999
b 99999999999.999999999999999999999999999
@@ -1387,8 +1387,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,28) DEFAULT NULL,
`b` decimal(38,28) unsigned DEFAULT NULL,
- `fa` bigint(13) DEFAULT NULL,
- `fb` bigint(12) unsigned DEFAULT NULL
+ `fa` bigint(12) DEFAULT NULL,
+ `fb` bigint(10) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999.9999999999999999999999999999
b 9999999999.9999999999999999999999999999
@@ -1398,8 +1398,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,29) DEFAULT NULL,
`b` decimal(38,29) unsigned DEFAULT NULL,
- `fa` bigint(12) DEFAULT NULL,
- `fb` bigint(11) unsigned DEFAULT NULL
+ `fa` bigint(11) DEFAULT NULL,
+ `fb` int(9) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999.99999999999999999999999999999
b 999999999.99999999999999999999999999999
@@ -1409,8 +1409,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,30) DEFAULT NULL,
`b` decimal(38,30) unsigned DEFAULT NULL,
- `fa` bigint(11) DEFAULT NULL,
- `fb` bigint(10) unsigned DEFAULT NULL
+ `fa` int(10) DEFAULT NULL,
+ `fb` int(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999.999999999999999999999999999999
b 99999999.999999999999999999999999999999
@@ -1422,7 +1422,7 @@ Create Table CREATE TABLE `t2` (
`a` decimal(30,0) DEFAULT NULL,
`b` decimal(30,0) unsigned DEFAULT NULL,
`fa` decimal(30,0) DEFAULT NULL,
- `fb` decimal(31,0) unsigned DEFAULT NULL
+ `fb` decimal(30,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999999999999
b 999999999999999999999999999999
@@ -1432,8 +1432,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,1) DEFAULT NULL,
`b` decimal(30,1) unsigned DEFAULT NULL,
- `fa` decimal(29,0) DEFAULT NULL,
- `fb` decimal(30,0) unsigned DEFAULT NULL
+ `fa` decimal(30,0) DEFAULT NULL,
+ `fb` decimal(29,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999999999.9
b 99999999999999999999999999999.9
@@ -1443,8 +1443,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,2) DEFAULT NULL,
`b` decimal(30,2) unsigned DEFAULT NULL,
- `fa` decimal(28,0) DEFAULT NULL,
- `fb` decimal(29,0) unsigned DEFAULT NULL
+ `fa` decimal(29,0) DEFAULT NULL,
+ `fb` decimal(28,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999999999.99
b 9999999999999999999999999999.99
@@ -1454,8 +1454,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,3) DEFAULT NULL,
`b` decimal(30,3) unsigned DEFAULT NULL,
- `fa` decimal(27,0) DEFAULT NULL,
- `fb` decimal(28,0) unsigned DEFAULT NULL
+ `fa` decimal(28,0) DEFAULT NULL,
+ `fb` decimal(27,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999999999.999
b 999999999999999999999999999.999
@@ -1465,8 +1465,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,4) DEFAULT NULL,
`b` decimal(30,4) unsigned DEFAULT NULL,
- `fa` decimal(26,0) DEFAULT NULL,
- `fb` decimal(27,0) unsigned DEFAULT NULL
+ `fa` decimal(27,0) DEFAULT NULL,
+ `fb` decimal(26,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999999.9999
b 99999999999999999999999999.9999
@@ -1476,8 +1476,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,5) DEFAULT NULL,
`b` decimal(30,5) unsigned DEFAULT NULL,
- `fa` decimal(25,0) DEFAULT NULL,
- `fb` decimal(26,0) unsigned DEFAULT NULL
+ `fa` decimal(26,0) DEFAULT NULL,
+ `fb` decimal(25,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999999.99999
b 9999999999999999999999999.99999
@@ -1487,8 +1487,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,6) DEFAULT NULL,
`b` decimal(30,6) unsigned DEFAULT NULL,
- `fa` decimal(24,0) DEFAULT NULL,
- `fb` decimal(25,0) unsigned DEFAULT NULL
+ `fa` decimal(25,0) DEFAULT NULL,
+ `fb` decimal(24,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999999.999999
b 999999999999999999999999.999999
@@ -1498,8 +1498,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,7) DEFAULT NULL,
`b` decimal(30,7) unsigned DEFAULT NULL,
- `fa` decimal(23,0) DEFAULT NULL,
- `fb` decimal(24,0) unsigned DEFAULT NULL
+ `fa` decimal(24,0) DEFAULT NULL,
+ `fb` decimal(23,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999999.9999999
b 99999999999999999999999.9999999
@@ -1509,8 +1509,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,8) DEFAULT NULL,
`b` decimal(30,8) unsigned DEFAULT NULL,
- `fa` decimal(22,0) DEFAULT NULL,
- `fb` decimal(23,0) unsigned DEFAULT NULL
+ `fa` decimal(23,0) DEFAULT NULL,
+ `fb` decimal(22,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999999.99999999
b 9999999999999999999999.99999999
@@ -1520,8 +1520,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,9) DEFAULT NULL,
`b` decimal(30,9) unsigned DEFAULT NULL,
- `fa` decimal(21,0) DEFAULT NULL,
- `fb` decimal(22,0) unsigned DEFAULT NULL
+ `fa` decimal(22,0) DEFAULT NULL,
+ `fb` decimal(21,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999999.999999999
b 999999999999999999999.999999999
@@ -1531,8 +1531,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,10) DEFAULT NULL,
`b` decimal(30,10) unsigned DEFAULT NULL,
- `fa` decimal(20,0) DEFAULT NULL,
- `fb` decimal(21,0) unsigned DEFAULT NULL
+ `fa` decimal(21,0) DEFAULT NULL,
+ `fb` decimal(20,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999999.9999999999
b 99999999999999999999.9999999999
@@ -1542,8 +1542,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,11) DEFAULT NULL,
`b` decimal(30,11) unsigned DEFAULT NULL,
- `fa` decimal(19,0) DEFAULT NULL,
- `fb` decimal(20,0) unsigned DEFAULT NULL
+ `fa` decimal(20,0) DEFAULT NULL,
+ `fb` decimal(19,0) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999999.99999999999
b 9999999999999999999.99999999999
@@ -1553,8 +1553,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,12) DEFAULT NULL,
`b` decimal(30,12) unsigned DEFAULT NULL,
- `fa` decimal(18,0) DEFAULT NULL,
- `fb` bigint(17) unsigned DEFAULT NULL
+ `fa` decimal(19,0) DEFAULT NULL,
+ `fb` bigint(18) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999999.999999999999
b 999999999999999999.999999999999
@@ -1564,7 +1564,7 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,13) DEFAULT NULL,
`b` decimal(30,13) unsigned DEFAULT NULL,
- `fa` bigint(17) DEFAULT NULL,
+ `fa` bigint(19) DEFAULT NULL,
`fb` bigint(17) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999999.9999999999999
@@ -1575,8 +1575,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,14) DEFAULT NULL,
`b` decimal(30,14) unsigned DEFAULT NULL,
- `fa` bigint(17) DEFAULT NULL,
- `fb` bigint(17) unsigned DEFAULT NULL
+ `fa` bigint(18) DEFAULT NULL,
+ `fb` bigint(16) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999999.99999999999999
b 9999999999999999.99999999999999
@@ -1587,7 +1587,7 @@ Create Table CREATE TABLE `t2` (
`a` decimal(30,15) DEFAULT NULL,
`b` decimal(30,15) unsigned DEFAULT NULL,
`fa` bigint(17) DEFAULT NULL,
- `fb` bigint(17) unsigned DEFAULT NULL
+ `fb` bigint(15) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999999.999999999999999
b 999999999999999.999999999999999
@@ -1597,8 +1597,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,16) DEFAULT NULL,
`b` decimal(30,16) unsigned DEFAULT NULL,
- `fa` bigint(17) DEFAULT NULL,
- `fb` bigint(16) unsigned DEFAULT NULL
+ `fa` bigint(16) DEFAULT NULL,
+ `fb` bigint(14) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999999.9999999999999999
b 99999999999999.9999999999999999
@@ -1608,8 +1608,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,17) DEFAULT NULL,
`b` decimal(30,17) unsigned DEFAULT NULL,
- `fa` bigint(16) DEFAULT NULL,
- `fb` bigint(15) unsigned DEFAULT NULL
+ `fa` bigint(15) DEFAULT NULL,
+ `fb` bigint(13) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999999.99999999999999999
b 9999999999999.99999999999999999
@@ -1619,8 +1619,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,18) DEFAULT NULL,
`b` decimal(30,18) unsigned DEFAULT NULL,
- `fa` bigint(15) DEFAULT NULL,
- `fb` bigint(14) unsigned DEFAULT NULL
+ `fa` bigint(14) DEFAULT NULL,
+ `fb` bigint(12) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999999.999999999999999999
b 999999999999.999999999999999999
@@ -1630,8 +1630,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,19) DEFAULT NULL,
`b` decimal(30,19) unsigned DEFAULT NULL,
- `fa` bigint(14) DEFAULT NULL,
- `fb` bigint(13) unsigned DEFAULT NULL
+ `fa` bigint(13) DEFAULT NULL,
+ `fb` bigint(11) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999999.9999999999999999999
b 99999999999.9999999999999999999
@@ -1641,8 +1641,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,20) DEFAULT NULL,
`b` decimal(30,20) unsigned DEFAULT NULL,
- `fa` bigint(13) DEFAULT NULL,
- `fb` bigint(12) unsigned DEFAULT NULL
+ `fa` bigint(12) DEFAULT NULL,
+ `fb` bigint(10) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999999.99999999999999999999
b 9999999999.99999999999999999999
@@ -1652,8 +1652,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,21) DEFAULT NULL,
`b` decimal(30,21) unsigned DEFAULT NULL,
- `fa` bigint(12) DEFAULT NULL,
- `fb` bigint(11) unsigned DEFAULT NULL
+ `fa` bigint(11) DEFAULT NULL,
+ `fb` int(9) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999999.999999999999999999999
b 999999999.999999999999999999999
@@ -1663,8 +1663,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,22) DEFAULT NULL,
`b` decimal(30,22) unsigned DEFAULT NULL,
- `fa` bigint(11) DEFAULT NULL,
- `fb` bigint(10) unsigned DEFAULT NULL
+ `fa` int(10) DEFAULT NULL,
+ `fb` int(8) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999999.9999999999999999999999
b 99999999.9999999999999999999999
@@ -1674,8 +1674,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,23) DEFAULT NULL,
`b` decimal(30,23) unsigned DEFAULT NULL,
- `fa` bigint(10) DEFAULT NULL,
- `fb` int(9) unsigned DEFAULT NULL
+ `fa` int(9) DEFAULT NULL,
+ `fb` int(7) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999999.99999999999999999999999
b 9999999.99999999999999999999999
@@ -1685,8 +1685,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,24) DEFAULT NULL,
`b` decimal(30,24) unsigned DEFAULT NULL,
- `fa` int(9) DEFAULT NULL,
- `fb` int(8) unsigned DEFAULT NULL
+ `fa` int(8) DEFAULT NULL,
+ `fb` int(6) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999999.999999999999999999999999
b 999999.999999999999999999999999
@@ -1696,8 +1696,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,25) DEFAULT NULL,
`b` decimal(30,25) unsigned DEFAULT NULL,
- `fa` int(8) DEFAULT NULL,
- `fb` int(7) unsigned DEFAULT NULL
+ `fa` int(7) DEFAULT NULL,
+ `fb` int(5) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99999.9999999999999999999999999
b 99999.9999999999999999999999999
@@ -1707,8 +1707,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,26) DEFAULT NULL,
`b` decimal(30,26) unsigned DEFAULT NULL,
- `fa` int(7) DEFAULT NULL,
- `fb` int(6) unsigned DEFAULT NULL
+ `fa` int(6) DEFAULT NULL,
+ `fb` int(4) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9999.99999999999999999999999999
b 9999.99999999999999999999999999
@@ -1718,8 +1718,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,27) DEFAULT NULL,
`b` decimal(30,27) unsigned DEFAULT NULL,
- `fa` int(6) DEFAULT NULL,
- `fb` int(5) unsigned DEFAULT NULL
+ `fa` int(5) DEFAULT NULL,
+ `fb` int(3) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 999.999999999999999999999999999
b 999.999999999999999999999999999
@@ -1729,8 +1729,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,28) DEFAULT NULL,
`b` decimal(30,28) unsigned DEFAULT NULL,
- `fa` int(5) DEFAULT NULL,
- `fb` int(4) unsigned DEFAULT NULL
+ `fa` int(4) DEFAULT NULL,
+ `fb` int(2) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 99.9999999999999999999999999999
b 99.9999999999999999999999999999
@@ -1740,8 +1740,8 @@ Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(30,29) DEFAULT NULL,
`b` decimal(30,29) unsigned DEFAULT NULL,
- `fa` int(4) DEFAULT NULL,
- `fb` int(3) unsigned DEFAULT NULL
+ `fa` int(3) DEFAULT NULL,
+ `fb` int(1) unsigned DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 9.99999999999999999999999999999
b 9.99999999999999999999999999999
@@ -2295,7 +2295,7 @@ FORMAT(-1e308,2)
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `FORMAT(-1e308,2)` varchar(416) DEFAULT NULL
+ `FORMAT(-1e308,2)` varchar(417) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 AS SELECT FORMAT('-1e308',2);
@@ -2305,7 +2305,7 @@ FORMAT('-1e308',2)
SHOW CREATE TABLE t1;
Table Create Table
t1 CREATE TABLE `t1` (
- `FORMAT('-1e308',2)` varchar(416) DEFAULT NULL
+ `FORMAT('-1e308',2)` varchar(417) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 AS SELECT FORMAT(DATE'20191231',0),FORMAT(TIME'99:05:00',0),FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0);
@@ -2317,7 +2317,7 @@ Table Create Table
t1 CREATE TABLE `t1` (
`FORMAT(DATE'20191231',0)` varchar(11) DEFAULT NULL,
`FORMAT(TIME'99:05:00',0)` varchar(10) DEFAULT NULL,
- `FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0)` varchar(19) DEFAULT NULL
+ `FORMAT(TIMESTAMP'2019-12-31 23:59:59.123456',0)` varchar(21) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
CREATE OR REPLACE TABLE t1 (y YEAR);
@@ -3549,7 +3549,7 @@ FORMAT(f,0)
SHOW CREATE TABLE t2;
Table Create Table
t2 CREATE TABLE `t2` (
- `FORMAT(f,0)` varchar(53) DEFAULT NULL
+ `FORMAT(f,0)` varchar(54) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1,t2;
#
diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result
index 992363c6b91..0e9cebd0cb4 100644
--- a/mysql-test/main/func_str.result
+++ b/mysql-test/main/func_str.result
@@ -2708,7 +2708,7 @@ create table t1(a float);
insert into t1 values (1.33);
select format(a, 2) from t1;
Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
-def format(a, 2) 253 56 4 Y 0 39 8
+def format(a, 2) 253 57 4 Y 0 39 8
format(a, 2)
1.33
drop table t1;
diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result
index ae365ea207a..01daf027186 100644
--- a/mysql-test/main/grant.result
+++ b/mysql-test/main/grant.result
@@ -2773,6 +2773,24 @@ root@localhost
DROP TABLE t1;
DROP USER dummy@localhost;
#
+# MDEV-23082: ER_TABLEACCESS_DENIED_ERROR error message is truncated, and
+# inaccurately
+#
+CREATE USER foo;
+CREATE DATABASE db;
+CREATE TABLE db.t (a INT);
+connect con1,localhost,foo,,;
+GRANT ALL ON db.t TO foo;
+ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table 't'
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT OPTION, REFERENCES,
+INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON db.t TO foo;
+ERROR 42000: SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT, REFERENCES, INDEX, ALTER, CREATE VIEW, SHOW ... command denied to user 'foo'@'localhost' for table 't'
+connection default;
+disconnect con1;
+DROP USER foo;
+DROP TABLE db.t;
+DROP DATABASE db;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test
index 147fc42311c..38baf673825 100644
--- a/mysql-test/main/grant.test
+++ b/mysql-test/main/grant.test
@@ -2260,6 +2260,31 @@ DROP TABLE t1;
DROP USER dummy@localhost;
--echo #
+--echo # MDEV-23082: ER_TABLEACCESS_DENIED_ERROR error message is truncated, and
+--echo # inaccurately
+--echo #
+
+CREATE USER foo;
+CREATE DATABASE db;
+CREATE TABLE db.t (a INT);
+
+--connect (con1,localhost,foo,,)
+
+--error ER_TABLEACCESS_DENIED_ERROR
+GRANT ALL ON db.t TO foo;
+
+--error ER_TABLEACCESS_DENIED_ERROR
+GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, GRANT OPTION, REFERENCES,
+INDEX, ALTER, CREATE VIEW, SHOW VIEW, TRIGGER ON db.t TO foo;
+
+--connection default
+--disconnect con1
+
+DROP USER foo;
+DROP TABLE db.t;
+DROP DATABASE db;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result
index fcc437f8c60..5a36daf31f9 100644
--- a/mysql-test/main/information_schema.result
+++ b/mysql-test/main/information_schema.result
@@ -2219,6 +2219,21 @@ SCHEMA_NAME
# End of 10.1 tests
#
#
+# Start of 10.2 Test
+#
+# MDEV-14836: Assertion `m_status == DA_ERROR' failed in
+# Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
+#
+SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
+ERROR HY000: Unknown error
+SHOW WARNINGS;
+Level Code Message
+Error 1105 Unknown error
+Warning 1931 Query execution was interrupted. The query examined at least 11 rows, which exceeds LIMIT ROWS EXAMINED (10). The query result may be incomplete
+#
+# End of 10.2 Test
+#
+#
# MDEV-21201:No records produced in information_schema query,
# depending on projection
#
diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test
index a3231d94349..2ef86628918 100644
--- a/mysql-test/main/information_schema.test
+++ b/mysql-test/main/information_schema.test
@@ -1921,6 +1921,20 @@ SELECT SCHEMA_NAME from information_schema.schemata where schema_name=REPEAT('a'
--echo # End of 10.1 tests
--echo #
+--echo #
+--echo # Start of 10.2 Test
+--echo #
+--echo # MDEV-14836: Assertion `m_status == DA_ERROR' failed in
+--echo # Diagnostics_area::sql_errno upon query from I_S with LIMIT ROWS EXAMINED
+--echo #
+
+--error ER_UNKNOWN_ERROR
+SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
+SHOW WARNINGS;
+
+--echo #
+--echo # End of 10.2 Test
+--echo #
--echo #
--echo # MDEV-21201:No records produced in information_schema query,
diff --git a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
index 8997c404079..9de067b0e3f 100644
--- a/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/main/mysql_tzinfo_to_sql_symlink.result
@@ -85,6 +85,15 @@ END IF|
#
# Testing with explicit timezonefile
#
+\d |
+IF (select count(*) from information_schema.global_variables where
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
+ALTER TABLE time_zone ENGINE=InnoDB;
+ALTER TABLE time_zone_name ENGINE=InnoDB;
+ALTER TABLE time_zone_transition ENGINE=InnoDB;
+ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
+END IF|
+\d ;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
@@ -106,6 +115,15 @@ END IF|
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
+ALTER TABLE time_zone ENGINE=InnoDB;
+ALTER TABLE time_zone_name ENGINE=InnoDB;
+ALTER TABLE time_zone_transition ENGINE=InnoDB;
+ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
+END IF|
+\d ;
+\d |
+IF (select count(*) from information_schema.global_variables where
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=InnoDB;
END IF|
\d ;
diff --git a/mysql-test/main/mysqld--help,win.rdiff b/mysql-test/main/mysqld--help,win.rdiff
index 91b0540c879..337755252ba 100644
--- a/mysql-test/main/mysqld--help,win.rdiff
+++ b/mysql-test/main/mysqld--help,win.rdiff
@@ -66,20 +66,6 @@
sort-buffer-size 2097152
sql-mode STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
sql-safe-updates FALSE
-@@ -1741,10 +1752,10 @@
- sync-relay-log-info 10000
- sysdate-is-now FALSE
- system-versioning-alter-history ERROR
--table-cache 421
-+table-cache 2000
- table-definition-cache 400
--table-open-cache 421
--table-open-cache-instances 1
-+table-open-cache 2000
-+table-open-cache-instances 8
- tc-heuristic-recover OFF
- tcp-keepalive-interval 0
- tcp-keepalive-probes 0
@@ -1753,6 +1764,8 @@
thread-cache-size 151
thread-pool-idle-timeout 60
diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result
index e9ea7e13c99..7671dfeef59 100644
--- a/mysql-test/main/mysqld--help.result
+++ b/mysql-test/main/mysqld--help.result
@@ -1594,7 +1594,6 @@ max-binlog-cache-size 18446744073709547520
max-binlog-size 1073741824
max-binlog-stmt-cache-size 18446744073709547520
max-connect-errors 100
-max-connections 151
max-delayed-threads 20
max-digest-length 1024
max-error-count 64
@@ -1797,10 +1796,7 @@ sync-relay-log 10000
sync-relay-log-info 10000
sysdate-is-now FALSE
system-versioning-alter-history ERROR
-table-cache 421
table-definition-cache 400
-table-open-cache 421
-table-open-cache-instances 1
tc-heuristic-recover OFF
tcp-keepalive-interval 0
tcp-keepalive-probes 0
diff --git a/mysql-test/main/mysqld--help.test b/mysql-test/main/mysqld--help.test
index dcca6a75bca..f32f52c6dd0 100644
--- a/mysql-test/main/mysqld--help.test
+++ b/mysql-test/main/mysqld--help.test
@@ -23,7 +23,9 @@ perl;
log-slow-queries pid-file slow-query-log-file log-basename
datadir slave-load-tmpdir tmpdir socket thread-pool-size
large-files-support lower-case-file-system system-time-zone
- collation-server character-set-server log-tc-size tls-version version.*/;
+ collation-server character-set-server log-tc-size table-cache
+ table-open-cache table-open-cache-instances max-connections
+ tls-version version.*/;
# Plugins which may or may not be there:
@plugins=qw/innodb archive blackhole federated partition s3
diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result
index 9483dfee9fb..d37b76e5f74 100644
--- a/mysql-test/main/parser.result
+++ b/mysql-test/main/parser.result
@@ -1801,6 +1801,13 @@ SELECT @@GLOBAL.password;
ERROR HY000: Unknown system variable 'password'
SELECT @@GLOBAL.role;
ERROR HY000: Unknown system variable 'role'
+#
+# MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug builds
+#
+EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo /FO LIST' at line 1
+EXECUTE IMMEDIATE 'if(`systeminfo';
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '`systeminfo' at line 1
End of 10.3 tests
#
# MDEV-19540: 10.4 allow lock options with SELECT in brackets
diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test
index 07f2d409d94..3689f38dc7f 100644
--- a/mysql-test/main/parser.test
+++ b/mysql-test/main/parser.test
@@ -1543,6 +1543,15 @@ SELECT @@GLOBAL.password;
--error ER_UNKNOWN_SYSTEM_VARIABLE
SELECT @@GLOBAL.role;
+--echo #
+--echo # MDEV-22022 Various mangled SQL statements will crash 10.3 to 10.5 debug builds
+--echo #
+
+--error ER_PARSE_ERROR
+EXECUTE IMMEDIATE 'if(`systeminfo /FO LIST';
+--error ER_PARSE_ERROR
+EXECUTE IMMEDIATE 'if(`systeminfo';
+
--echo End of 10.3 tests
--echo #
diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result
index 2e60a760fd8..944515413d3 100644
--- a/mysql-test/main/subselect4.result
+++ b/mysql-test/main/subselect4.result
@@ -2609,6 +2609,47 @@ Central America and the Caribbean 442 66422
SET @@optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
#
+# MDEV-9513: Assertion `join->group_list || !join->is_in_subquery()' failed in create_sort_index
+#
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (2),(3);
+EXPLAIN
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION B ALL NULL NULL NULL NULL 2 Using where
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+a
+1
+2
+EXPLAIN
+SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2
+2 SUBQUERY A ALL NULL NULL NULL NULL 2
+3 UNION B ALL NULL NULL NULL NULL 2
+NULL UNION RESULT <union2,3> ALL NULL NULL NULL NULL NULL
+SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+a
+1
+2
+EXPLAIN
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY A ALL NULL NULL NULL NULL 2 Using where
+3 DEPENDENT UNION B ALL NULL NULL NULL NULL 2 Using where
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1);
+a
+1
+2
+DROP TABLE t1,t2;
+# end of 10.1 tests
+#
# MDEV-22852: SIGSEGV in sortlength (optimized builds)
#
SET @save_optimizer_switch=@@optimizer_switch;
@@ -2620,6 +2661,31 @@ SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) FR
0
SET @@optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
+#
+# MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after DELETE
+# with subquery with ROLLUP
+#
+CREATE TABLE t1 (i INT DEFAULT 0, c VARCHAR(2048));
+INSERT INTO t1 SELECT 0, seq FROM seq_1_to_6000;
+CREATE TABLE t2 (f VARCHAR(2048) DEFAULT '');
+INSERT INTO t2 VALUES ('1'),('bar');
+EXPLAIN
+SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP);
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where
+2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 6000 Using filesort
+SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP);
+f
+1
+SELECT * FROM t2;
+f
+1
+bar
+DELETE FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP );
+SELECT * FROM t2;
+f
+bar
+DROP TABLE t1, t2;
# End of 10.2 tests
#
# MDEV-19134: EXISTS() slower if ORDER BY is defined
diff --git a/mysql-test/main/subselect4.test b/mysql-test/main/subselect4.test
index 1ed79de4598..8d2ddaab09b 100644
--- a/mysql-test/main/subselect4.test
+++ b/mysql-test/main/subselect4.test
@@ -7,6 +7,8 @@ drop table if exists t0,t1,t2,t3,t4,t5,t6;
drop view if exists v1, v2;
--enable_warnings
+--source include/have_sequence.inc
+
set @subselect4_tmp= @@optimizer_switch;
set optimizer_switch='semijoin=on,firstmatch=on,loosescan=on';
set optimizer_switch='semijoin_with_cache=on';
@@ -2142,6 +2144,31 @@ SET @@optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
--echo #
+--echo # MDEV-9513: Assertion `join->group_list || !join->is_in_subquery()' failed in create_sort_index
+--echo #
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2);
+
+CREATE TABLE t2 (a INT);
+INSERT INTO t2 VALUES (2),(3);
+EXPLAIN
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+
+EXPLAIN
+SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+SELECT t1.a FROM t1 WHERE EXISTS (SELECT A.a FROM t1 A UNION SELECT B.a FROM t2 B ORDER BY 1);
+
+EXPLAIN
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1);
+SELECT t1.a FROM t1 WHERE t1.a IN ( SELECT A.a FROM t1 A UNION ALL SELECT B.a FROM t2 B ORDER BY 1);
+
+DROP TABLE t1,t2;
+
+--echo # end of 10.1 tests
+
+--echo #
--echo # MDEV-22852: SIGSEGV in sortlength (optimized builds)
--echo #
@@ -2153,6 +2180,27 @@ SELECT (SELECT DISTINCT t1i.b FROM t1 t1i GROUP BY t1i.a ORDER BY MAX(t1o.b)) FR
SET @@optimizer_switch= @save_optimizer_switch;
DROP TABLE t1;
+--echo #
+--echo # MDEV-17066: Bytes lost or Assertion `status_var.local_memory_used == 0 after DELETE
+--echo # with subquery with ROLLUP
+--echo #
+
+CREATE TABLE t1 (i INT DEFAULT 0, c VARCHAR(2048));
+INSERT INTO t1 SELECT 0, seq FROM seq_1_to_6000;
+
+CREATE TABLE t2 (f VARCHAR(2048) DEFAULT '');
+INSERT INTO t2 VALUES ('1'),('bar');
+
+EXPLAIN
+SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP);
+SELECT * FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP);
+
+SELECT * FROM t2;
+DELETE FROM t2 WHERE f IN ( SELECT MAX(c) FROM t1 GROUP BY c WITH ROLLUP );
+SELECT * FROM t2;
+
+DROP TABLE t1, t2;
+
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result
index 84301a4b191..926ed1a8393 100644
--- a/mysql-test/main/type_date.result
+++ b/mysql-test/main/type_date.result
@@ -1103,5 +1103,35 @@ t2 CREATE TABLE `t2` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t2,t1;
#
+# MDEV-23388 Assertion `args[0]->decimals == 0' failed in Item_func_round::fix_arg_int
+#
+SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)));
+ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)))
+20201212
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '1'
+SELECT GREATEST('1', CAST('2020-12-12' AS DATE));
+Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr
+def GREATEST('1', CAST('2020-12-12' AS DATE)) 10 10 10 Y 128 0 63
+GREATEST('1', CAST('2020-12-12' AS DATE))
+2020-12-12
+Warnings:
+Warning 1292 Truncated incorrect datetime value: '1'
+CREATE TABLE t1 (c_date DATE NOT NULL, c_int INT NOT NULL);
+CREATE TABLE t2 AS SELECT
+GREATEST(c_date,c_date),
+GREATEST(c_date,c_int),
+GREATEST(c_int,c_date)
+FROM t1;
+SHOW CREATE TABLE t2;
+Table Create Table
+t2 CREATE TABLE `t2` (
+ `GREATEST(c_date,c_date)` date NOT NULL,
+ `GREATEST(c_date,c_int)` date DEFAULT NULL,
+ `GREATEST(c_int,c_date)` date DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2;
+DROP TABLE t1;
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/type_date.test b/mysql-test/main/type_date.test
index 33598846504..a29f78a679b 100644
--- a/mysql-test/main/type_date.test
+++ b/mysql-test/main/type_date.test
@@ -750,5 +750,27 @@ SHOW CREATE TABLE t2;
DROP TABLE t2,t1;
--echo #
+--echo # MDEV-23388 Assertion `args[0]->decimals == 0' failed in Item_func_round::fix_arg_int
+--echo #
+
+SELECT ROUND(GREATEST('1', CAST('2020-12-12' AS DATE)));
+
+--disable_ps_protocol
+--enable_metadata
+SELECT GREATEST('1', CAST('2020-12-12' AS DATE));
+--disable_metadata
+--enable_ps_protocol
+
+CREATE TABLE t1 (c_date DATE NOT NULL, c_int INT NOT NULL);
+CREATE TABLE t2 AS SELECT
+ GREATEST(c_date,c_date),
+ GREATEST(c_date,c_int),
+ GREATEST(c_int,c_date)
+FROM t1;
+SHOW CREATE TABLE t2;
+DROP TABLE t2;
+DROP TABLE t1;
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result
index 2588481ff75..5137a8229b6 100644
--- a/mysql-test/main/type_float.result
+++ b/mysql-test/main/type_float.result
@@ -990,5 +990,175 @@ Warnings:
Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 1
DROP TABLE t1;
#
+# MDEV-23415 Server crash or Assertion `dec_length <= str_length' failed in Item_func_format::val_str_ascii
+#
+SELECT FORMAT('0', 50, 'de_DE');
+FORMAT('0', 50, 'de_DE')
+0,00000000000000000000000000000000000000
+SELECT FORMAT(0e0, 50, 'de_DE');
+FORMAT(0e0, 50, 'de_DE')
+0,00000000000000000000000000000000000000
+FOR d IN 0..50
+DO
+SELECT
+d,
+FORMAT(123456789.123456789e0, d, 'de_DE') AS fdbl,
+FORMAT(123456789.123456789, d, 'de_DE') AS fdec;
+END FOR;
+$$
+d 0
+fdbl 123.456.789
+fdec 123.456.789
+d 1
+fdbl 123.456.789,1
+fdec 123.456.789,1
+d 2
+fdbl 123.456.789,12
+fdec 123.456.789,12
+d 3
+fdbl 123.456.789,123
+fdec 123.456.789,123
+d 4
+fdbl 123.456.789,1235
+fdec 123.456.789,1235
+d 5
+fdbl 123.456.789,12346
+fdec 123.456.789,12346
+d 6
+fdbl 123.456.789,123457
+fdec 123.456.789,123457
+d 7
+fdbl 123.456.789,1234568
+fdec 123.456.789,1234568
+d 8
+fdbl 123.456.789,12345680
+fdec 123.456.789,12345679
+d 9
+fdbl 123.456.789,123456790
+fdec 123.456.789,123456789
+d 10
+fdbl 123.456.789,1234567900
+fdec 123.456.789,1234567890
+d 11
+fdbl 123.456.789,12345680000
+fdec 123.456.789,12345678900
+d 12
+fdbl 123.456.789,123456790000
+fdec 123.456.789,123456789000
+d 13
+fdbl 123.456.789,1234568000000
+fdec 123.456.789,1234567890000
+d 14
+fdbl 123.456.789,12345679000000
+fdec 123.456.789,12345678900000
+d 15
+fdbl 123.456.789,123456790000000
+fdec 123.456.789,123456789000000
+d 16
+fdbl 123.456.789,1234567800000000
+fdec 123.456.789,1234567890000000
+d 17
+fdbl 123.456.789,12345679000000000
+fdec 123.456.789,12345678900000000
+d 18
+fdbl 123.456.789,123456790000000000
+fdec 123.456.789,123456789000000000
+d 19
+fdbl 123.456.789,1234567900000000000
+fdec 123.456.789,1234567890000000000
+d 20
+fdbl 123.456.789,12345679000000000000
+fdec 123.456.789,12345678900000000000
+d 21
+fdbl 123.456.789,123456800000000000000
+fdec 123.456.789,123456789000000000000
+d 22
+fdbl 123.456.789,1234567900000000000000
+fdec 123.456.789,1234567890000000000000
+d 23
+fdbl 123.456.789,12345680000000000000000
+fdec 123.456.789,12345678900000000000000
+d 24
+fdbl 123.456.789,123456790000000000000000
+fdec 123.456.789,123456789000000000000000
+d 25
+fdbl 123.456.789,1234567900000000000000000
+fdec 123.456.789,1234567890000000000000000
+d 26
+fdbl 123.456.789,12345679000000000000000000
+fdec 123.456.789,12345678900000000000000000
+d 27
+fdbl 123.456.789,123456780000000000000000000
+fdec 123.456.789,123456789000000000000000000
+d 28
+fdbl 123.456.789,1234567900000000000000000000
+fdec 123.456.789,1234567890000000000000000000
+d 29
+fdbl 123.456.789,12345678000000000000000000000
+fdec 123.456.789,12345678900000000000000000000
+d 30
+fdbl 123.456.789,123456790000000000000000000000
+fdec 123.456.789,123456789000000000000000000000
+d 31
+fdbl 123.456.789,1234567900000000000000000000000
+fdec 123.456.789,1234567890000000000000000000000
+d 32
+fdbl 123.456.789,12345679000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000
+d 33
+fdbl 123.456.789,123456790000000000000000000000000
+fdec 123.456.789,123456789000000000000000000000000
+d 34
+fdbl 123.456.789,1234567900000000000000000000000000
+fdec 123.456.789,1234567890000000000000000000000000
+d 35
+fdbl 123.456.789,12345679000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000
+d 36
+fdbl 123.456.789,123456790000000000000000000000000000
+fdec 123.456.789,123456789000000000000000000000000000
+d 37
+fdbl 123.456.789,1234567900000000000000000000000000000
+fdec 123.456.789,1234567890000000000000000000000000000
+d 38
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 39
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 40
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 41
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 42
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 43
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 44
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 45
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 46
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 47
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 48
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 49
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+d 50
+fdbl 123.456.789,12345678000000000000000000000000000000
+fdec 123.456.789,12345678900000000000000000000000000000
+#
# End of 10.4 tests
#
diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test
index ea1829bfdaa..a12bf67a426 100644
--- a/mysql-test/main/type_float.test
+++ b/mysql-test/main/type_float.test
@@ -681,5 +681,25 @@ EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1e0+a<=>?+a' USING 1e
DROP TABLE t1;
--echo #
+--echo # MDEV-23415 Server crash or Assertion `dec_length <= str_length' failed in Item_func_format::val_str_ascii
+--echo #
+
+SELECT FORMAT('0', 50, 'de_DE');
+SELECT FORMAT(0e0, 50, 'de_DE');
+
+--vertical_results
+DELIMITER $$;
+FOR d IN 0..50
+DO
+ SELECT
+ d,
+ FORMAT(123456789.123456789e0, d, 'de_DE') AS fdbl,
+ FORMAT(123456789.123456789, d, 'de_DE') AS fdec;
+END FOR;
+$$
+DELIMITER ;$$
+--horizontal_results
+
+--echo #
--echo # End of 10.4 tests
--echo #
diff --git a/mysql-test/main/type_newdecimal.result b/mysql-test/main/type_newdecimal.result
index 07ecef95e5d..eac263296e2 100644
--- a/mysql-test/main/type_newdecimal.result
+++ b/mysql-test/main/type_newdecimal.result
@@ -2340,6 +2340,53 @@ t1 CREATE TABLE `t1` (
) ENGINE=MyISAM DEFAULT CHARSET=latin1
DROP TABLE t1;
#
+# MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result
+#
+SELECT CAST(0000000000000000000000000000000000000000000000000000000000000000000000000000000020.01 AS DECIMAL(15,2)) as val;
+val
+20.01
+SET sql_mode='';
+CREATE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.0'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.9'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.99'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.994'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.995'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.999'));
+CREATE TABLE t2 (a TEXT, d DECIMAL(15,2));
+INSERT IGNORE INTO t2 (a,d) SELECT a, a FROM t1;
+Warnings:
+Note 1265 Data truncated for column 'd' at row 5
+Note 1265 Data truncated for column 'd' at row 6
+Note 1265 Data truncated for column 'd' at row 7
+INSERT IGNORE INTO t2 (a,d) SELECT CONCAT('-',a), CONCAT('-',a) FROM t1;
+Warnings:
+Note 1265 Data truncated for column 'd' at row 5
+Note 1265 Data truncated for column 'd' at row 6
+Note 1265 Data truncated for column 'd' at row 7
+SELECT d, a FROM t2 ORDER BY d,a;
+d a
+-2.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.995
+-2.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.999
+-1.99 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.99
+-1.99 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.994
+-1.90 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.9
+-1.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+-1.00 -00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0
+1.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001
+1.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.0
+1.90 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.9
+1.99 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.99
+1.99 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.994
+2.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.995
+2.00 00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001.999
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+#
+# End of 10.1 tests
+#
+#
# Bug#18408499 UNSIGNED BIGINT HIGH VALUES
# WRONG NUMERICAL COMPARISON RESULTS
#
@@ -2406,3 +2453,323 @@ drop table t1;
#
# End of 10.2 tests
#
+#
+# Start of 10.4 tests
+#
+#
+# MDEV-23032 FLOOR()/CEIL() incorrectly calculate the precision of a DECIMAL(M,D) column.
+#
+CREATE PROCEDURE p1(prec INT, scale INT, suffix VARCHAR(32))
+BEGIN
+EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a decimal(',prec,',',scale,')',suffix,')');
+INSERT IGNORE INTO t1 VALUES (-1e100), (+1e100);
+CREATE TABLE t2 AS SELECT
+a,
+FLOOR(a) AS fa,
+CEILING(a) AS ca,
+LENGTH(FLOOR(a)),
+LENGTH(CEILING(a))
+FROM t1 ORDER BY a;
+SHOW CREATE TABLE t2;
+SELECT * FROM t2;
+DROP TABLE t2, t1;
+END;
+$$
+CALL p1(38,10,'');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,10) DEFAULT NULL,
+ `fa` decimal(29,0) DEFAULT NULL,
+ `ca` decimal(29,0) DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a -9999999999999999999999999999.9999999999
+fa -10000000000000000000000000000
+ca -9999999999999999999999999999
+LENGTH(FLOOR(a)) 30
+LENGTH(CEILING(a)) 29
+a 9999999999999999999999999999.9999999999
+fa 9999999999999999999999999999
+ca 10000000000000000000000000000
+LENGTH(FLOOR(a)) 28
+LENGTH(CEILING(a)) 29
+CALL p1(28,10,'');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(28,10) DEFAULT NULL,
+ `fa` decimal(19,0) DEFAULT NULL,
+ `ca` decimal(19,0) DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a -999999999999999999.9999999999
+fa -1000000000000000000
+ca -999999999999999999
+LENGTH(FLOOR(a)) 20
+LENGTH(CEILING(a)) 19
+a 999999999999999999.9999999999
+fa 999999999999999999
+ca 1000000000000000000
+LENGTH(FLOOR(a)) 18
+LENGTH(CEILING(a)) 19
+CALL p1(27,10,'');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(27,10) DEFAULT NULL,
+ `fa` bigint(19) DEFAULT NULL,
+ `ca` bigint(19) DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a -99999999999999999.9999999999
+fa -100000000000000000
+ca -99999999999999999
+LENGTH(FLOOR(a)) 19
+LENGTH(CEILING(a)) 18
+a 99999999999999999.9999999999
+fa 99999999999999999
+ca 100000000000000000
+LENGTH(FLOOR(a)) 17
+LENGTH(CEILING(a)) 18
+CALL p1(20,10,'');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(20,10) DEFAULT NULL,
+ `fa` bigint(12) DEFAULT NULL,
+ `ca` bigint(12) DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a -9999999999.9999999999
+fa -10000000000
+ca -9999999999
+LENGTH(FLOOR(a)) 12
+LENGTH(CEILING(a)) 11
+a 9999999999.9999999999
+fa 9999999999
+ca 10000000000
+LENGTH(FLOOR(a)) 10
+LENGTH(CEILING(a)) 11
+CALL p1(19,10,'');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(19,10) DEFAULT NULL,
+ `fa` bigint(11) DEFAULT NULL,
+ `ca` bigint(11) DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a -999999999.9999999999
+fa -1000000000
+ca -999999999
+LENGTH(FLOOR(a)) 11
+LENGTH(CEILING(a)) 10
+a 999999999.9999999999
+fa 999999999
+ca 1000000000
+LENGTH(FLOOR(a)) 9
+LENGTH(CEILING(a)) 10
+CALL p1(18,10,'');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(18,10) DEFAULT NULL,
+ `fa` int(10) DEFAULT NULL,
+ `ca` int(10) DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a -99999999.9999999999
+fa -100000000
+ca -99999999
+LENGTH(FLOOR(a)) 10
+LENGTH(CEILING(a)) 9
+a 99999999.9999999999
+fa 99999999
+ca 100000000
+LENGTH(FLOOR(a)) 8
+LENGTH(CEILING(a)) 9
+CALL p1(10,10,'');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(10,10) DEFAULT NULL,
+ `fa` int(2) DEFAULT NULL,
+ `ca` int(2) DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a -0.9999999999
+fa -1
+ca 0
+LENGTH(FLOOR(a)) 2
+LENGTH(CEILING(a)) 1
+a 0.9999999999
+fa 0
+ca 1
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+CALL p1(38,10,' UNSIGNED');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,10) unsigned DEFAULT NULL,
+ `fa` decimal(28,0) unsigned DEFAULT NULL,
+ `ca` decimal(29,0) unsigned DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 0.0000000000
+fa 0
+ca 0
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+a 9999999999999999999999999999.9999999999
+fa 9999999999999999999999999999
+ca 10000000000000000000000000000
+LENGTH(FLOOR(a)) 28
+LENGTH(CEILING(a)) 29
+CALL p1(28,10,' UNSIGNED');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(28,10) unsigned DEFAULT NULL,
+ `fa` bigint(18) unsigned DEFAULT NULL,
+ `ca` decimal(19,0) unsigned DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 0.0000000000
+fa 0
+ca 0
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+a 999999999999999999.9999999999
+fa 999999999999999999
+ca 1000000000000000000
+LENGTH(FLOOR(a)) 18
+LENGTH(CEILING(a)) 19
+CALL p1(27,10,' UNSIGNED');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(27,10) unsigned DEFAULT NULL,
+ `fa` bigint(17) unsigned DEFAULT NULL,
+ `ca` bigint(18) unsigned DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 0.0000000000
+fa 0
+ca 0
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+a 99999999999999999.9999999999
+fa 99999999999999999
+ca 100000000000000000
+LENGTH(FLOOR(a)) 17
+LENGTH(CEILING(a)) 18
+CALL p1(20,10,' UNSIGNED');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(20,10) unsigned DEFAULT NULL,
+ `fa` bigint(10) unsigned DEFAULT NULL,
+ `ca` bigint(11) unsigned DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 0.0000000000
+fa 0
+ca 0
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+a 9999999999.9999999999
+fa 9999999999
+ca 10000000000
+LENGTH(FLOOR(a)) 10
+LENGTH(CEILING(a)) 11
+CALL p1(19,10,' UNSIGNED');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(19,10) unsigned DEFAULT NULL,
+ `fa` int(9) unsigned DEFAULT NULL,
+ `ca` bigint(10) unsigned DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 0.0000000000
+fa 0
+ca 0
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+a 999999999.9999999999
+fa 999999999
+ca 1000000000
+LENGTH(FLOOR(a)) 9
+LENGTH(CEILING(a)) 10
+CALL p1(18,10,' UNSIGNED');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(18,10) unsigned DEFAULT NULL,
+ `fa` int(8) unsigned DEFAULT NULL,
+ `ca` int(9) unsigned DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 0.0000000000
+fa 0
+ca 0
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+a 99999999.9999999999
+fa 99999999
+ca 100000000
+LENGTH(FLOOR(a)) 8
+LENGTH(CEILING(a)) 9
+CALL p1(10,10,' UNSIGNED');
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(10,10) unsigned DEFAULT NULL,
+ `fa` int(1) unsigned DEFAULT NULL,
+ `ca` int(1) unsigned DEFAULT NULL,
+ `LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
+ `LENGTH(CEILING(a))` int(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+a 0.0000000000
+fa 0
+ca 0
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+a 0.9999999999
+fa 0
+ca 1
+LENGTH(FLOOR(a)) 1
+LENGTH(CEILING(a)) 1
+DROP PROCEDURE p1;
+#
+# MDEV-23118 FORMAT(d1,dec) where dec=0/38 and d1 is DECIMAL(38,38) gives incorrect results
+#
+CREATE OR REPLACE TABLE t1 (a DECIMAL(38,38));
+INSERT INTO t1 VALUES (-0.9999999999999999999999999999999999999), (0.9999999999999999999999999999999999999);
+SELECT a, FORMAT(a,0), FORMAT(a,38) FROM t1;
+a -0.99999999999999999999999999999999999990
+FORMAT(a,0) -1
+FORMAT(a,38) -0.99999999999999999999999999999999999990
+a 0.99999999999999999999999999999999999990
+FORMAT(a,0) 1
+FORMAT(a,38) 0.99999999999999999999999999999999999990
+CREATE OR REPLACE TABLE t2 AS SELECT a, FORMAT(a,0), FORMAT(a,38) FROM t1;
+SELECT * FROM t2;
+a -0.99999999999999999999999999999999999990
+FORMAT(a,0) -1
+FORMAT(a,38) -0.99999999999999999999999999999999999990
+a 0.99999999999999999999999999999999999990
+FORMAT(a,0) 1
+FORMAT(a,38) 0.99999999999999999999999999999999999990
+SHOW CREATE TABLE t2;
+Table t2
+Create Table CREATE TABLE `t2` (
+ `a` decimal(38,38) DEFAULT NULL,
+ `FORMAT(a,0)` varchar(2) DEFAULT NULL,
+ `FORMAT(a,38)` varchar(41) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t2,t1;
+#
+# End of 10.4 tests
+#
diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test
index 2f3409f56e9..5b7ecf89a07 100644
--- a/mysql-test/main/type_newdecimal.test
+++ b/mysql-test/main/type_newdecimal.test
@@ -1825,6 +1825,32 @@ SHOW CREATE TABLE t1;
DROP TABLE t1;
--echo #
+--echo # MDEV-23105 Cast number string with many leading zeros to decimal gives unexpected result
+--echo #
+
+SELECT CAST(0000000000000000000000000000000000000000000000000000000000000000000000000000000020.01 AS DECIMAL(15,2)) as val;
+
+SET sql_mode='';
+CREATE TABLE t1 (a TEXT);
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.0'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.9'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.99'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.994'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.995'));
+INSERT INTO t1 VALUES (CONCAT(REPEAT('0',100),1,'.999'));
+CREATE TABLE t2 (a TEXT, d DECIMAL(15,2));
+INSERT IGNORE INTO t2 (a,d) SELECT a, a FROM t1;
+INSERT IGNORE INTO t2 (a,d) SELECT CONCAT('-',a), CONCAT('-',a) FROM t1;
+SELECT d, a FROM t2 ORDER BY d,a;
+DROP TABLE t1, t2;
+SET sql_mode=DEFAULT;
+
+--echo #
+--echo # End of 10.1 tests
+--echo #
+
+--echo #
--echo # Bug#18408499 UNSIGNED BIGINT HIGH VALUES
--echo # WRONG NUMERICAL COMPARISON RESULTS
--echo #
@@ -1871,3 +1897,70 @@ drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #
+
+--echo #
+--echo # Start of 10.4 tests
+--echo #
+
+--echo #
+--echo # MDEV-23032 FLOOR()/CEIL() incorrectly calculate the precision of a DECIMAL(M,D) column.
+--echo #
+
+DELIMITER $$;
+CREATE PROCEDURE p1(prec INT, scale INT, suffix VARCHAR(32))
+BEGIN
+ EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a decimal(',prec,',',scale,')',suffix,')');
+ INSERT IGNORE INTO t1 VALUES (-1e100), (+1e100);
+ CREATE TABLE t2 AS SELECT
+ a,
+ FLOOR(a) AS fa,
+ CEILING(a) AS ca,
+ LENGTH(FLOOR(a)),
+ LENGTH(CEILING(a))
+ FROM t1 ORDER BY a;
+ SHOW CREATE TABLE t2;
+ SELECT * FROM t2;
+ DROP TABLE t2, t1;
+END;
+$$
+DELIMITER ;$$
+
+--vertical_results
+CALL p1(38,10,'');
+CALL p1(28,10,'');
+CALL p1(27,10,'');
+CALL p1(20,10,'');
+CALL p1(19,10,'');
+CALL p1(18,10,'');
+CALL p1(10,10,'');
+
+CALL p1(38,10,' UNSIGNED');
+CALL p1(28,10,' UNSIGNED');
+CALL p1(27,10,' UNSIGNED');
+CALL p1(20,10,' UNSIGNED');
+CALL p1(19,10,' UNSIGNED');
+CALL p1(18,10,' UNSIGNED');
+CALL p1(10,10,' UNSIGNED');
+
+--horizontal_results
+
+DROP PROCEDURE p1;
+
+
+--echo #
+--echo # MDEV-23118 FORMAT(d1,dec) where dec=0/38 and d1 is DECIMAL(38,38) gives incorrect results
+--echo #
+
+--vertical_results
+CREATE OR REPLACE TABLE t1 (a DECIMAL(38,38));
+INSERT INTO t1 VALUES (-0.9999999999999999999999999999999999999), (0.9999999999999999999999999999999999999);
+SELECT a, FORMAT(a,0), FORMAT(a,38) FROM t1;
+CREATE OR REPLACE TABLE t2 AS SELECT a, FORMAT(a,0), FORMAT(a,38) FROM t1;
+SELECT * FROM t2;
+SHOW CREATE TABLE t2;
+DROP TABLE t2,t1;
+--horizontal_results
+
+--echo #
+--echo # End of 10.4 tests
+--echo #
diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result
index 441852fb362..19b162a82cb 100644
--- a/mysql-test/main/win.result
+++ b/mysql-test/main/win.result
@@ -3851,6 +3851,22 @@ ERROR 42000: Too big scale 56 specified for 'rank() over w1'. Maximum is 38
SELECT cast((rank() over w1) as decimal (53,30));
ERROR HY000: Window specification with name 'w1' is not defined
#
+# MDEV-15180: server crashed with NTH_VALUE()
+#
+CREATE TABLE t1 (i1 int, a int);
+INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);
+CREATE VIEW v1 AS (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) ;
+SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1) FROM v1;
+NTH_VALUE(i1, i1) OVER (PARTITION BY i1)
+1
+1
+NULL
+NULL
+DROP VIEW v1;
+DROP TABLE t1,t2;
+#
# End of 10.2 tests
#
#
diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test
index 4b442c03ad6..d8065e15fee 100644
--- a/mysql-test/main/win.test
+++ b/mysql-test/main/win.test
@@ -2506,6 +2506,22 @@ SELECT cast((rank() over w1) as decimal (53,56));
SELECT cast((rank() over w1) as decimal (53,30));
--echo #
+--echo # MDEV-15180: server crashed with NTH_VALUE()
+--echo #
+
+CREATE TABLE t1 (i1 int, a int);
+INSERT INTO t1 VALUES (1, 1), (2, 2),(3, 3);
+
+CREATE TABLE t2 (i2 int);
+INSERT INTO t2 VALUES (1),(2),(5),(1),(7),(4),(3);
+
+CREATE VIEW v1 AS (SELECT * FROM t1,t2 WHERE t1.i1=t2.i2) ;
+SELECT NTH_VALUE(i1, i1) OVER (PARTITION BY i1) FROM v1;
+
+DROP VIEW v1;
+DROP TABLE t1,t2;
+
+--echo #
--echo # End of 10.2 tests
--echo #
diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def
index 8550b2bd180..1e993bca1e9 100644
--- a/mysql-test/suite/galera/disabled.def
+++ b/mysql-test/suite/galera/disabled.def
@@ -15,6 +15,7 @@ GCF-939 : MDEV-21520 galera.GCF-939
MDEV-16509 : MDEV-21523 galera.MDEV-16509
MDEV-20225 : MDEV-20886 galera.MDEV-20225
MW-286 : MDEV-18464 Killing thread can cause mutex deadlock if done concurrently with Galera/replication victim kill
+MW-328A : MDEV-22666 galera.MW-328A MTR failed: "Semaphore wait has lasted > 600 seconds" and do not release port 16002
MW-329 : MDEV-19962 Galera test failure on MW-329
galera.galera_defaults : MDEV-21494 Galera test sporadic failure on galera.galera_defaults
galera_as_slave_replication_bundle : MDEV-15785 OPTION_GTID_BEGIN is set in Gtid_log_event::do_apply_event()
diff --git a/mysql-test/suite/galera/r/galera_bf_lock_wait.result b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
index 723f3e37282..757fbf50cad 100644
--- a/mysql-test/suite/galera/r/galera_bf_lock_wait.result
+++ b/mysql-test/suite/galera/r/galera_bf_lock_wait.result
@@ -6,24 +6,41 @@ connection node_1;
call mtr.add_suppression("WSREP: Trying to continue unpaused monitor");
CREATE TABLE t1 ENGINE=InnoDB select 1 as a, 1 as b union select 2, 2;
ALTER TABLE t1 add primary key(a);
-CREATE PROCEDURE p1()
+CREATE PROCEDURE p1(repeat_count INT)
BEGIN
+DECLARE current_num int;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
-WHILE 1 DO
+SET current_num = 0;
+WHILE current_num < repeat_count DO
start transaction;
update t1 set b=connection_id() where a=1;
commit;
+SET current_num = current_num + 1;
END WHILE;
END|
+connection node_2;
connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-call p1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1;
-call p1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2;
-call p1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2;
-call p1;
+SET SESSION wsrep_sync_wait=0;
+call p1(1000);
connection node_1;
checking error log for 'BF lock wait long' message for 10 times every 10 seconds ...
+connection node_1_p1;
+connection node_1_p2;
+connection node_2_p1;
+connection node_2_p2;
+connection node_1;
drop table t1;
drop procedure p1;
+disconnect node_1_p1;
+disconnect node_1_p2;
+disconnect node_2_p1;
+disconnect node_2_p2;
diff --git a/mysql-test/suite/galera/t/galera_bf_lock_wait.test b/mysql-test/suite/galera/t/galera_bf_lock_wait.test
index a78a94eb1db..0562b4361ff 100644
--- a/mysql-test/suite/galera/t/galera_bf_lock_wait.test
+++ b/mysql-test/suite/galera/t/galera_bf_lock_wait.test
@@ -13,27 +13,39 @@ ALTER TABLE t1 add primary key(a);
DELIMITER |;
-CREATE PROCEDURE p1()
+CREATE PROCEDURE p1(repeat_count INT)
BEGIN
+ DECLARE current_num int;
DECLARE CONTINUE HANDLER FOR SQLEXCEPTION rollback;
- WHILE 1 DO
+ SET current_num = 0;
+
+ WHILE current_num < repeat_count DO
start transaction;
update t1 set b=connection_id() where a=1;
commit;
+ SET current_num = current_num + 1;
END WHILE;
END|
DELIMITER ;|
-
+
+--connection node_2
+--let $wait_condition = SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.ROUTINES WHERE ROUTINE_TYPE = 'PROCEDURE' AND ROUTINE_NAME = 'p1'
+--source include/wait_condition.inc
+
--connect node_1_p1, 127.0.0.1, root, , test, $NODE_MYPORT_1
-send call p1;
+SET SESSION wsrep_sync_wait=0;
+send call p1(1000);
--connect node_1_p2, 127.0.0.1, root, , test, $NODE_MYPORT_1
-send call p1;
+SET SESSION wsrep_sync_wait=0;
+send call p1(1000);
--connect node_2_p1, 127.0.0.1, root, , test, $NODE_MYPORT_2
-send call p1;
+SET SESSION wsrep_sync_wait=0;
+send call p1(1000);
--connect node_2_p2, 127.0.0.1, root, , test, $NODE_MYPORT_2
-send call p1;
+SET SESSION wsrep_sync_wait=0;
+send call p1(1000);
connection node_1;
let $counter=10;
@@ -53,7 +65,26 @@ while($counter > 0)
exec grep 'BF lock wait long' $MYSQLTEST_VARDIR/log/mysqld.*.err;
dec $counter;
}
-
+
+--connection node_1_p1
+--error 0,1213
+--reap
+--connection node_1_p2
+--error 0,1213
+--reap
+--connection node_2_p1
+--error 0,1213
+--reap
+--connection node_2_p2
+--error 0,1213
+--reap
+
+--connection node_1
drop table t1;
drop procedure p1;
+--disconnect node_1_p1
+--disconnect node_1_p2
+--disconnect node_2_p1
+--disconnect node_2_p2
+
diff --git a/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result
index ee49330e892..3f29c7419eb 100644
--- a/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result
+++ b/mysql-test/suite/galera_3nodes/r/galera_pc_bootstrap.result
@@ -1,12 +1,15 @@
connection node_2;
connection node_1;
+call mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\).*");
CREATE TABLE t1 (f1 INTEGER);
connection node_1;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
connection node_2;
+SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3;
connection node_3;
+SET SESSION wsrep_sync_wait=0;
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
SET SESSION wsrep_sync_wait = 0;
connection node_2;
diff --git a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test
index f8381a3324b..ef5bc7dd923 100644
--- a/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test
+++ b/mysql-test/suite/galera_3nodes/t/galera_pc_bootstrap.test
@@ -6,6 +6,8 @@
--source include/galera_cluster.inc
--source include/have_innodb.inc
+call mtr.add_suppression("WSREP: gcs/src/gcs_core.cpp:core_handle_uuid_msg\\(\\).*");
+
CREATE TABLE t1 (f1 INTEGER);
# Force all nodes to become non-primary
@@ -13,13 +15,19 @@ CREATE TABLE t1 (f1 INTEGER);
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
--connection node_2
+SET SESSION wsrep_sync_wait=0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 2 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
+
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
--connect node_3, 127.0.0.1, root, , test, $NODE_MYPORT_3
--connection node_3
-SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
+SET SESSION wsrep_sync_wait=0;
+--let $wait_condition = SELECT VARIABLE_VALUE = 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_size'
+--source include/wait_condition.inc
---sleep 10
+SET GLOBAL wsrep_provider_options = 'gmcast.isolate=1';
# Node #2 should be non-primary
SET SESSION wsrep_sync_wait = 0;
@@ -44,7 +52,7 @@ INSERT INTO t1 VALUES (1);
# Reconnect all nodes
--connection node_2
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
---sleep 10
+
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
@@ -67,7 +75,7 @@ SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
--connection node_3
SET GLOBAL wsrep_provider_options = 'gmcast.isolate=0';
---sleep 10
+
--source include/wait_until_connected_again.inc
--let $wait_condition = SELECT VARIABLE_VALUE = 'Primary' FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_cluster_status';
--source include/wait_condition.inc
diff --git a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
index ffd6c3cab1f..f219625b490 100644
--- a/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
+++ b/mysql-test/suite/wsrep/r/mysql_tzinfo_to_sql_symlink.result
@@ -85,6 +85,15 @@ END IF|
#
# Testing with explicit timezonefile
#
+\d |
+IF (select count(*) from information_schema.global_variables where
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
+ALTER TABLE time_zone ENGINE=InnoDB;
+ALTER TABLE time_zone_name ENGINE=InnoDB;
+ALTER TABLE time_zone_transition ENGINE=InnoDB;
+ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
+END IF|
+\d ;
INSERT INTO time_zone (Use_leap_seconds) VALUES ('N');
SET @time_zone_id= LAST_INSERT_ID();
INSERT INTO time_zone_name (Name, Time_zone_id) VALUES ('XXX', @time_zone_id);
@@ -106,6 +115,15 @@ END IF|
\d |
IF (select count(*) from information_schema.global_variables where
variable_name='wsrep_on' and variable_value='ON') = 1 THEN
+ALTER TABLE time_zone ENGINE=InnoDB;
+ALTER TABLE time_zone_name ENGINE=InnoDB;
+ALTER TABLE time_zone_transition ENGINE=InnoDB;
+ALTER TABLE time_zone_transition_type ENGINE=InnoDB;
+END IF|
+\d ;
+\d |
+IF (select count(*) from information_schema.global_variables where
+variable_name='wsrep_on' and variable_value='ON') = 1 THEN
ALTER TABLE time_zone_leap_second ENGINE=InnoDB;
END IF|
\d ;
diff --git a/sql/item_func.cc b/sql/item_func.cc
index dc1de8a8e9f..8a75d2c9946 100644
--- a/sql/item_func.cc
+++ b/sql/item_func.cc
@@ -2245,35 +2245,54 @@ bool Item_func_bit_neg::fix_length_and_dec()
void Item_func_int_val::fix_length_and_dec_int_or_decimal()
{
+ DBUG_ASSERT(args[0]->cmp_type() == DECIMAL_RESULT);
+ DBUG_ASSERT(args[0]->max_length <= DECIMAL_MAX_STR_LENGTH);
/*
- The INT branch of this code should be revised.
- It creates too large data types, e.g.
- CREATE OR REPLACE TABLE t2 AS SELECT FLOOR(9999999.999) AS fa;
- results in a BININT(10) column, while INT(7) should probably be enough.
+ FLOOR() for negative numbers can increase length: floor(-9.9) -> -10
+ CEILING() for positive numbers can increase length: ceil(9.9) -> 10
*/
- ulonglong tmp_max_length= (ulonglong ) args[0]->max_length -
- (args[0]->decimals ? args[0]->decimals + 1 : 0) + 2;
- max_length= tmp_max_length > (ulonglong) UINT_MAX32 ?
- (uint32) UINT_MAX32 : (uint32) tmp_max_length;
- uint tmp= float_length(decimals);
- set_if_smaller(max_length,tmp);
- decimals= 0;
+ decimal_round_mode mode= round_mode();
+ uint length_increase= args[0]->decimals > 0 &&
+ (mode == CEILING ||
+ (mode == FLOOR && !args[0]->unsigned_flag)) ? 1 : 0;
+ uint precision= args[0]->decimal_int_part() + length_increase;
+ set_if_bigger(precision, 1);
/*
- -2 because in most high position can't be used any digit for longlong
- and one position for increasing value during operation
+ The BIGINT data type can store:
+ UNSIGNED BIGINT: 0..18446744073709551615 - up to 19 digits
+ SIGNED BIGINT: -9223372036854775808..9223372036854775807 - up to 18 digits
+
+ The INT data type can store:
+ UNSIGNED INT: 0..4294967295 - up to 9 digits
+ SIGNED INT: -2147483648..2147483647 - up to 9 digits
*/
- if (args[0]->max_length - args[0]->decimals >= DECIMAL_LONGLONG_DIGITS - 2)
+ if (precision > 18)
{
+ unsigned_flag= args[0]->unsigned_flag;
fix_char_length(
- my_decimal_precision_to_length_no_truncation(
- args[0]->decimal_int_part(), 0, false));
+ my_decimal_precision_to_length_no_truncation(precision, 0,
+ unsigned_flag));
set_handler(&type_handler_newdecimal);
}
else
{
- unsigned_flag= args[0]->unsigned_flag;
- set_handler(type_handler_long_or_longlong());
+ uint sign_length= (unsigned_flag= args[0]->unsigned_flag) ? 0 : 1;
+ fix_char_length(precision + sign_length);
+ if (precision > 9)
+ {
+ if (unsigned_flag)
+ set_handler(&type_handler_ulonglong);
+ else
+ set_handler(&type_handler_slonglong);
+ }
+ else
+ {
+ if (unsigned_flag)
+ set_handler(&type_handler_ulong);
+ else
+ set_handler(&type_handler_slong);
+ }
}
}
diff --git a/sql/item_func.h b/sql/item_func.h
index f39caa46ffd..5b4acdce1c6 100644
--- a/sql/item_func.h
+++ b/sql/item_func.h
@@ -1838,6 +1838,7 @@ public:
Item_func_int_val(THD *thd, Item *a): Item_func_hybrid_field_type(thd, a) {}
bool check_partition_func_processor(void *int_arg) { return FALSE; }
bool check_vcol_func_processor(void *arg) { return FALSE; }
+ virtual decimal_round_mode round_mode() const= 0;
void fix_length_and_dec_double();
void fix_length_and_dec_int_or_decimal();
void fix_length_and_dec_time()
@@ -1866,6 +1867,7 @@ class Item_func_ceiling :public Item_func_int_val
public:
Item_func_ceiling(THD *thd, Item *a): Item_func_int_val(thd, a) {}
const char *func_name() const { return "ceiling"; }
+ decimal_round_mode round_mode() const { return CEILING; }
longlong int_op();
double real_op();
my_decimal *decimal_op(my_decimal *);
@@ -1881,6 +1883,7 @@ class Item_func_floor :public Item_func_int_val
public:
Item_func_floor(THD *thd, Item *a): Item_func_int_val(thd, a) {}
const char *func_name() const { return "floor"; }
+ decimal_round_mode round_mode() const { return FLOOR; }
longlong int_op();
double real_op();
my_decimal *decimal_op(my_decimal *);
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 176a6e6efc9..58f41ecfbbc 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -2642,18 +2642,42 @@ String *Item_func_soundex::val_str(String *str)
This should be 'internationalized' sometimes.
*/
-const int FORMAT_MAX_DECIMALS= 30;
+/*
+ The maximum supported decimal scale:
+ 38 - starting from 10.2.1
+ 30 - before 10.2.1
+*/
+const int FORMAT_MAX_DECIMALS= 38;
bool Item_func_format::fix_length_and_dec()
{
uint32 char_length= args[0]->type_handler()->Item_decimal_notation_int_digits(args[0]);
uint dec= FORMAT_MAX_DECIMALS;
- if (args[1]->const_item() && !args[1]->is_expensive() && !args[1]->null_value)
+ /*
+ Format can require one more integer digit if rounding happens:
+ FORMAT(9.9,0) -> '10'
+ Set need_extra_digit_for_rounding to true by default
+ if args[0] has some decimals: if args[1] is not
+ a constant, then format can potentially reduce
+ the number of decimals and round to the next integer.
+ */
+ bool need_extra_digit_for_rounding= args[0]->decimals > 0;
+ if (args[1]->const_item() && !args[1]->is_expensive())
{
Longlong_hybrid tmp= args[1]->to_longlong_hybrid();
- dec= tmp.to_uint(FORMAT_MAX_DECIMALS);
+ if (!args[1]->null_value)
+ {
+ dec= tmp.to_uint(FORMAT_MAX_DECIMALS);
+ need_extra_digit_for_rounding= (dec < args[0]->decimals);
+ }
}
+ /*
+ In case of a data type with zero integer digits, e.g. DECIMAL(4,4),
+ we'll print at least one integer digit.
+ */
+ if (need_extra_digit_for_rounding || !char_length)
+ char_length++;
uint32 max_sep_count= (char_length / 3) + (dec ? 1 : 0) + /*sign*/1;
collation.set(default_charset());
fix_char_length(char_length + max_sep_count + dec);
@@ -2709,7 +2733,7 @@ String *Item_func_format::val_str_ascii(String *str)
if ((null_value=args[0]->null_value))
return 0; /* purecov: inspected */
nr= my_double_round(nr, (longlong) dec, FALSE, FALSE);
- str->set_real(nr, dec, &my_charset_numeric);
+ str->set_fcvt(nr, dec);
if (!std::isfinite(nr))
return str;
str_length=str->length();
diff --git a/sql/item_subselect.h b/sql/item_subselect.h
index b5823dfb194..7e504d09565 100644
--- a/sql/item_subselect.h
+++ b/sql/item_subselect.h
@@ -149,6 +149,10 @@ public:
Item_subselect(THD *thd);
virtual subs_type substype() { return UNKNOWN_SUBS; }
+ bool is_exists_predicate()
+ {
+ return substype() == Item_subselect::EXISTS_SUBS;
+ }
bool is_in_predicate()
{
return get_IN_subquery() != NULL;
diff --git a/sql/records.cc b/sql/records.cc
index e1766322e2f..900eacf5943 100644
--- a/sql/records.cc
+++ b/sql/records.cc
@@ -350,12 +350,9 @@ bool init_read_record(READ_RECORD *info,THD *thd, TABLE *table,
void end_read_record(READ_RECORD *info)
-{ /* free cache if used */
- if (info->cache)
- {
- my_free_lock(info->cache);
- info->cache=0;
- }
+{
+ /* free cache if used */
+ free_cache(info);
if (info->table)
{
if (info->table->is_created())
@@ -366,6 +363,17 @@ void end_read_record(READ_RECORD *info)
}
}
+
+void free_cache(READ_RECORD *info)
+{
+ if (info->cache)
+ {
+ my_free_lock(info->cache);
+ info->cache=0;
+ }
+}
+
+
static int rr_handle_error(READ_RECORD *info, int error)
{
if (info->thd->killed)
diff --git a/sql/records.h b/sql/records.h
index 04dc06b3c74..272bbd0d9b5 100644
--- a/sql/records.h
+++ b/sql/records.h
@@ -31,6 +31,7 @@ class SORT_INFO;
struct READ_RECORD;
void end_read_record(READ_RECORD *info);
+void free_cache(READ_RECORD *info);
/**
A context for reading through a single table using a chosen access method:
diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt
index 63df3a6b956..79c27a37e6d 100644
--- a/sql/share/errmsg-utf8.txt
+++ b/sql/share/errmsg-utf8.txt
@@ -3244,25 +3244,25 @@ ER_NONEXISTING_GRANT 42000
swe "Det finns inget privilegium definierat för användare '%-.48s' på '%-.64s'"
ukr "Повноважень не визначено для користувача '%-.48s' з хосту '%-.64s'"
ER_TABLEACCESS_DENIED_ERROR 42000
- cze "%-.32s příkaz nepřístupný pro uživatele: '%s'@'%s' pro tabulku '%-.192s'"
- dan "%-.32s-kommandoen er ikke tilladt for brugeren '%s'@'%s' for tabellen '%-.192s'"
- nla "%-.32s commando geweigerd voor gebruiker: '%s'@'%s' voor tabel '%-.192s'"
- eng "%-.32s command denied to user '%s'@'%s' for table '%-.192s'"
- jps "コマンド %-.32s は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません",
- est "%-.32s käsk ei ole lubatud kasutajale '%s'@'%s' tabelis '%-.192s'"
- fre "La commande '%-.32s' est interdite à l'utilisateur: '%s'@'%s' sur la table '%-.192s'"
- ger "%-.32s Befehl nicht erlaubt für Benutzer '%s'@'%s' auf Tabelle '%-.192s'"
- hun "%-.32s parancs a '%s'@'%s' felhasznalo szamara nem engedelyezett a '%-.192s' tablaban"
- ita "Comando %-.32s negato per l'utente: '%s'@'%s' sulla tabella '%-.192s'"
- jpn "コマンド %-.32s は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません"
- kor "'%-.32s' 명령은 다음 사용자에게 거부되었습니다. : '%s'@'%s' for 테이블 '%-.192s'"
- por "Comando '%-.32s' negado para o usuário '%s'@'%s' na tabela '%-.192s'"
- rum "Comanda %-.32s interzisa utilizatorului: '%s'@'%s' pentru tabela '%-.192s'"
- rus "Команда %-.32s запрещена пользователю '%s'@'%s' для таблицы '%-.192s'"
- serbian "%-.32s komanda zabranjena za korisnika '%s'@'%s' za tabelu '%-.192s'"
- spa "%-.32s comando negado para usuario: '%s'@'%s' para tabla '%-.192s'"
- swe "%-.32s ej tillåtet för '%s'@'%s' för tabell '%-.192s'"
- ukr "%-.32s команда заборонена користувачу: '%s'@'%s' у таблиці '%-.192s'"
+ cze "%-.100T příkaz nepřístupný pro uživatele: '%s'@'%s' pro tabulku '%-.192s'"
+ dan "%-.100T-kommandoen er ikke tilladt for brugeren '%s'@'%s' for tabellen '%-.192s'"
+ nla "%-.100T commando geweigerd voor gebruiker: '%s'@'%s' voor tabel '%-.192s'"
+ eng "%-.100T command denied to user '%s'@'%s' for table '%-.192s'"
+ jps "コマンド %-.100T は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません",
+ est "%-.100T käsk ei ole lubatud kasutajale '%s'@'%s' tabelis '%-.192s'"
+ fre "La commande '%-.100T' est interdite à l'utilisateur: '%s'@'%s' sur la table '%-.192s'"
+ ger "%-.100T Befehl nicht erlaubt für Benutzer '%s'@'%s' auf Tabelle '%-.192s'"
+ hun "%-.100T parancs a '%s'@'%s' felhasznalo szamara nem engedelyezett a '%-.192s' tablaban"
+ ita "Comando %-.100T negato per l'utente: '%s'@'%s' sulla tabella '%-.192s'"
+ jpn "コマンド %-.100T は ユーザー '%s'@'%s' ,テーブル '%-.192s' に対して許可されていません"
+ kor "'%-.100T' 명령은 다음 사용자에게 거부되었습니다. : '%s'@'%s' for 테이블 '%-.192s'"
+ por "Comando '%-.100T' negado para o usuário '%s'@'%s' na tabela '%-.192s'"
+ rum "Comanda %-.100T interzisa utilizatorului: '%s'@'%s' pentru tabela '%-.192s'"
+ rus "Команда %-.100T запрещена пользователю '%s'@'%s' для таблицы '%-.192s'"
+ serbian "%-.100T komanda zabranjena za korisnika '%s'@'%s' za tabelu '%-.192s'"
+ spa "%-.100T comando negado para usuario: '%s'@'%s' para tabla '%-.192s'"
+ swe "%-.100T ej tillåtet för '%s'@'%s' för tabell '%-.192s'"
+ ukr "%-.100T команда заборонена користувачу: '%s'@'%s' у таблиці '%-.192s'"
ER_COLUMNACCESS_DENIED_ERROR 42000
cze "%-.32s příkaz nepřístupný pro uživatele: '%s'@'%s' pro sloupec '%-.192s' v tabulce '%-.192s'"
dan "%-.32s-kommandoen er ikke tilladt for brugeren '%s'@'%s' for kolonne '%-.192s' in tabellen '%-.192s'"
diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc
index a65acc2c87e..37def6df7ed 100644
--- a/sql/sql_lex.cc
+++ b/sql/sql_lex.cc
@@ -2812,8 +2812,17 @@ int Lex_input_stream::scan_ident_delimited(THD *thd,
uchar c;
DBUG_ASSERT(m_ptr == m_tok_start + 1);
- while ((c= yyGet()))
+ for ( ; ; )
{
+ if (!(c= yyGet()))
+ {
+ /*
+ End-of-query or straight 0x00 inside a delimited identifier.
+ Return the quote character, to have the parser fail on syntax error.
+ */
+ m_ptr= (char *) m_tok_start + 1;
+ return quote_char;
+ }
int var_length= cs->charlen(get_ptr() - 1, get_end_of_query());
if (var_length == 1)
{
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index b0c4db47494..5dbe01c5044 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -13885,24 +13885,7 @@ void JOIN::cleanup(bool full)
for (tab= first_linear_tab(this, WITH_BUSH_ROOTS, WITH_CONST_TABLES); tab;
tab= next_linear_tab(this, tab, WITH_BUSH_ROOTS))
{
- if (!tab->table)
- continue;
- DBUG_PRINT("info", ("close index: %s.%s alias: %s",
- tab->table->s->db.str,
- tab->table->s->table_name.str,
- tab->table->alias.c_ptr()));
- if (tab->table->is_created())
- {
- tab->table->file->ha_index_or_rnd_end();
- if (tab->aggr)
- {
- int tmp= 0;
- if ((tmp= tab->table->file->extra(HA_EXTRA_NO_CACHE)))
- tab->table->file->print_error(tmp, MYF(0));
- }
- }
- delete tab->filesort_result;
- tab->filesort_result= NULL;
+ tab->partial_cleanup();
}
}
}
@@ -29035,6 +29018,40 @@ void JOIN::handle_implicit_grouping_with_window_funcs()
}
+
+/*
+ @brief
+ Perform a partial cleanup for the JOIN_TAB structure
+
+ @note
+ this is used to cleanup resources for the re-execution of correlated
+ subqueries.
+*/
+void JOIN_TAB::partial_cleanup()
+{
+ if (!table)
+ return;
+
+ if (table->is_created())
+ {
+ table->file->ha_index_or_rnd_end();
+ DBUG_PRINT("info", ("close index: %s.%s alias: %s",
+ table->s->db.str,
+ table->s->table_name.str,
+ table->alias.c_ptr()));
+ if (aggr)
+ {
+ int tmp= 0;
+ if ((tmp= table->file->extra(HA_EXTRA_NO_CACHE)))
+ table->file->print_error(tmp, MYF(0));
+ }
+ }
+ delete filesort_result;
+ filesort_result= NULL;
+ free_cache(&read_record);
+}
+
+
/**
@brief
Look for provision of the select_handler interface by a foreign engine
diff --git a/sql/sql_select.h b/sql/sql_select.h
index 545db41798c..7c8908302cd 100644
--- a/sql/sql_select.h
+++ b/sql/sql_select.h
@@ -673,6 +673,8 @@ typedef struct st_join_table {
bool use_order() const; ///< Use ordering provided by chosen index?
bool sort_table();
bool remove_duplicates();
+
+ void partial_cleanup();
void add_keyuses_for_splitting();
SplM_plan_info *choose_best_splitting(double record_count,
table_map remaining_tables);
diff --git a/sql/sql_show.cc b/sql/sql_show.cc
index 6dd013d929e..0d41857aaf5 100644
--- a/sql/sql_show.cc
+++ b/sql/sql_show.cc
@@ -4620,7 +4620,7 @@ fill_schema_table_by_open(THD *thd, MEM_ROOT *mem_root,
Again we don't do this for SHOW COLUMNS/KEYS because
of backward compatibility.
*/
- if (!is_show_fields_or_keys && result &&
+ if (!is_show_fields_or_keys && result && thd->is_error() &&
(thd->get_stmt_da()->sql_errno() == ER_NO_SUCH_TABLE ||
thd->get_stmt_da()->sql_errno() == ER_WRONG_OBJECT ||
thd->get_stmt_da()->sql_errno() == ER_NOT_SEQUENCE))
@@ -5932,12 +5932,12 @@ static int get_schema_column_record(THD *thd, TABLE_LIST *tables,
I.e. we are in SELECT FROM INFORMATION_SCHEMA.COLUMS
rather than in SHOW COLUMNS
*/
- convert_error_to_warning(thd);
+ if (thd->is_error())
+ convert_error_to_warning(thd);
res= 0;
}
DBUG_RETURN(res);
}
-
show_table= tables->table;
count= 0;
ptr= show_table->field;
diff --git a/sql/sql_string.cc b/sql/sql_string.cc
index 030075aa793..e2defba434d 100644
--- a/sql/sql_string.cc
+++ b/sql/sql_string.cc
@@ -183,6 +183,17 @@ bool Binary_string::set_hex(const char *str, uint32 len)
}
+bool Binary_string::set_fcvt(double num, uint decimals)
+{
+ // Assert that `decimals` is small enough to fit into FLOATING_POINT_BUFFER
+ DBUG_ASSERT(decimals < DECIMAL_NOT_SPECIFIED);
+ if (alloc(FLOATING_POINT_BUFFER))
+ return true;
+ length(my_fcvt(num, decimals, Ptr, NULL));
+ return false;
+}
+
+
bool String::set_real(double num,uint decimals, CHARSET_INFO *cs)
{
char buff[FLOATING_POINT_BUFFER];
diff --git a/sql/sql_string.h b/sql/sql_string.h
index 37e9c40db61..2ef817ea0ad 100644
--- a/sql/sql_string.h
+++ b/sql/sql_string.h
@@ -524,6 +524,7 @@ public:
bool set_hex(ulonglong num);
bool set_hex(const char *str, uint32 len);
+ bool set_fcvt(double num, uint decimals);
bool copy(); // Alloc string if not alloced
bool copy(const Binary_string &s); // Allocate new string
@@ -781,6 +782,11 @@ public:
bool set(longlong num, CHARSET_INFO *cs) { return set_int(num, false, cs); }
bool set(ulonglong num, CHARSET_INFO *cs) { return set_int((longlong)num, true, cs); }
bool set_real(double num,uint decimals, CHARSET_INFO *cs);
+ bool set_fcvt(double num, uint decimals)
+ {
+ set_charset(&my_charset_latin1);
+ return Binary_string::set_fcvt(num, decimals);
+ }
bool set_hex(ulonglong num)
{
diff --git a/sql/sql_type.cc b/sql/sql_type.cc
index 593062646ce..9e0f9b013c0 100644
--- a/sql/sql_type.cc
+++ b/sql/sql_type.cc
@@ -4647,6 +4647,7 @@ bool Type_handler_temporal_result::
Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
Item **items, uint nitems) const
{
+ DBUG_ASSERT(func->field_type() != MYSQL_TYPE_DATE);
bool rc= Type_handler::Item_func_min_max_fix_attributes(thd, func,
items, nitems);
bool is_time= func->field_type() == MYSQL_TYPE_TIME;
@@ -4701,7 +4702,6 @@ bool Type_handler_temporal_result::
DATETIME DATETIME no conversion
DATETIME TIMESTAMP safe conversion
DATETIME DATE safe conversion
- DATE DATE no conversion
TIME TIME no conversion
Note, a function cannot return TIMESTAMP if it has non-TIMESTAMP
@@ -4718,9 +4718,6 @@ bool Type_handler_temporal_result::
-------------------- ------------- -------
TIMESTAMP TIME Not possible
DATETIME TIME depends on OLD_MODE_ZERO_DATE_TIME_CAST
- DATE TIMESTAMP Not possible
- DATE DATETIME Not possible
- DATE TIME Not possible
TIME TIMESTAMP Not possible
TIME DATETIME Not possible
TIME DATE Not possible
@@ -4743,6 +4740,30 @@ bool Type_handler_temporal_result::
}
+bool Type_handler_date_common::
+ Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
+ Item **items, uint nitems) const
+{
+ func->fix_attributes_date();
+ if (func->maybe_null)
+ return false;
+ /*
+ We cannot trust the generic maybe_null value calculated during fix_fields().
+ If a conversion from non-temoral types to DATE happens,
+ then the result can be NULL (even if all arguments are not NULL).
+ */
+ for (uint i= 0; i < nitems; i++)
+ {
+ if (items[i]->type_handler()->cmp_type() != TIME_RESULT)
+ {
+ func->maybe_null= true;
+ break;
+ }
+ }
+ return false;
+}
+
+
bool Type_handler_real_result::
Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
Item **items, uint nitems) const
diff --git a/sql/sql_type.h b/sql/sql_type.h
index 02abd55680d..a6d85b5bb47 100644
--- a/sql/sql_type.h
+++ b/sql/sql_type.h
@@ -6145,8 +6145,11 @@ public:
const char *name,
Type_handler_hybrid_field_type *,
Type_all_attributes *atrr,
- Item **items, uint nitems)
- const override;
+ Item **items, uint nitems) const
+ override;
+ bool Item_func_min_max_fix_attributes(THD *thd, Item_func_min_max *func,
+ Item **items, uint nitems) const
+ override;
void Item_param_set_param_func(Item_param *param,
uchar **pos, ulong len) const override;
};
diff --git a/sql/sql_union.cc b/sql/sql_union.cc
index 3360c3c18cb..f1df76508d7 100644
--- a/sql/sql_union.cc
+++ b/sql/sql_union.cc
@@ -1,5 +1,5 @@
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
- Copyright (c) 2010, 2017, Corporation
+ Copyright (c) 2010, 2020, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -1364,6 +1364,25 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
found_rows_for_union= first_sl->options & OPTION_FOUND_ROWS;
is_union_select= is_unit_op() || fake_select_lex || single_tvc;
+ /*
+ If we are reading UNION output and the UNION is in the
+ IN/ANY/ALL/EXISTS subquery, then ORDER BY is redundant and hence should
+ be removed.
+ Example:
+ select ... col IN (select col2 FROM t1 union select col3 from t2 ORDER BY 1)
+
+ (as for ORDER BY ... LIMIT, it currently not supported inside
+ IN/ALL/ANY subqueries)
+ (For non-UNION this removal of ORDER BY clause is done in
+ check_and_do_in_subquery_rewrites())
+ */
+ if (item && is_unit_op() &&
+ (item->is_in_predicate() || item->is_exists_predicate()))
+ {
+ global_parameters()->order_list.first= NULL;
+ global_parameters()->order_list.elements= 0;
+ }
+
/* will only optimize once */
if (!bag_set_op_optimized && !is_recursive)
{
@@ -1390,6 +1409,7 @@ bool st_select_lex_unit::prepare(TABLE_LIST *derived_arg,
break;
}
}
+
/* Global option */
if (is_union_select || is_recursive)
diff --git a/sql/table.h b/sql/table.h
index 7ce6db5b193..7edf1e68a0b 100644
--- a/sql/table.h
+++ b/sql/table.h
@@ -1388,9 +1388,16 @@ public:
/* number of select if it is derived table */
uint derived_select_number;
/*
- 0 or JOIN_TYPE_{LEFT|RIGHT}. Currently this is only compared to 0.
- If maybe_null !=0, this table is inner w.r.t. some outer join operation,
- and null_row may be true.
+ Possible values:
+ - 0 by default
+ - JOIN_TYPE_{LEFT|RIGHT} if the table is inner w.r.t an outer join
+ operation
+ - 1 if the SELECT has mixed_implicit_grouping=1. example:
+ select max(col1), col2 from t1. In this case, the query produces
+ one row with all columns having NULL values.
+
+ Interpetation: If maybe_null!=0, all fields of the table are considered
+ NULLable (and have NULL values when null_row=true)
*/
uint maybe_null;
int current_lock; /* Type of lock on table */
diff --git a/sql/tztime.cc b/sql/tztime.cc
index b1c0c79d5d7..4546f2291cd 100644
--- a/sql/tztime.cc
+++ b/sql/tztime.cc
@@ -2719,6 +2719,7 @@ main(int argc, char **argv)
}
if (opt_skip_write_binlog)
+ {
/* If skip_write_binlog is set and wsrep is compiled in we disable
sql_log_bin and wsrep_on to avoid Galera replicating below
truncate table clauses. This will allow user to set different
@@ -2726,15 +2727,9 @@ main(int argc, char **argv)
printf("set @prep1=if((select count(*) from information_schema.global_variables where variable_name='wsrep_on' and variable_value='ON'), 'SET SESSION SQL_LOG_BIN=?, WSREP_ON=OFF;', 'do ?');\n"
"prepare set_wsrep_write_binlog from @prep1;\n"
"set @toggle=0; execute set_wsrep_write_binlog using @toggle;\n");
-
- if (argc == 1 && !opt_leap)
+ }
+ else
{
- /* Argument is timezonedir */
-
- root_name_end= strmake_buf(fullname, argv[0]);
-
- if(!opt_skip_write_binlog)
- {
// Alter time zone tables to InnoDB if wsrep_on is enabled
// to allow changes to them to replicate with Galera
printf("\\d |\n"
@@ -2746,7 +2741,13 @@ main(int argc, char **argv)
"ALTER TABLE time_zone_transition_type ENGINE=InnoDB;\n"
"END IF|\n"
"\\d ;\n");
- }
+ }
+
+ if (argc == 1 && !opt_leap)
+ {
+ /* Argument is timezonedir */
+
+ root_name_end= strmake_buf(fullname, argv[0]);
printf("TRUNCATE TABLE time_zone;\n");
printf("TRUNCATE TABLE time_zone_name;\n");
diff --git a/storage/innobase/fil/fil0crypt.cc b/storage/innobase/fil/fil0crypt.cc
index c08f1eedc33..6f9f1c2c17c 100644
--- a/storage/innobase/fil/fil0crypt.cc
+++ b/storage/innobase/fil/fil0crypt.cc
@@ -41,9 +41,6 @@ Modified Jan Lindström jan.lindstrom@mariadb.com
#include "fil0pagecompress.h"
#include <my_crypt.h>
-/** Mutex for keys */
-static ib_mutex_t fil_crypt_key_mutex;
-
static bool fil_crypt_threads_inited = false;
/** Is encryption enabled/disabled */
@@ -105,8 +102,6 @@ UNIV_INTERN
void
fil_space_crypt_init()
{
- mutex_create(LATCH_ID_FIL_CRYPT_MUTEX, &fil_crypt_key_mutex);
-
fil_crypt_throttle_sleep_event = os_event_create(0);
mutex_create(LATCH_ID_FIL_CRYPT_STAT_MUTEX, &crypt_stat_mutex);
@@ -120,7 +115,6 @@ void
fil_space_crypt_cleanup()
{
os_event_destroy(fil_crypt_throttle_sleep_event);
- mutex_free(&fil_crypt_key_mutex);
mutex_free(&crypt_stat_mutex);
}
@@ -1455,6 +1449,94 @@ fil_crypt_return_iops(
fil_crypt_update_total_stat(state);
}
+/** Return the next tablespace from rotation_list.
+@param space previous tablespace (NULL to start from the start)
+@param recheck whether the removal condition needs to be rechecked after
+the encryption parameters were changed
+@param encrypt expected state of innodb_encrypt_tables
+@return the next tablespace to process (n_pending_ops incremented)
+@retval NULL if this was the last */
+inline fil_space_t *fil_system_t::keyrotate_next(fil_space_t *space,
+ bool recheck, bool encrypt)
+{
+ ut_ad(mutex_own(&mutex));
+
+ sized_ilist<fil_space_t, rotation_list_tag_t>::iterator it=
+ space ? space : rotation_list.begin();
+ const sized_ilist<fil_space_t, rotation_list_tag_t>::iterator end=
+ rotation_list.end();
+
+ if (space)
+ {
+ while (++it != end && (!UT_LIST_GET_LEN(it->chain) || it->is_stopping()));
+
+ /* If one of the encryption threads already started the encryption
+ of the table then don't remove the unencrypted spaces from rotation list
+
+ If there is a change in innodb_encrypt_tables variables value then
+ don't remove the last processed tablespace from the rotation list. */
+ space->release();
+
+ if (!space->referenced() &&
+ (!recheck || space->crypt_data) && !encrypt == !srv_encrypt_tables &&
+ space->is_in_rotation_list)
+ {
+ ut_a(!rotation_list.empty());
+ rotation_list.remove(*space);
+ space->is_in_rotation_list= false;
+ }
+ }
+
+ if (it == end)
+ return NULL;
+
+ space= &*it;
+ space->acquire();
+ return space;
+}
+
+/** Return the next tablespace.
+@param space previous tablespace (NULL to start from the beginning)
+@param recheck whether the removal condition needs to be rechecked after
+the encryption parameters were changed
+@param encrypt expected state of innodb_encrypt_tables
+@return pointer to the next tablespace (with n_pending_ops incremented)
+@retval NULL if this was the last */
+static fil_space_t *fil_space_next(fil_space_t *space, bool recheck,
+ bool encrypt)
+{
+ mutex_enter(&fil_system.mutex);
+
+ if (!srv_fil_crypt_rotate_key_age)
+ space= fil_system.keyrotate_next(space, recheck, encrypt);
+ else if (!space)
+ {
+ space= UT_LIST_GET_FIRST(fil_system.space_list);
+ /* We can trust that space is not NULL because at least the
+ system tablespace is always present and loaded first. */
+ space->acquire();
+ }
+ else
+ {
+ /* Move on to the next fil_space_t */
+ space->release();
+ space= UT_LIST_GET_NEXT(space_list, space);
+
+ /* Skip abnormal tablespaces or those that are being created by
+ fil_ibd_create(), or being dropped. */
+ while (space &&
+ (UT_LIST_GET_LEN(space->chain) == 0 ||
+ space->is_stopping() || space->purpose != FIL_TYPE_TABLESPACE))
+ space= UT_LIST_GET_NEXT(space_list, space);
+
+ if (space)
+ space->acquire();
+ }
+
+ mutex_exit(&fil_system.mutex);
+ return space;
+}
+
/** Search for a space needing rotation
@param[in,out] key_state Key state
@param[in,out] state Rotation state
@@ -1487,13 +1569,8 @@ static bool fil_crypt_find_space_to_rotate(
state->space = NULL;
}
- /* If key rotation is enabled (default) we iterate all tablespaces.
- If key rotation is not enabled we iterate only the tablespaces
- added to keyrotation list. */
- state->space = srv_fil_crypt_rotate_key_age
- ? fil_space_next(state->space)
- : fil_system.keyrotate_next(state->space, *recheck,
- key_state->key_version);
+ state->space = fil_space_next(state->space, *recheck,
+ key_state->key_version != 0);
while (!state->should_shutdown() && state->space) {
/* If there is no crypt data and we have not yet read
@@ -1511,13 +1588,16 @@ static bool fil_crypt_find_space_to_rotate(
return true;
}
- state->space = srv_fil_crypt_rotate_key_age
- ? fil_space_next(state->space)
- : fil_system.keyrotate_next(state->space, *recheck,
- key_state->key_version);
+ state->space = fil_space_next(state->space, *recheck,
+ key_state->key_version != 0);
+ }
+
+ if (state->space) {
+ state->space->release();
+ state->space = NULL;
}
- /* if we didn't find any space return iops */
+ /* no work to do; release our allocation of I/O capacity */
fil_crypt_return_iops(state);
return false;
@@ -2172,13 +2252,11 @@ static void fil_crypt_rotation_list_fill()
if (!space->size) {
/* Protect the tablespace while we may
release fil_system.mutex. */
- space->n_pending_ops++;
-#ifndef DBUG_OFF
+ ut_d(space->acquire());
ut_d(const fil_space_t* s=)
fil_system.read_page0(space->id);
ut_ad(!s || s == space);
-#endif
- space->n_pending_ops--;
+ ut_d(space->release());
if (!space->size) {
/* Page 0 was not loaded.
Skip this tablespace. */
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index cca2d0b93b7..5e6bd9575b1 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -4395,120 +4395,6 @@ test_make_filepath()
#endif /* UNIV_ENABLE_UNIT_TEST_MAKE_FILEPATH */
/* @} */
-/** Return the next fil_space_t.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_t::acquire() and fil_space_t::release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system.space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
-fil_space_t*
-fil_space_next(fil_space_t* prev_space)
-{
- fil_space_t* space=prev_space;
-
- mutex_enter(&fil_system.mutex);
-
- if (!space) {
- space = UT_LIST_GET_FIRST(fil_system.space_list);
- } else {
- ut_a(space->referenced());
-
- /* Move on to the next fil_space_t */
- space->release();
- space = UT_LIST_GET_NEXT(space_list, space);
- }
-
- /* Skip spaces that are being created by
- fil_ibd_create(), or dropped, or !tablespace. */
- while (space != NULL
- && (UT_LIST_GET_LEN(space->chain) == 0
- || space->is_stopping()
- || space->purpose != FIL_TYPE_TABLESPACE)) {
- space = UT_LIST_GET_NEXT(space_list, space);
- }
-
- if (space != NULL) {
- space->acquire();
- }
-
- mutex_exit(&fil_system.mutex);
-
- return(space);
-}
-
-/**
-Remove space from key rotation list if there are no more
-pending operations.
-@param[in,out] space Tablespace */
-static
-void
-fil_space_remove_from_keyrotation(fil_space_t* space)
-{
- ut_ad(mutex_own(&fil_system.mutex));
- ut_ad(space);
-
- if (!space->referenced() && space->is_in_rotation_list) {
- space->is_in_rotation_list = false;
- ut_a(!fil_system.rotation_list.empty());
- fil_system.rotation_list.remove(*space);
- }
-}
-
-
-/** Return the next fil_space_t from key rotation list.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_t::acquire() and fil_space_t::release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system.space_list.
-@param[in] recheck recheck of the tablespace is needed or
- still encryption thread does write page0 for it
-@param[in] key_version key version of the key state thread
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last */
-fil_space_t *fil_system_t::keyrotate_next(fil_space_t *prev_space,
- bool recheck, uint key_version)
-{
- mutex_enter(&fil_system.mutex);
-
- /* If one of the encryption threads already started the encryption
- of the table then don't remove the unencrypted spaces from rotation list
-
- If there is a change in innodb_encrypt_tables variables value then
- don't remove the last processed tablespace from the rotation list. */
- const bool remove= (!recheck || prev_space->crypt_data) &&
- !key_version == !srv_encrypt_tables;
- sized_ilist<fil_space_t, rotation_list_tag_t>::iterator it=
- prev_space ? prev_space : fil_system.rotation_list.end();
-
- if (it == fil_system.rotation_list.end())
- it= fil_system.rotation_list.begin();
- else
- {
- /* Move on to the next fil_space_t */
- prev_space->release();
-
- ++it;
-
- while (it != fil_system.rotation_list.end() &&
- (UT_LIST_GET_LEN(it->chain) == 0 || it->is_stopping()))
- ++it;
-
- if (remove)
- fil_space_remove_from_keyrotation(prev_space);
- }
-
- fil_space_t *space= it == fil_system.rotation_list.end() ? NULL : &*it;
-
- if (space)
- space->acquire();
-
- mutex_exit(&fil_system.mutex);
- return space;
-}
-
/** Determine the block size of the data file.
@param[in] space tablespace
@param[in] offset page number
diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h
index a29f1e9fe4c..9ea5de0a125 100644
--- a/storage/innobase/include/fil0fil.h
+++ b/storage/innobase/include/fil0fil.h
@@ -1308,24 +1308,15 @@ public:
@retval NULL if the tablespace does not exist or cannot be read */
fil_space_t* read_page0(ulint id);
- /** Return the next fil_space_t from key rotation list.
- Once started, the caller must keep calling this until it returns NULL.
- fil_space_acquire() and fil_space_t::release() are invoked here, which
- blocks a concurrent operation from dropping the tablespace.
- @param[in] prev_space Previous tablespace or NULL to start
- from beginning of fil_system->rotation
- list
- @param[in] recheck recheck of the tablespace is needed or
- still encryption thread does write page0
- for it
- @param[in] key_version key version of the key state thread
- If NULL, use the first fil_space_t on fil_system->space_list.
- @return pointer to the next fil_space_t.
- @retval NULL if this was the last */
- fil_space_t* keyrotate_next(
- fil_space_t* prev_space,
- bool remove,
- uint key_version);
+ /** Return the next tablespace from rotation_list.
+ @param space previous tablespace (NULL to start from the start)
+ @param recheck whether the removal condition needs to be rechecked after
+ the encryption parameters were changed
+ @param encrypt expected state of innodb_encrypt_tables
+ @return the next tablespace to process (n_pending_ops incremented)
+ @retval NULL if this was the last */
+ inline fil_space_t* keyrotate_next(fil_space_t *space, bool recheck,
+ bool encrypt);
};
/** The tablespace memory cache. */
@@ -1493,33 +1484,6 @@ when it could be dropped concurrently.
fil_space_t*
fil_space_acquire_for_io(ulint id);
-/** Return the next fil_space_t.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_t::release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in,out] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system.space_list.
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last */
-fil_space_t*
-fil_space_next(
- fil_space_t* prev_space)
- MY_ATTRIBUTE((warn_unused_result));
-
-/** Return the next fil_space_t from key rotation list.
-Once started, the caller must keep calling this until it returns NULL.
-fil_space_acquire() and fil_space_t::release() are invoked here which
-blocks a concurrent operation from dropping the tablespace.
-@param[in,out] prev_space Pointer to the previous fil_space_t.
-If NULL, use the first fil_space_t on fil_system.space_list.
-@param[in] remove Whether to remove the previous tablespace from
- the rotation list
-@return pointer to the next fil_space_t.
-@retval NULL if this was the last*/
-fil_space_t*
-fil_space_keyrotate_next(fil_space_t* prev_space, bool remove)
- MY_ATTRIBUTE((warn_unused_result));
-
/** Replay a file rename operation if possible.
@param[in] space_id tablespace identifier
@param[in] name old file name
diff --git a/storage/innobase/include/sync0types.h b/storage/innobase/include/sync0types.h
index 160c0ff0e82..a4584937e70 100644
--- a/storage/innobase/include/sync0types.h
+++ b/storage/innobase/include/sync0types.h
@@ -357,7 +357,6 @@ enum latch_id_t {
LATCH_ID_SCRUB_STAT_MUTEX,
LATCH_ID_DEFRAGMENT_MUTEX,
LATCH_ID_BTR_DEFRAGMENT_MUTEX,
- LATCH_ID_FIL_CRYPT_MUTEX,
LATCH_ID_FIL_CRYPT_STAT_MUTEX,
LATCH_ID_FIL_CRYPT_DATA_MUTEX,
LATCH_ID_FIL_CRYPT_THREADS_MUTEX,
diff --git a/storage/innobase/lock/lock0lock.cc b/storage/innobase/lock/lock0lock.cc
index 53d79b75a35..2c888f55b69 100644
--- a/storage/innobase/lock/lock0lock.cc
+++ b/storage/innobase/lock/lock0lock.cc
@@ -730,7 +730,7 @@ lock_rec_has_to_wait(
/* if BF thread is locking and has conflict with another BF
thread, we need to look at trx ordering and lock types */
if (wsrep_thd_is_BF(trx->mysql_thd, FALSE)
- && wsrep_thd_is_BF(lock2->trx->mysql_thd, TRUE)) {
+ && wsrep_thd_is_BF(lock2->trx->mysql_thd, FALSE)) {
mtr_t mtr;
if (UNIV_UNLIKELY(wsrep_debug)) {
@@ -1078,7 +1078,7 @@ wsrep_kill_victim(
return;
}
- my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE);
+ my_bool bf_other = wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE);
mtr_t mtr;
if ((!bf_other) ||
@@ -1402,7 +1402,7 @@ lock_rec_create_low(
lock_t *hash = (lock_t *)c_lock->hash;
lock_t *prev = NULL;
- while (hash && wsrep_thd_is_BF(hash->trx->mysql_thd, TRUE)
+ while (hash && wsrep_thd_is_BF(hash->trx->mysql_thd, FALSE)
&& wsrep_thd_order_before(hash->trx->mysql_thd,
trx->mysql_thd)) {
prev = hash;
@@ -1798,11 +1798,9 @@ lock_rec_add_to_queue(
= lock_rec_other_has_expl_req(
mode, block, false, heap_no, trx);
#ifdef WITH_WSREP
- //ut_a(!other_lock || (wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
- // wsrep_thd_is_BF(other_lock->trx->mysql_thd, TRUE)));
if (other_lock && trx->is_wsrep() &&
!wsrep_thd_is_BF(trx->mysql_thd, FALSE) &&
- !wsrep_thd_is_BF(other_lock->trx->mysql_thd, TRUE)) {
+ !wsrep_thd_is_BF(other_lock->trx->mysql_thd, FALSE)) {
ib::info() << "WSREP BF lock conflict for my lock:\n BF:" <<
((wsrep_thd_is_BF(trx->mysql_thd, FALSE)) ? "BF" : "normal") << " exec: " <<
@@ -2013,6 +2011,7 @@ lock_rec_has_to_wait_in_queue(
ulint bit_offset;
hash_table_t* hash;
+ ut_ad(wait_lock);
ut_ad(lock_mutex_own());
ut_ad(lock_get_wait(wait_lock));
ut_ad(lock_get_type_low(wait_lock) == LOCK_REC);
@@ -2027,9 +2026,11 @@ lock_rec_has_to_wait_in_queue(
hash = lock_hash_get(wait_lock->type_mode);
for (lock = lock_rec_get_first_on_page_addr(hash, space, page_no);
+#ifdef WITH_WSREP
+ lock &&
+#endif
lock != wait_lock;
lock = lock_rec_get_next_on_page_const(lock)) {
-
const byte* p = (const byte*) &lock[1];
if (heap_no < lock_rec_get_n_bits(lock)
@@ -2037,7 +2038,8 @@ lock_rec_has_to_wait_in_queue(
&& lock_has_to_wait(wait_lock, lock)) {
#ifdef WITH_WSREP
if (wsrep_thd_is_BF(wait_lock->trx->mysql_thd, FALSE) &&
- wsrep_thd_is_BF(lock->trx->mysql_thd, TRUE)) {
+ wsrep_thd_is_BF(lock->trx->mysql_thd, FALSE)) {
+
if (UNIV_UNLIKELY(wsrep_debug)) {
mtr_t mtr;
ib::info() << "WSREP: waiting BF trx: " << ib::hex(wait_lock->trx->id)
@@ -6565,7 +6567,7 @@ DeadlockChecker::select_victim() const
/* The joining transaction is 'smaller',
choose it as the victim and roll it back. */
#ifdef WITH_WSREP
- if (wsrep_thd_is_BF(m_start->mysql_thd, TRUE)) {
+ if (wsrep_thd_is_BF(m_start->mysql_thd, FALSE)) {
return(m_wait_lock->trx);
}
#endif /* WITH_WSREP */
@@ -6573,7 +6575,7 @@ DeadlockChecker::select_victim() const
}
#ifdef WITH_WSREP
- if (wsrep_thd_is_BF(m_wait_lock->trx->mysql_thd, TRUE)) {
+ if (wsrep_thd_is_BF(m_wait_lock->trx->mysql_thd, FALSE)) {
return(m_start);
}
#endif /* WITH_WSREP */
diff --git a/storage/innobase/sync/sync0debug.cc b/storage/innobase/sync/sync0debug.cc
index b0c45a01dbf..9297819a35b 100644
--- a/storage/innobase/sync/sync0debug.cc
+++ b/storage/innobase/sync/sync0debug.cc
@@ -1449,8 +1449,6 @@ sync_latch_meta_init()
PFS_NOT_INSTRUMENTED);
LATCH_ADD_MUTEX(BTR_DEFRAGMENT_MUTEX, SYNC_NO_ORDER_CHECK,
PFS_NOT_INSTRUMENTED);
- LATCH_ADD_MUTEX(FIL_CRYPT_MUTEX, SYNC_NO_ORDER_CHECK,
- PFS_NOT_INSTRUMENTED);
LATCH_ADD_MUTEX(FIL_CRYPT_STAT_MUTEX, SYNC_NO_ORDER_CHECK,
PFS_NOT_INSTRUMENTED);
LATCH_ADD_MUTEX(FIL_CRYPT_DATA_MUTEX, SYNC_NO_ORDER_CHECK,
diff --git a/strings/decimal.c b/strings/decimal.c
index 59e60e0a328..9dae3d987f2 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -812,6 +812,24 @@ internal_str2dec(const char *from, decimal_t *to, char **end, my_bool fixed)
while (s < end_of_string && my_isdigit(&my_charset_latin1, *s))
s++;
intg= (int) (s-s1);
+ /*
+ If the integer part is long enough and it has multiple leading zeros,
+ let's trim them, so this expression can return 1 without overflowing:
+ CAST(CONCAT(REPEAT('0',90),'1') AS DECIMAL(10))
+ */
+ if (intg > DIG_PER_DEC1 && s1[0] == '0' && s1[1] == '0')
+ {
+ /*
+ Keep at least one digit, to avoid an empty string.
+ So we trim '0000' to '0' rather than to ''.
+ Otherwise the below code (converting digits to to->buf)
+ would fail on a fatal error.
+ */
+ const char *iend= s - 1;
+ for ( ; s1 < iend && *s1 == '0'; s1++)
+ { }
+ intg= (int) (s-s1);
+ }
if (s < end_of_string && *s=='.')
{
endp= s+1;
diff --git a/vio/vio.c b/vio/vio.c
index cabed39d94f..7a98eb2af7b 100644
--- a/vio/vio.c
+++ b/vio/vio.c
@@ -78,6 +78,7 @@ static my_bool has_no_data(Vio *vio __attribute__((unused)))
#ifdef _WIN32
int vio_pipe_shutdown(Vio *vio, int how)
{
+ vio->shutdown_flag= how;
return CancelIoEx(vio->hPipe, NULL);
}
#endif
diff --git a/vio/viopipe.c b/vio/viopipe.c
index 567884807fe..aeaad311b7e 100644
--- a/vio/viopipe.c
+++ b/vio/viopipe.c
@@ -75,6 +75,9 @@ size_t vio_read_pipe(Vio *vio, uchar *buf, size_t count)
size_t ret= (size_t) -1;
DBUG_ENTER("vio_read_pipe");
+ if (vio->shutdown_flag)
+ return ret;
+
disable_iocp_notification(&vio->overlapped);
/* Attempt to read from the pipe (overlapped I/O). */
@@ -85,8 +88,11 @@ size_t vio_read_pipe(Vio *vio, uchar *buf, size_t count)
}
/* Read operation is pending completion asynchronously? */
else if (GetLastError() == ERROR_IO_PENDING)
+ {
+ if (vio->shutdown_flag)
+ CancelIo(vio->hPipe);
ret= wait_overlapped_result(vio, vio->read_timeout);
-
+ }
enable_iocp_notification(&vio->overlapped);
DBUG_RETURN(ret);
@@ -99,6 +105,8 @@ size_t vio_write_pipe(Vio *vio, const uchar *buf, size_t count)
size_t ret= (size_t) -1;
DBUG_ENTER("vio_write_pipe");
+ if (vio->shutdown_flag == SHUT_RDWR)
+ return ret;
disable_iocp_notification(&vio->overlapped);
/* Attempt to write to the pipe (overlapped I/O). */
if (WriteFile(vio->hPipe, buf, (DWORD)count, &transferred, &vio->overlapped))
@@ -108,8 +116,11 @@ size_t vio_write_pipe(Vio *vio, const uchar *buf, size_t count)
}
/* Write operation is pending completion asynchronously? */
else if (GetLastError() == ERROR_IO_PENDING)
+ {
+ if (vio->shutdown_flag == SHUT_RDWR)
+ CancelIo(vio->hPipe);
ret= wait_overlapped_result(vio, vio->write_timeout);
-
+ }
enable_iocp_notification(&vio->overlapped);
DBUG_RETURN(ret);
}
@@ -129,7 +140,6 @@ int vio_close_pipe(Vio *vio)
BOOL ret;
DBUG_ENTER("vio_close_pipe");
- CancelIo(vio->hPipe);
CloseHandle(vio->overlapped.hEvent);
ret= CloseHandle(vio->hPipe);