diff --git a/cmake/Internal/CPack/CPackRPM.cmake b/cmake/Internal/CPack/CPackRPM.cmake index 2729667e319..4e3af5ed4c2 100644 --- a/cmake/Internal/CPack/CPackRPM.cmake +++ b/cmake/Internal/CPack/CPackRPM.cmake @@ -2,6 +2,11 @@ # Wrapper for CPackRPM.cmake # +IF(NOT DEFINED RPM_RECOMMENDS) + EXECUTE_PROCESS(COMMAND rpm --recommends ERROR_QUIET RESULT_VARIABLE RPM_RECOMMENDS) + MESSAGE("CPackRPM:Debug: Testing rpm --recommends: ${RPM_RECOMMENDS}") +ENDIF() + # # Support for per-component LICENSE and VENDOR # @@ -47,6 +52,20 @@ if (acc) file(WRITE ${${base_var}} "${acc}") endif() +# +# Support for the Recommends: tag. +# We don't use Suggests: so here he hijack Suggests: variable +# to implement Recommends: +# +IF (CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS) + IF (RPM_RECOMMENDS EQUAL 0) # exit code 0 means ok + SET(TMP_RPM_SUGGESTS "Recommends: ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS}") + ELSE() # rpm is too old to recommend + SET(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_REQUIRES + "${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_REQUIRES} ${CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_RECOMMENDS}") + ENDIF() +ENDIF() + # load the original CPackRPM.cmake set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) unset(CMAKE_MODULE_PATH) diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index e0d2aac163e..4d3b2af575e 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -30,7 +30,6 @@ SET(HAVE_BACKTRACE_SYMBOLS CACHE INTERNAL "") SET(HAVE_BACKTRACE_SYMBOLS_FD CACHE INTERNAL "") SET(HAVE_BFILL CACHE INTERNAL "") SET(HAVE_BSD_SIGNALS CACHE INTERNAL "") -SET(HAVE_BSS_START CACHE INTERNAL "") SET(HAVE_CLOCK_GETTIME CACHE INTERNAL "") SET(HAVE_COMPRESS CACHE INTERNAL "") SET(HAVE_CRYPT CACHE INTERNAL "") diff --git a/config.h.cmake b/config.h.cmake index 5cced0f646f..ff0a039b3ac 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -242,7 +242,6 @@ /* Symbols we may use */ #cmakedefine HAVE_SYS_ERRLIST 1 /* used by stacktrace functions */ -#cmakedefine HAVE_BSS_START 1 #cmakedefine HAVE_BACKTRACE 1 #cmakedefine HAVE_BACKTRACE_SYMBOLS 1 #cmakedefine HAVE_BACKTRACE_SYMBOLS_FD 1 diff --git a/configure.cmake b/configure.cmake index deef3c5f366..8533b8ee0b2 100644 --- a/configure.cmake +++ b/configure.cmake @@ -795,14 +795,6 @@ CHECK_CXX_SOURCE_COMPILES(" HAVE_ABI_CXA_DEMANGLE) ENDIF() -CHECK_C_SOURCE_COMPILES(" - int main(int argc, char **argv) - { - extern char *__bss_start; - return __bss_start ? 1 : 0; - }" -HAVE_BSS_START) - CHECK_C_SOURCE_COMPILES(" int main() { diff --git a/debian/additions/mariadb.conf.d/99-enable-encryption.cnf.preset b/debian/additions/mariadb.conf.d/99-enable-encryption.cnf.preset deleted file mode 120000 index 53e8f5c645c..00000000000 --- a/debian/additions/mariadb.conf.d/99-enable-encryption.cnf.preset +++ /dev/null @@ -1 +0,0 @@ -../../../support-files/rpm/enable_encryption.preset \ No newline at end of file diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index 4417f18ded0..0d6234c584a 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -50,12 +50,10 @@ then sed "/Package: libmariadbd-dev/,/^$/d" -i debian/control fi -# Convert gcc version to numberical value. Format is Mmmpp where M is Major -# version, mm is minor version and p is patch. -# -dumpfullversion & -dumpversion to make it uniform across old and new (>=7) -GCCVERSION=$(gcc -dumpfullversion -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' \ - -e 's/\.\([0-9]\)/0\1/g' \ - -e 's/^[0-9]\{3,4\}$/&00/') +if [[ $(arch) =~ i[346]86 ]] +then + sed "/Package: mariadb-plugin-rocksdb/,/^$/d" -i debian/control +fi # If rocksdb-tools is not available (before Debian Buster and Ubuntu Disco) # remove the dependency from the RocksDB plugin so it can install properly diff --git a/debian/control b/debian/control index 68f0c88da3b..7100e322df6 100644 --- a/debian/control +++ b/debian/control @@ -31,6 +31,7 @@ Build-Depends: bison, libnuma-dev [!armhf], libpam0g-dev, libpcre2-dev, + libreadline-gplv2-dev [i386 amd64], libsnappy-dev, libssl-dev | libssl1.0-dev, libsystemd-dev [linux-any], @@ -277,37 +278,23 @@ Conflicts: mariadb-client-10.0, mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1, - mysql-client-5.5 (<< ${source:Version}), + mysql-client-5.5, mysql-client-core-5.1, mysql-client-core-5.5, mysql-client-core-5.6, mysql-client-core-5.7, mysql-client-core-8.0, virtual-mysql-client-core -Replaces: mariadb-client-10.0, - mariadb-client-10.1, - mariadb-client-10.2, - mariadb-client-10.3, - mariadb-client-10.4, - mariadb-client-10.5, - mariadb-client-10.6 (<< ${source:Version}), - mariadb-client-5.1, - mariadb-client-5.2, - mariadb-client-5.3, - mariadb-client-5.5, +Replaces: mariadb-client-core-5.1, + mariadb-client-core-5.2, + mariadb-client-core-5.3, + mariadb-client-core-5.5, mariadb-client-core-10.0, mariadb-client-core-10.1, mariadb-client-core-10.2, mariadb-client-core-10.3, mariadb-client-core-10.4, - mariadb-client-core-5.1, - mariadb-client-core-5.2, - mariadb-client-core-5.3, - mariadb-client-core-5.5, - mysql-client (<< 5.0.51), - mysql-client-5.0, - mysql-client-5.1, - mysql-client-5.5, + mariadb-client-core-10.5, mysql-client-core-5.1, mysql-client-core-5.5, mysql-client-core-5.6, @@ -352,54 +339,29 @@ Conflicts: mariadb-client (<< ${source:Version}), mysql-client-5.7, mysql-client-8.0, mysql-client-core-5.0, - mysql-client-core-5.1 (<< ${source:Version}), - mysql-client-core-5.5 (<< ${source:Version}), - mysql-client-core-5.6 (<< ${source:Version}), - mysql-client-core-5.7 (<< ${source:Version}), - mysql-client-core-8.0 (<< ${source:Version}), + mysql-client-core-5.1, + mysql-client-core-5.5, + mysql-client-core-5.6, + mysql-client-core-5.7, + mysql-client-core-8.0, mytop, virtual-mysql-client -Breaks: mariadb-client-core-10.0, - mariadb-client-core-10.1, - mariadb-client-core-10.2, - mariadb-client-core-10.3, - mariadb-client-core-10.4, - mariadb-client-core-10.5, - mariadb-client-core-10.6 (<< ${source:Version}) -Replaces: mariadb-client (<< ${source:Version}), +Replaces: mariadb-client-5.1, + mariadb-client-5.2, + mariadb-client-5.3, + mariadb-client-5.5, mariadb-client-10.0, mariadb-client-10.1, mariadb-client-10.2, mariadb-client-10.3, mariadb-client-10.4, mariadb-client-10.5, - mariadb-client-10.6 (<< ${source:Version}), - mariadb-client-5.1, - mariadb-client-5.2, - mariadb-client-5.3, - mariadb-client-5.5, - mariadb-client-core-10.0, - mariadb-client-core-10.1, - mariadb-client-core-10.2, - mariadb-client-core-10.3, - mariadb-client-core-10.4, - mariadb-client-core-10.5, - mariadb-client-core-10.6 (<< ${source:Version}), - mariadb-server-10.5, - mariadb-server-10.6 (<< ${source:Version}), - mysql-client (<< 5.0.51), mysql-client-5.0, mysql-client-5.1, mysql-client-5.5, mysql-client-5.6, mysql-client-5.7, mysql-client-8.0, - mysql-client-core-5.0, - mysql-client-core-5.1 (<< ${source:Version}), - mysql-client-core-5.5 (<< ${source:Version}), - mysql-client-core-5.6 (<< ${source:Version}), - mysql-client-core-5.7 (<< ${source:Version}), - mysql-client-core-8.0 (<< ${source:Version}), mytop, virtual-mysql-client Provides: default-mysql-client, @@ -438,44 +400,16 @@ Conflicts: mariadb-server-core-10.0, mysql-server-core-5.7, mysql-server-core-8.0, virtual-mysql-server-core -Breaks: mariadb-client-10.0, - mariadb-client-10.1, - mariadb-client-10.2, - mariadb-client-10.3, - mariadb-client-10.4, - mariadb-client-10.5, - mariadb-client-10.6 (<< ${source:Version}), - mariadb-server-10.3, - mariadb-server-10.4, - mariadb-server-10.5, - mariadb-server-10.6 (<< ${source:Version}), - mysql-server-5.6, - mysql-server-5.7, - mysql-server-8.0 -Replaces: mariadb-client-10.0, - mariadb-client-10.1, - mariadb-client-10.2, - mariadb-client-10.3, - mariadb-client-10.4, - mariadb-client-10.5, - mariadb-client-10.6 (<< ${source:Version}), - mariadb-server-10.3, - mariadb-server-10.4, - mariadb-server-10.5, - mariadb-server-10.6 (<< ${source:Version}), +Replaces: mariadb-server-core-5.1, + mariadb-server-core-5.2, + mariadb-server-core-5.3, + mariadb-server-core-5.5, mariadb-server-core-10.0, mariadb-server-core-10.1, mariadb-server-core-10.2, mariadb-server-core-10.3, mariadb-server-core-10.4, - mariadb-server-core-5.1, - mariadb-server-core-5.2, - mariadb-server-core-5.3, - mariadb-server-core-5.5, - mysql-server-5.0, - mysql-server-5.6, - mysql-server-5.7, - mysql-server-8.0, + mariadb-server-core-10.5, mysql-server-core-5.0, mysql-server-core-5.1, mysql-server-core-5.5, @@ -529,11 +463,11 @@ Conflicts: mariadb-server (<< ${source:Version}), mariadb-server-5.2, mariadb-server-5.3, mariadb-server-5.5, - mysql-client-5.5 (<< ${source:Version}), - mysql-client-5.6 (<< ${source:Version}), - mysql-client-5.7 (<< ${source:Version}), - mysql-client-8.0 (<< ${source:Version}), - mysql-server (<< ${source:Version}), + mysql-client-5.5, + mysql-client-5.6, + mysql-client-5.7, + mysql-client-8.0, + mysql-server, mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, @@ -542,25 +476,16 @@ Conflicts: mariadb-server (<< ${source:Version}), mysql-server-5.7, mysql-server-8.0, virtual-mysql-server -Replaces: libmariadbclient-dev (<< 5.5.0), - libmariadbclient16, - mariadb-client-10.5, - mariadb-client-10.6 (<< ${source:Version}), - mariadb-server (<< ${source:Version}), +Replaces: mariadb-server-5.1, + mariadb-server-5.2, + mariadb-server-5.3, + mariadb-server-5.5, mariadb-server-10.0, mariadb-server-10.1, mariadb-server-10.2, mariadb-server-10.3, mariadb-server-10.4, - mariadb-server-5.1, - mariadb-server-5.2, - mariadb-server-5.3, - mariadb-server-5.5, - mysql-client-5.5 (<< ${source:Version}), - mysql-client-5.6 (<< ${source:Version}), - mysql-client-5.7 (<< ${source:Version}), - mysql-client-8.0 (<< ${source:Version}), - mysql-server (<< ${source:Version}), + mariadb-server-10.5, mysql-server-4.1, mysql-server-5.0, mysql-server-5.1, @@ -812,32 +737,18 @@ Depends: mariadb-client-10.6 (= ${binary:Version}), ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Breaks: mariadb-server-5.5, +Breaks: mariadb-test-5.5, mariadb-test-10.0, mariadb-test-10.1, mariadb-test-10.2, mariadb-test-10.3, mariadb-test-10.4, - mariadb-test-5.5, - mysql-server-5.7, - mysql-testsuite, - mysql-testsuite-5.5, - mysql-testsuite-5.6, - mysql-testsuite-5.7, - mysql-testsuite-8.0 -Replaces: mariadb-server-5.5, +Replaces: mariadb-test-5.5, mariadb-test-10.0, mariadb-test-10.1, mariadb-test-10.2, mariadb-test-10.3, mariadb-test-10.4, - mariadb-test-5.5, - mysql-server-5.7, - mysql-testsuite, - mysql-testsuite-5.5, - mysql-testsuite-5.6, - mysql-testsuite-5.7, - mysql-testsuite-8.0, virtual-mysql-testsuite Provides: virtual-mysql-testsuite Suggests: patch @@ -855,21 +766,23 @@ Multi-Arch: foreign Depends: ${misc:Depends}, ${perl:Depends}, ${shlibs:Depends} -Breaks: mariadb-test-10.0, - mariadb-test-10.1, - mariadb-test-10.2, - mariadb-test-5.5, +Breaks: mariadb-test-data-5.5, mariadb-test-data-10.0, + mariadb-test-data-10.1, + mariadb-test-data-10.2, + mariadb-test-data-10.3, + mariadb-test-data-10.4, mysql-testsuite, mysql-testsuite-5.5, mysql-testsuite-5.6, mysql-testsuite-5.7, mysql-testsuite-8.0 -Replaces: mariadb-test-10.0, - mariadb-test-10.1, - mariadb-test-10.2, - mariadb-test-5.5, +Replaces: mariadb-test-data-5.5, mariadb-test-data-10.0, + mariadb-test-data-10.1, + mariadb-test-data-10.2, + mariadb-test-data-10.3, + mariadb-test-data-10.4, mysql-testsuite, mysql-testsuite-5.5, mysql-testsuite-5.6, diff --git a/debian/mariadb-server-10.6.install b/debian/mariadb-server-10.6.install index 6bebde6ef3b..883c0b9f0aa 100644 --- a/debian/mariadb-server-10.6.install +++ b/debian/mariadb-server-10.6.install @@ -3,6 +3,7 @@ debian/additions/debian-start.inc.sh usr/share/mysql debian/additions/echo_stderr usr/share/mysql debian/additions/mariadb.conf.d/50-mysqld_safe.cnf etc/mysql/mariadb.conf.d debian/additions/mariadb.conf.d/50-server.cnf etc/mysql/mariadb.conf.d +support-files/rpm/enable_encryption.preset etc/mysql/mariadb.conf.d/99-enable-encryption.cnf.preset debian/additions/source_mariadb-10.6.py usr/share/apport/package-hooks etc/apparmor.d/usr.sbin.mariadbd etc/security/user_map.conf diff --git a/debian/rules b/debian/rules index 0684cbfd05a..aa5c7b1b6e0 100755 --- a/debian/rules +++ b/debian/rules @@ -45,7 +45,7 @@ endif # RocksDB cannot build on 32-bit platforms ifeq (32,$(DEB_HOST_ARCH_BITS)) - CMAKEFLAGS += -DWITHOUT_ROCKSDB=true + CMAKEFLAGS += -DPLUGIN_ROCKSDB=NO endif # ColumnStore only attempts to build on a few platforms as dictated by CMake checks diff --git a/include/violite.h b/include/violite.h index 6d09621bea6..b018f57c7da 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; void *tp_ctx; /* threadpool context */ #endif }; diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 57b468c7245..9dddc8a8990 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -114,6 +114,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/sql_explain.cc ../sql/sql_explain.h ../sql/sql_analyze_stmt.cc ../sql/sql_analyze_stmt.h ../sql/compat56.cc + ../sql/sql_schema.cc ../sql/sql_type.cc ../sql/sql_type.h ../sql/sql_mode.cc ../sql/sql_type_string.cc diff --git a/man/mysql_upgrade.1 b/man/mysql_upgrade.1 index 311d8ab0e2b..c60c0a208bf 100644 --- a/man/mysql_upgrade.1 +++ b/man/mysql_upgrade.1 @@ -1,6 +1,6 @@ '\" t .\" -.TH "\FBMYSQL_UPGRADE\FR" "1" "15 May 2020" "MariaDB 10\&.6" "MariaDB Database System" +.TH "\FBMYSQL_UPGRADE\FR" "1" "20 July 2020" "MariaDB 10\&.6" "MariaDB Database System" .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- @@ -165,6 +165,8 @@ in the data directory\&. This is used to quickly check whether all tables have b \fB\-\-force\fR option\&. .PP +For this reason, \fBmysql_upgrade\fR needs to be run as a user with write access to the data directory\&. +.PP If you install MariaDB from RPM packages on Linux, you must install the server and client RPMs\&. \fBmysql_upgrade\fR is included in the server RPM but requires the client RPM because the latter includes 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/create.result b/mysql-test/main/create.result index f863070c646..802c41af05d 100644 --- a/mysql-test/main/create.result +++ b/mysql-test/main/create.result @@ -2011,5 +2011,21 @@ CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAI Warnings: Warning 1280 Name 'foo' ignored for PRIMARY key. DROP TABLE t1; +# +# 10.4 Test +# +# MDEV-21017: Assertion `!is_set() || (m_status == DA_OK_BULK && +# is_bulk_op())' failed or late ER_PERIOD_FIELD_WRONG_ATTRIBUTES +# upon attempt to create existing table +# +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED, +e DATE, PERIOD FOR app(s,e)); +ERROR HY000: Period field `s` cannot be GENERATED ALWAYS AS +UNLOCK TABLES; +DROP TABLE t1; +# End of 10.4 Test CREATE TABLE t1 (id1 INT, id2 INT, primary key (id1), unique index (id2) visible); drop table t1; +# End of 10.5 Test diff --git a/mysql-test/main/create.test b/mysql-test/main/create.test index af12425f107..33f51f19944 100644 --- a/mysql-test/main/create.test +++ b/mysql-test/main/create.test @@ -1873,9 +1873,30 @@ drop table t1; CREATE TABLE t1 ( id1 INT, id2 INT, CONSTRAINT `foo` PRIMARY KEY (id1), CONSTRAINT `bar` UNIQUE KEY(id2)); DROP TABLE t1; +--echo # +--echo # 10.4 Test +--echo # +--echo # MDEV-21017: Assertion `!is_set() || (m_status == DA_OK_BULK && +--echo # is_bulk_op())' failed or late ER_PERIOD_FIELD_WRONG_ATTRIBUTES +--echo # upon attempt to create existing table +--echo # +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; + +--error ER_PERIOD_FIELD_WRONG_ATTRIBUTES +CREATE TABLE IF NOT EXISTS t1 (s DATE GENERATED ALWAYS AS ('2000-01-01') STORED, +e DATE, PERIOD FOR app(s,e)); + +UNLOCK TABLES; +DROP TABLE t1; + +--echo # End of 10.4 Test + # # MDEV-22199 Add VISIBLE option for indexes in create table # CREATE TABLE t1 (id1 INT, id2 INT, primary key (id1), unique index (id2) visible); drop table t1; + +--echo # End of 10.5 Test 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 ec4a14c4a23..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 # # @@ -32,5 +39,70 @@ EXECUTE IMMEDIATE _latin1 0x01; ERROR 42000: You@0020have@0020an@0020error@0020in@0020your@0020SQL@0020syntax@003b@0020check@0020the@0020manual@0020that@0020corresponds@0020to@0020your@0020MariaDB@0020server@0020version@0020for@0020the@0020right@0020syntax@0020to@0020use@0020near@0020@0027@005c0001@0027@0020at@0020line@00201 SET NAMES utf8; # +# MDEV-23435 Functions do not convert numbers to character_set_results +# +SET NAMES utf8, character_set_results=filename; +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'); +SELECT a, COALESCE(a) AS c FROM t1; +a c +2001@002d01@002d01@002000@003a00@003a00@002e000000 2001@002d01@002d01@002000@003a00@003a00@002e000000 +DROP TABLE t1; +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('00:00:00.000000'); +SELECT a, COALESCE(a) AS c FROM t1; +a c +00@003a00@003a00@002e000000 00@003a00@003a00@002e000000 +DROP TABLE t1; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'); +SELECT a, COALESCE(a) AS c FROM t1; +a c +2001@002d01@002d01 2001@002d01@002d01 +DROP TABLE t1; +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +a c +@002d1 @002d1 +DROP TABLE t1; +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +a c +@002d1 @002d1 +DROP TABLE t1; +CREATE TABLE t1 (a MEDIUMINT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +a c +@002d1 @002d1 +DROP TABLE t1; +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +a c +@002d1 @002d1 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(10.2)); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +a c +@002d1 @002d1 +DROP TABLE t1; +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +a c +@002d1 @002d1 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +a c +@002d1 @002d1 +DROP TABLE t1; +SET NAMES utf8; +# # End of 10.5 tests # diff --git a/mysql-test/main/ctype_filename.test b/mysql-test/main/ctype_filename.test index bd82714ca0e..17ab71e3985 100644 --- a/mysql-test/main/ctype_filename.test +++ b/mysql-test/main/ctype_filename.test @@ -29,6 +29,16 @@ SET NAMES utf8; SELECT @a:=CONVERT('aя' USING filename) AS `@a`, BINARY @a, REVERSE(@a), HEX(@a), HEX(REVERSE(@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 # @@ -42,6 +52,68 @@ SET NAMES filename; EXECUTE IMMEDIATE _latin1 0x01; SET NAMES utf8; +--echo # +--echo # MDEV-23435 Functions do not convert numbers to character_set_results +--echo # + +--disable_ps_protocol + +SET NAMES utf8, character_set_results=filename; + +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES ('2001-01-01 00:00:00.000000'); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('00:00:00.000000'); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TINYINT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a SMALLINT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a MEDIUMINT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a BIGINT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(10.2)); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (-1); +SELECT a, COALESCE(a) AS c FROM t1; +DROP TABLE t1; + +SET NAMES utf8; + +--enable_ps_protocol + --echo # --echo # End of 10.5 tests 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_crypt.result b/mysql-test/main/func_crypt.result index aaa6aa61eae..2c42d3dc845 100644 --- a/mysql-test/main/func_crypt.result +++ b/mysql-test/main/func_crypt.result @@ -214,3 +214,4 @@ SELECT * FROM t1; a b hello 12NKz5XM5JeKI DROP TABLE t1; +# End of 10.2 tests diff --git a/mysql-test/main/func_crypt.test b/mysql-test/main/func_crypt.test index d091aa4ae86..118a7023669 100644 --- a/mysql-test/main/func_crypt.test +++ b/mysql-test/main/func_crypt.test @@ -120,3 +120,5 @@ SHOW CREATE TABLE t1; INSERT INTO t1 (a) VALUES ('hello'); SELECT * FROM t1; DROP TABLE t1; + +--echo # End of 10.2 tests diff --git a/mysql-test/main/func_des_encrypt.result b/mysql-test/main/func_des_encrypt.result index b81f96f6ef7..540596589b6 100644 --- a/mysql-test/main/func_des_encrypt.result +++ b/mysql-test/main/func_des_encrypt.result @@ -35,3 +35,41 @@ DES_DECRYPT(DES_ENCRYPT('1234')) DES_DECRYPT(DES_ENCRYPT('12345')) DES_DECRYPT(D 1234 12345 123456 1234567 DROP TABLE t1; End of 5.0 tests +# +# MDEV-23330 Server crash or ASAN negative-size-param in +# my_strnncollsp_binary / SORT_FIELD_ATTR::compare_packed_varstrings +# +CREATE TABLE t1 (a CHAR(240), b BIT(48)); +INSERT INTO t1 VALUES ('a',b'0001'),('b',b'0010'),('c',b'0011'),('d',b'0100'),('e',b'0001'),('f',b'0101'),('g',b'0110'),('h',b'0111'),('i',b'1000'),('j',b'1001'); +SELECT DES_DECRYPT(a, 'x'), HEX(BINARY b) FROM t1 GROUP BY 1, 2 WITH ROLLUP; +DES_DECRYPT(a, 'x') HEX(BINARY b) +a 000000000001 +a NULL +b 000000000002 +b NULL +c 000000000003 +c NULL +d 000000000004 +d NULL +e 000000000001 +e NULL +f 000000000005 +f NULL +g 000000000006 +g NULL +h 000000000007 +h NULL +i 000000000008 +i NULL +j 000000000009 +j NULL +NULL NULL +DROP TABLE t1; +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2); +SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS t2; +CHAR_LENGTH(a) DES_DECRYPT(a) +1 +1 +DROP TABLE t1; +End of 10.5 tests diff --git a/mysql-test/main/func_des_encrypt.test b/mysql-test/main/func_des_encrypt.test index c9661b81cc0..44fc30ff00f 100644 --- a/mysql-test/main/func_des_encrypt.test +++ b/mysql-test/main/func_des_encrypt.test @@ -37,3 +37,24 @@ SELECT DROP TABLE t1; --Echo End of 5.0 tests + +--echo # +--echo # MDEV-23330 Server crash or ASAN negative-size-param in +--echo # my_strnncollsp_binary / SORT_FIELD_ATTR::compare_packed_varstrings +--echo # + +CREATE TABLE t1 (a CHAR(240), b BIT(48)); +INSERT INTO t1 VALUES ('a',b'0001'),('b',b'0010'),('c',b'0011'),('d',b'0100'),('e',b'0001'),('f',b'0101'),('g',b'0110'),('h',b'0111'),('i',b'1000'),('j',b'1001'); +SELECT DES_DECRYPT(a, 'x'), HEX(BINARY b) FROM t1 GROUP BY 1, 2 WITH ROLLUP; +DROP TABLE t1; + +# +# don't change the charset of a literal Item_string +# + +CREATE TABLE t1 (a INT); +INSERT t1 VALUES (1),(2); +SELECT CHAR_LENGTH(a), DES_DECRYPT(a) FROM (SELECT _utf8 0xC2A2 AS a FROM t1) AS t2; +DROP TABLE t1; + +--Echo End of 10.5 tests diff --git a/mysql-test/main/func_group.result b/mysql-test/main/func_group.result index 1fc92ba90cc..9233393fd94 100644 --- a/mysql-test/main/func_group.result +++ b/mysql-test/main/func_group.result @@ -1186,13 +1186,13 @@ i count(*) std(e1/e2) 3 4 0.00000000 select std(s1/s2) from bug22555; std(s1/s2) -0.21325764 +0.21328517 select std(o1/o2) from bug22555; std(o1/o2) 0.2132576358664934 select std(e1/e2) from bug22555; std(e1/e2) -0.21325764 +0.21328517 set @saved_div_precision_increment=@@div_precision_increment; set div_precision_increment=19; select i, count(*), std(s1/s2) from bug22555 group by i order by i; diff --git a/mysql-test/main/func_math.result b/mysql-test/main/func_math.result index 97f66476919..5da1ab02159 100644 --- a/mysql-test/main/func_math.result +++ b/mysql-test/main/func_math.result @@ -348,7 +348,6 @@ truncate(4, cast(-2 as unsigned)) truncate(4, 18446744073709551614) truncate(4, 4 4 0 Warnings: Note 1105 Cast to unsigned converted negative integer to it's positive complement -Note 1105 Cast to unsigned converted negative integer to it's positive complement select round(10000000000000000000, -19), truncate(10000000000000000000, -19); round(10000000000000000000, -19) truncate(10000000000000000000, -19) 10000000000000000000 10000000000000000000 @@ -1081,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 @@ -1091,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 @@ -1102,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 @@ -1113,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 @@ -1124,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 @@ -1135,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 @@ -1146,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 @@ -1157,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 @@ -1168,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 @@ -1179,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 @@ -1190,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 @@ -1201,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 @@ -1212,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 @@ -1223,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 @@ -1234,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 @@ -1245,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 @@ -1256,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 @@ -1267,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 @@ -1278,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 @@ -1289,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 @@ -1300,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 @@ -1311,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 @@ -1322,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 @@ -1334,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 @@ -1344,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 @@ -1355,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 @@ -1366,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 @@ -1377,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 @@ -1388,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 @@ -1399,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 @@ -1410,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 @@ -1423,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 @@ -1433,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 @@ -1444,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 @@ -1455,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 @@ -1466,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 @@ -1477,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 @@ -1488,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 @@ -1499,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 @@ -1510,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 @@ -1521,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 @@ -1532,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 @@ -1543,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 @@ -1554,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 @@ -1565,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 @@ -1576,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 @@ -1588,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 @@ -1598,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 @@ -1609,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 @@ -1620,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 @@ -1631,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 @@ -1642,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 @@ -1653,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 @@ -1664,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 @@ -1675,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 @@ -1686,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 @@ -1697,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 @@ -1708,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 @@ -1719,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 @@ -1730,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 @@ -1741,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 @@ -1784,7 +1783,7 @@ ROUND(10e0,NULL) AS c3; SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( - `c1` double DEFAULT NULL, + `c1` int(2) DEFAULT NULL, `c2` double DEFAULT NULL, `c3` double DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 @@ -2296,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); @@ -2306,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); @@ -2318,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); @@ -3550,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 @@ -2259,6 +2259,31 @@ SELECT * FROM t1; 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/grant5.result b/mysql-test/main/grant5.result index 2cc1c11f7d8..972131a24b7 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -25,6 +25,19 @@ ERROR HY000: Table 'procs_priv' was not locked with LOCK TABLES REVOKE PROCESS ON *.* FROM u; ERROR HY000: Table 'db' was not locked with LOCK TABLES DROP TABLE t1; +create database mysqltest1; +use mysqltest1; +create table t1(id int); +insert t1 values(2); +create user u1@localhost; +grant select on mysqltest1.t1 to u1@localhost; +grant update on mysqltest1.* to u1@localhost; +connect u1, localhost, u1; +update mysqltest1.t1 set id=1 where id=2; +connection default; +disconnect u1; +drop user u1@localhost; +drop database mysqltest1; # # MDEV-20076: SHOW GRANTS does not quote role names properly # diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 054b16c0a6e..e133108516e 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -34,6 +34,27 @@ REVOKE EXECUTE ON PROCEDURE sp FROM u; REVOKE PROCESS ON *.* FROM u; DROP TABLE t1; +# +# MDEV-23010 UPDATE privilege at Database and Table level fail to update with SELECT command denied to user +# +create database mysqltest1; +use mysqltest1; +create table t1(id int); +insert t1 values(2); +create user u1@localhost; +grant select on mysqltest1.t1 to u1@localhost; +grant update on mysqltest1.* to u1@localhost; +connect u1, localhost, u1; +update mysqltest1.t1 set id=1 where id=2; +connection default; +disconnect u1; +drop user u1@localhost; +drop database mysqltest1; + +# +# End of 10.1 tests +# + --echo # --echo # MDEV-20076: SHOW GRANTS does not quote role names properly --echo # diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index fcc437f8c60..9f36ba35a22 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -2219,6 +2219,26 @@ 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 seq_1_to_100 LIMIT ROWS EXAMINED 10; +seq +1 +2 +3 +4 +5 +6 +7 +Warnings: +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..9c77606b9d4 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -17,6 +17,8 @@ --source include/default_optimizer_switch.inc --source include/default_charset.inc +--source include/have_sequence.inc + set global sql_mode=""; set local sql_mode=""; @@ -1921,6 +1923,18 @@ 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 # + +SELECT * FROM seq_1_to_100 LIMIT ROWS EXAMINED 10; + +--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/lowercase_fs_off.result b/mysql-test/main/lowercase_fs_off.result index 6ff8c1b7f93..3e9aa7cc239 100644 --- a/mysql-test/main/lowercase_fs_off.result +++ b/mysql-test/main/lowercase_fs_off.result @@ -158,3 +158,13 @@ show triggers like '%T1%'; Trigger Event Table Statement Timing Created sql_mode Definer character_set_client collation_connection Database Collation drop table t1; set GLOBAL sql_mode=default; +# +# MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode +# +# Compatibility schema names respect the filesystem case sensitivity +CREATE TABLE t1 (a MARIADB_SCHEMA.date); +ERROR HY000: Unknown data type: 'MARIADB_SCHEMA.date' +CREATE TABLE t1 (a Mariadb_schema.date); +ERROR HY000: Unknown data type: 'Mariadb_schema.date' +CREATE TABLE t1 (a mariadb_schema.date); +DROP TABLE t1; diff --git a/mysql-test/main/lowercase_fs_off.test b/mysql-test/main/lowercase_fs_off.test index f828773ed06..879a1eabc25 100644 --- a/mysql-test/main/lowercase_fs_off.test +++ b/mysql-test/main/lowercase_fs_off.test @@ -130,3 +130,18 @@ let $datadir= `select @@datadir`; remove_file $datadir/mysql_upgrade_info; set GLOBAL sql_mode=default; + + +--echo # +--echo # MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode +--echo # + +--echo # Compatibility schema names respect the filesystem case sensitivity + +--error ER_UNKNOWN_DATA_TYPE +CREATE TABLE t1 (a MARIADB_SCHEMA.date); +--error ER_UNKNOWN_DATA_TYPE +CREATE TABLE t1 (a Mariadb_schema.date); + +CREATE TABLE t1 (a mariadb_schema.date); +DROP TABLE t1; 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/named_pipe.test b/mysql-test/main/named_pipe.test index 8e0136d06a9..3f01b415fc5 100644 --- a/mysql-test/main/named_pipe.test +++ b/mysql-test/main/named_pipe.test @@ -27,3 +27,4 @@ let $MYSQLD_DATADIR= `select @@datadir`; let SEARCH_FILE=$MYSQLD_DATADIR/second-mysqld.err; let SEARCH_PATTERN=\[ERROR\] Create named pipe failed; source include/search_pattern_in_file.inc; +remove_file $SEARCH_FILE; diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index bcadd02f224..4379db411aa 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -4097,6 +4097,16 @@ Y B A DROP TABLE t1; +# +# MDEV-23414 Assertion `res->charset() == item->collation.collation' failed in Type_handler_string_result::make_packed_sort_key_part +# +CREATE TABLE t1 (a CHAR(3), b BINARY(255)); +INSERT t1 VALUES ('foo','bar'),('baz','qux'); +SELECT COALESCE(a, b) AS f FROM t1 ORDER BY f; +f +baz +foo +DROP TABLE t1; # End of 10.5 tests # # MDEV-13694: Wrong result upon GROUP BY with orderby_uses_equalities=on diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index 2e913d3b5cd..15e42848eea 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -2533,6 +2533,14 @@ SELECT * FROM t1 ORDER BY a DESC; DROP TABLE t1; +--echo # +--echo # MDEV-23414 Assertion `res->charset() == item->collation.collation' failed in Type_handler_string_result::make_packed_sort_key_part +--echo # +CREATE TABLE t1 (a CHAR(3), b BINARY(255)); +INSERT t1 VALUES ('foo','bar'),('baz','qux'); +SELECT COALESCE(a, b) AS f FROM t1 ORDER BY f; +DROP TABLE t1; + --echo # End of 10.5 tests --echo # 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/parser_precedence.result b/mysql-test/main/parser_precedence.result index 4330c8a2045..f23295bd61b 100644 --- a/mysql-test/main/parser_precedence.result +++ b/mysql-test/main/parser_precedence.result @@ -619,7 +619,7 @@ select 4 - 3 * 2, (4 - 3) * 2, 4 - (3 * 2); Testing that / is left associative select 15 / 5 / 3, (15 / 5) / 3, 15 / (5 / 3); 15 / 5 / 3 (15 / 5) / 3 15 / (5 / 3) -1.00000000 1.00000000 9.0000 +1.00000000 1.00000000 8.9998 Testing that / has precedence over | select 105 / 5 | 2, (105 / 5) | 2, 105 / (5 | 2); 105 / 5 | 2 (105 / 5) | 2 105 / (5 | 2) diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result index b132cf90f2c..6f97cd013b3 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -2767,5 +2767,45 @@ SELECT 1 FROM t1 WHERE a XOR 'a'; 1 DROP TABLE t1; # +# Bug #25207522: INCORRECT ORDER-BY BEHAVIOR ON A PARTITIONED TABLE +# WITH A COMPOSITE PREFIX INDEX +# +create table t1(id int unsigned not null, +data varchar(2) default null, +key data_idx (data(1),id) +) default charset=utf8 +partition by range (id) ( +partition p10 values less than (10), +partition p20 values less than (20) +); +insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ; +select id from t1 where data = 'ab' order by id; +id +4 +5 +6 +14 +15 +16 +drop table t1; +create table t1(id int unsigned not null, +data text default null, +key data_idx (data(1),id) +) default charset=utf8 +partition by range (id) ( +partition p10 values less than (10), +partition p20 values less than (20) +); +insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ; +select id from t1 where data = 'ab' order by id; +id +4 +5 +6 +14 +15 +16 +drop table t1; +# # End of 10.1 tests # diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index 15f263747fe..b715866fab8 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -2976,6 +2976,34 @@ CREATE TABLE t1(a BINARY(80)) PARTITION BY KEY(a) PARTITIONS 3; SELECT 1 FROM t1 WHERE a XOR 'a'; DROP TABLE t1; +--echo # +--echo # Bug #25207522: INCORRECT ORDER-BY BEHAVIOR ON A PARTITIONED TABLE +--echo # WITH A COMPOSITE PREFIX INDEX +--echo # +create table t1(id int unsigned not null, + data varchar(2) default null, + key data_idx (data(1),id) +) default charset=utf8 +partition by range (id) ( + partition p10 values less than (10), + partition p20 values less than (20) +); +insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ; +select id from t1 where data = 'ab' order by id; +drop table t1; + +create table t1(id int unsigned not null, + data text default null, + key data_idx (data(1),id) +) default charset=utf8 +partition by range (id) ( + partition p10 values less than (10), + partition p20 values less than (20) +); +insert t1 values (6, 'ab'), (4, 'ab'), (5, 'ab'), (16, 'ab'), (14, 'ab'), (15, 'ab'), (5, 'ac'), (15, 'aa') ; +select id from t1 where data = 'ab' order by id; +drop table t1; + --echo # --echo # End of 10.1 tests --echo # diff --git a/mysql-test/main/stat_tables_partition.result b/mysql-test/main/stat_tables_partition.result index 12ae2570272..2619026b231 100644 --- a/mysql-test/main/stat_tables_partition.result +++ b/mysql-test/main/stat_tables_partition.result @@ -9,5 +9,38 @@ ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK -SET use_stat_tables = DEFAULT; DROP TABLE t1; +# +# MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks all rows +# +CREATE TABLE t1 ( +id int(11) auto_increment primary key, +c1 int(11) DEFAULT NULL +) PARTITION BY RANGE (id) ( +PARTITION p0 VALUES LESS THAN (4), +PARTITION p1 VALUES LESS THAN MAXVALUE +); +insert into t1(c1) values (1),(1),(1),(1), (1),(1),(1),(1); +insert into t1(c1) select c1 from t1; +insert into t1(c1) select c1 from t1; +select count(*) from t1; +count(*) +32 +select count(*) from t1 where id <4; +count(*) +3 +flush status; +set session use_stat_tables='preferably'; +# Must NOT show "Engine-independent statistics collected": +alter table t1 analyze partition p0; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +# Should not have Handler_read_rnd_next=34 +show session status like 'Handler_read_rnd%'; +Variable_name Value +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 34 +drop table t1; +SET use_stat_tables = DEFAULT; diff --git a/mysql-test/main/stat_tables_partition.test b/mysql-test/main/stat_tables_partition.test index 1316e5cca11..11b74818d82 100644 --- a/mysql-test/main/stat_tables_partition.test +++ b/mysql-test/main/stat_tables_partition.test @@ -11,7 +11,33 @@ CREATE TABLE t1 (pk int PRIMARY KEY, a bit(1), INDEX idx(a) INSERT INTO t1 VALUES (1,1),(2,0),(3,0),(4,1); ANALYZE TABLE t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-21472: ALTER TABLE ... ANALYZE PARTITION ... with EITS reads and locks all rows +--echo # +CREATE TABLE t1 ( + id int(11) auto_increment primary key, + c1 int(11) DEFAULT NULL +) PARTITION BY RANGE (id) ( + PARTITION p0 VALUES LESS THAN (4), + PARTITION p1 VALUES LESS THAN MAXVALUE +); + +insert into t1(c1) values (1),(1),(1),(1), (1),(1),(1),(1); +insert into t1(c1) select c1 from t1; +insert into t1(c1) select c1 from t1; + +select count(*) from t1; +select count(*) from t1 where id <4; +flush status; +set session use_stat_tables='preferably'; + +--echo # Must NOT show "Engine-independent statistics collected": +alter table t1 analyze partition p0; + +--echo # Should not have Handler_read_rnd_next=34 +show session status like 'Handler_read_rnd%'; +drop table t1; SET use_stat_tables = DEFAULT; - -DROP TABLE t1; diff --git a/mysql-test/main/subselect4.result b/mysql-test/main/subselect4.result index 51194717676..944515413d3 100644 --- a/mysql-test/main/subselect4.result +++ b/mysql-test/main/subselect4.result @@ -2585,6 +2585,71 @@ e 2 o 6 DROP TABLE t1, t2; # +# MDEV-19232: Floating point precision / value comparison problem +# +CREATE TABLE t1 (region varchar(60), area decimal(10,0), population decimal(11,0)); +INSERT INTO t1 VALUES ('Central America and the Caribbean',91,11797); +INSERT INTO t1 VALUES ('Central America and the Caribbean',442,66422); +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='subquery_cache=on'; +SELECT +population, area, population/area, +cast(population/area as DECIMAL(20,9)) FROM t1 LIMIT 1; +population area population/area cast(population/area as DECIMAL(20,9)) +11797 91 129.6374 129.637400000 +SELECT * FROM t1 A +WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region); +region area population +Central America and the Caribbean 442 66422 +SET optimizer_switch='subquery_cache=off'; +SELECT * FROM t1 A +WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region); +region area population +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 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 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; @@ -2596,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 36490c340e1..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'; @@ -2115,6 +2117,57 @@ EXPLAIN EXTENDED SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t SELECT * FROM t1 where ( t1.l1 < ANY (SELECT MAX(t2.v1) FROM t2)); DROP TABLE t1, t2; +--echo # +--echo # MDEV-19232: Floating point precision / value comparison problem +--echo # + +CREATE TABLE t1 (region varchar(60), area decimal(10,0), population decimal(11,0)); +INSERT INTO t1 VALUES ('Central America and the Caribbean',91,11797); +INSERT INTO t1 VALUES ('Central America and the Caribbean',442,66422); + +SET @save_optimizer_switch=@@optimizer_switch; +SET optimizer_switch='subquery_cache=on'; + +SELECT +population, area, population/area, +cast(population/area as DECIMAL(20,9)) FROM t1 LIMIT 1; + +SELECT * FROM t1 A +WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region); + +SET optimizer_switch='subquery_cache=off'; +SELECT * FROM t1 A +WHERE population/area = (SELECT MAX(population/area) from t1 B where A.region = B.region); + +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 # @@ -2127,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/subselect_exists2in.result b/mysql-test/main/subselect_exists2in.result index 576559c2e86..e8ef7081b09 100644 --- a/mysql-test/main/subselect_exists2in.result +++ b/mysql-test/main/subselect_exists2in.result @@ -975,4 +975,131 @@ id DROP PROCEDURE p1; DROP TABLE t1; # End of 10.0 tests +# +# MDEV-23221: A subquery causes crash +# +create table t1 ( +location_code varchar(10), +country_id varchar(10) +); +insert into t1 values ('HKG', 'HK'); +insert into t1 values ('NYC', 'US'); +insert into t1 values ('LAX', 'US'); +create table t2 ( +container_id varchar(10), +cntr_activity_type varchar(10), +cntr_dest varchar(10) +); +insert into t2 values ('AAAA1111', 'VSL', 'NYC'); +insert into t2 values ('AAAA1111', 'CUV', 'NYC'); +insert into t2 values ('BBBB2222', 'VSL', 'LAX'); +insert into t2 values ('BBBB2222', 'XYZ', 'LAX'); +# Must not crash or return an error: +select +(select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry, +(select +max(container_id) +from t2 as cl2 +where +cl2.container_id = cl1.container_id and +cl2.cntr_activity_type = 'CUV' and +exists (select location_code +from t1 +where +location_code = cl2.cntr_dest and +country_id = dest_cntry) +) as CUV +from +t2 cl1; +dest_cntry CUV +US AAAA1111 +US AAAA1111 +US NULL +US NULL +prepare s from "select +(select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry, +(select +max(container_id) +from t2 as cl2 +where +cl2.container_id = cl1.container_id and +cl2.cntr_activity_type = 'CUV' and +exists (select location_code +from t1 +where +location_code = cl2.cntr_dest and +country_id = dest_cntry) +) as CUV +from +t2 cl1"; +execute s; +dest_cntry CUV +US AAAA1111 +US AAAA1111 +US NULL +US NULL +execute s; +dest_cntry CUV +US AAAA1111 +US AAAA1111 +US NULL +US NULL +drop table t1,t2; +# +# MDEV-20557: SQL query with duplicate table aliases consistently crashes server +# (Just a testcase) +# +create table t1 (id int, id2 int); +create table t2 (id int, id2 int, a int); +create table t3 (id int); +create table t4 (id int); +select (select 1 from t1 where (exists +(select 1 from t2 +where t2.a = (select t4.id from t4 where t4.id = t3.id) and t2.id2 = t1.id2))) dt +from t3; +ERROR 42000: This version of MariaDB doesn't yet support 'SUBQUERY in ROW in left expression of IN/ALL/ANY' +drop table t1,t2,t3,t4; +# +# MDEV-21649: Crash when using nested EXISTS +# (Just a testcase) +# +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)); +CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT, ip_id INT, PRIMARY KEY(id)); +CREATE TABLE t3 (id INT NOT NULL AUTO_INCREMENT, storage_method_id INT, storage_target_id INT, PRIMARY KEY(id)); +SELECT +W0.`id` +FROM +`t1` W0 +WHERE ( +EXISTS( +SELECT +V0.`id` + FROM +`t2` V0 +WHERE ( +EXISTS( +SELECT +U0.`id` + FROM +`t2` U0 +INNER JOIN `t3` U4 ON (U0.`id` = U4.`storage_target_id`) +WHERE ( +U0.`ip_id` = V0.`ip_id` + AND U4.`storage_method_id` = ( +SELECT +U5.`storage_method_id` + FROM +`t3` U5 +WHERE +U5.`storage_target_id` = V0.`id` + LIMIT +1 +) +) +) +) +) +); +id +drop table t1,t2,t3; set optimizer_switch=default; diff --git a/mysql-test/main/subselect_exists2in.test b/mysql-test/main/subselect_exists2in.test index 2a9947123d4..e27ce57038b 100644 --- a/mysql-test/main/subselect_exists2in.test +++ b/mysql-test/main/subselect_exists2in.test @@ -829,5 +829,117 @@ DROP TABLE t1; --echo # End of 10.0 tests +--echo # +--echo # MDEV-23221: A subquery causes crash +--echo # +create table t1 ( +location_code varchar(10), +country_id varchar(10) +); +insert into t1 values ('HKG', 'HK'); +insert into t1 values ('NYC', 'US'); +insert into t1 values ('LAX', 'US'); + +create table t2 ( +container_id varchar(10), +cntr_activity_type varchar(10), +cntr_dest varchar(10) +); +insert into t2 values ('AAAA1111', 'VSL', 'NYC'); +insert into t2 values ('AAAA1111', 'CUV', 'NYC'); +insert into t2 values ('BBBB2222', 'VSL', 'LAX'); +insert into t2 values ('BBBB2222', 'XYZ', 'LAX'); + +let $query= +select + (select country_id from t1 where location_code = cl1.cntr_dest) as dest_cntry, + (select + max(container_id) + from t2 as cl2 + where + cl2.container_id = cl1.container_id and + cl2.cntr_activity_type = 'CUV' and + exists (select location_code + from t1 + where + location_code = cl2.cntr_dest and + country_id = dest_cntry) + ) as CUV +from + t2 cl1; + +--echo # Must not crash or return an error: +eval $query; + +eval prepare s from "$query"; +execute s; +execute s; + +drop table t1,t2; + +--echo # +--echo # MDEV-20557: SQL query with duplicate table aliases consistently crashes server +--echo # (Just a testcase) +--echo # + +create table t1 (id int, id2 int); +create table t2 (id int, id2 int, a int); +create table t3 (id int); +create table t4 (id int); + +--error ER_NOT_SUPPORTED_YET +select (select 1 from t1 where (exists + (select 1 from t2 + where t2.a = (select t4.id from t4 where t4.id = t3.id) and t2.id2 = t1.id2))) dt +from t3; + +drop table t1,t2,t3,t4; + + +--echo # +--echo # MDEV-21649: Crash when using nested EXISTS +--echo # (Just a testcase) +--echo # +CREATE TABLE t1 (id INT NOT NULL AUTO_INCREMENT, PRIMARY KEY(id)); +CREATE TABLE t2 (id INT NOT NULL AUTO_INCREMENT, ip_id INT, PRIMARY KEY(id)); +CREATE TABLE t3 (id INT NOT NULL AUTO_INCREMENT, storage_method_id INT, storage_target_id INT, PRIMARY KEY(id)); + +SELECT + W0.`id` +FROM + `t1` W0 +WHERE ( + EXISTS( + SELECT + V0.`id` + FROM + `t2` V0 + WHERE ( + EXISTS( + SELECT + U0.`id` + FROM + `t2` U0 + INNER JOIN `t3` U4 ON (U0.`id` = U4.`storage_target_id`) + WHERE ( + U0.`ip_id` = V0.`ip_id` + AND U4.`storage_method_id` = ( + SELECT + U5.`storage_method_id` + FROM + `t3` U5 + WHERE + U5.`storage_target_id` = V0.`id` + LIMIT + 1 + ) + ) + ) + ) + ) +); + +drop table t1,t2,t3; + #restore defaults set optimizer_switch=default; 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 @@ -749,6 +749,28 @@ CREATE TABLE t2 AS SELECT FLOOR(a), CEIL(a),ROUND(a),TRUNCATE(a,0) FROM t1; 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 167c167ad45..5137a8229b6 100644 --- a/mysql-test/main/type_float.result +++ b/mysql-test/main/type_float.result @@ -676,6 +676,27 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 2010e0 DROP TABLE t1; # +# MDEV-23282 FLOAT(53,0) badly handles out-of-range values +# +CREATE OR REPLACE TABLE t1 (c1 FLOAT NOT NULL, c2 FLOAT NOT NULL); +INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +SELECT c1, c2 FROM t1; +c1 c2 +3.40282e38 -3.40282e38 +DROP TABLE t1; +CREATE OR REPLACE TABLE t1 (c1 FLOAT(53,0) NOT NULL, c2 FLOAT(53,0) NOT NULL); +INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40); +Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 +SELECT c1, c2 FROM t1; +c1 c2 +340282346638528860000000000000000000000 -340282346638528860000000000000000000000 +DROP TABLE t1; +# # End of 10.1 tests # # @@ -969,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 4665c945a76..a12bf67a426 100644 --- a/mysql-test/main/type_float.test +++ b/mysql-test/main/type_float.test @@ -485,6 +485,20 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a=2010e0 AND a>=2010e0; DROP TABLE t1; +--echo # +--echo # MDEV-23282 FLOAT(53,0) badly handles out-of-range values +--echo # + +CREATE OR REPLACE TABLE t1 (c1 FLOAT NOT NULL, c2 FLOAT NOT NULL); +INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40); +SELECT c1, c2 FROM t1; +DROP TABLE t1; + +CREATE OR REPLACE TABLE t1 (c1 FLOAT(53,0) NOT NULL, c2 FLOAT(53,0) NOT NULL); +INSERT IGNORE INTO t1 VALUES (1e+40, -1e+40); +SELECT c1, c2 FROM t1; +DROP TABLE t1; + --echo # --echo # End of 10.1 tests --echo # @@ -666,6 +680,26 @@ EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE ?+a<=>1e0+a' USING 1e EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE 1e0+a<=>?+a' USING 1e0; 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_hex_hybrid.result b/mysql-test/main/type_hex_hybrid.result index 92a7432ae56..26ff385a709 100644 --- a/mysql-test/main/type_hex_hybrid.result +++ b/mysql-test/main/type_hex_hybrid.result @@ -178,5 +178,59 @@ c3 18446744073709551615 c4 18446744073709551615 c5 18446744073709551615 # +# MDEV-23368 ROUND(18446744073709551615,-11) returns a wrong result +# +SELECT ROUND(0xFFFFFFFFFFFFFFFF,-10), ROUND(0xFFFFFFFFFFFFFFFF,-11); +ROUND(0xFFFFFFFFFFFFFFFF,-10) ROUND(0xFFFFFFFFFFFFFFFF,-11) +18446744070000000000 18446744100000000000 +CREATE TABLE t1 AS SELECT ROUND(0xFFFFFFFFFFFFFFFF,-10), ROUND(0xFFFFFFFFFFFFFFFF,-11); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ROUND(0xFFFFFFFFFFFFFFFF,-10)` decimal(21,0) unsigned NOT NULL, + `ROUND(0xFFFFFFFFFFFFFFFF,-11)` decimal(21,0) unsigned NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +ROUND(0xFFFFFFFFFFFFFFFF,-10) ROUND(0xFFFFFFFFFFFFFFFF,-11) +18446744070000000000 18446744100000000000 +DROP TABLE t1; +# +# MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result +# +SELECT +ROUND(0xFFFFFFFFFFFFFFFF,NULL) AS c1, +ROUND(0xFFFFFFFFFFFFFFFF,rand()*0) AS c2, +ROUND(0xFFFFFFFFFFFFFFFF,-1) AS c3, +ROUND(0xFFFFFFFFFFFFFFFF,-19) AS c4, +ROUND(0xFFFFFFFFFFFFFFFF,rand()*0-19) AS c5; +c1 NULL +c2 18446744073709551615 +c3 18446744073709551620 +c4 20000000000000000000 +c5 20000000000000000000 +CREATE OR REPLACE TABLE t1 AS +SELECT +ROUND(0xFFFFFFFFFFFFFFFF,NULL) AS c1, +ROUND(0xFFFFFFFFFFFFFFFF,rand()*0) AS c2, +ROUND(0xFFFFFFFFFFFFFFFF,-1) AS c3, +ROUND(0xFFFFFFFFFFFFFFFF,-19) AS c4, +ROUND(0xFFFFFFFFFFFFFFFF,rand()*0-19) AS c5; +SELECT * FROM t1; +c1 NULL +c2 18446744073709551615 +c3 18446744073709551620 +c4 20000000000000000000 +c5 20000000000000000000 +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `c1` bigint(20) unsigned DEFAULT NULL, + `c2` decimal(21,0) unsigned NOT NULL, + `c3` decimal(21,0) unsigned NOT NULL, + `c4` decimal(21,0) unsigned NOT NULL, + `c5` decimal(21,0) unsigned NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# # End of 10.4 tests # diff --git a/mysql-test/main/type_hex_hybrid.test b/mysql-test/main/type_hex_hybrid.test index 77afb45cfbf..175169fbda4 100644 --- a/mysql-test/main/type_hex_hybrid.test +++ b/mysql-test/main/type_hex_hybrid.test @@ -46,6 +46,42 @@ DELIMITER ;$$ --horizontal_results +--echo # +--echo # MDEV-23368 ROUND(18446744073709551615,-11) returns a wrong result +--echo # + +SELECT ROUND(0xFFFFFFFFFFFFFFFF,-10), ROUND(0xFFFFFFFFFFFFFFFF,-11); +CREATE TABLE t1 AS SELECT ROUND(0xFFFFFFFFFFFFFFFF,-10), ROUND(0xFFFFFFFFFFFFFFFF,-11); +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + + +--echo # +--echo # MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result +--echo # + +--vertical_results +SELECT + ROUND(0xFFFFFFFFFFFFFFFF,NULL) AS c1, + ROUND(0xFFFFFFFFFFFFFFFF,rand()*0) AS c2, + ROUND(0xFFFFFFFFFFFFFFFF,-1) AS c3, + ROUND(0xFFFFFFFFFFFFFFFF,-19) AS c4, + ROUND(0xFFFFFFFFFFFFFFFF,rand()*0-19) AS c5; + +CREATE OR REPLACE TABLE t1 AS +SELECT + ROUND(0xFFFFFFFFFFFFFFFF,NULL) AS c1, + ROUND(0xFFFFFFFFFFFFFFFF,rand()*0) AS c2, + ROUND(0xFFFFFFFFFFFFFFFF,-1) AS c3, + ROUND(0xFFFFFFFFFFFFFFFF,-19) AS c4, + ROUND(0xFFFFFFFFFFFFFFFF,rand()*0-19) AS c5; + +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +--horizontal_results + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/type_int.result b/mysql-test/main/type_int.result index b75a07251a9..c9763a1453e 100644 --- a/mysql-test/main/type_int.result +++ b/mysql-test/main/type_int.result @@ -413,6 +413,7 @@ COUNT(*) DROP TABLE t1; # # MDEV-23337 Rounding functions create a wrong data type for numeric input +# MDEV-23350 ROUND(bigint_22_or_longer) returns a wrong data type # CREATE PROCEDURE p1(t VARCHAR(64)) BEGIN @@ -420,7 +421,7 @@ SELECT t AS ``; EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a TYPE)', 'TYPE', t); INSERT IGNORE INTO t1 VALUES (-100000000000000000000000000000); INSERT IGNORE INTO t1 VALUES (100000000000000000000000000000); -CREATE TABLE t2 AS SELECT a, ROUND(a), TRUNCATE(a,0), FLOOR(a), CEILING(a) FROM t1; +CREATE TABLE t2 AS SELECT a, ROUND(a), ROUND(a,1), ROUND(a,10), TRUNCATE(a,0), FLOOR(a), CEILING(a) FROM t1; SHOW CREATE TABLE t2; SELECT * FROM t2; DROP TABLE t1, t2; @@ -432,17 +433,23 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` tinyint(4) DEFAULT NULL, `ROUND(a)` tinyint(4) DEFAULT NULL, + `ROUND(a,1)` tinyint(4) DEFAULT NULL, + `ROUND(a,10)` tinyint(4) DEFAULT NULL, `TRUNCATE(a,0)` tinyint(4) DEFAULT NULL, `FLOOR(a)` tinyint(4) DEFAULT NULL, `CEILING(a)` tinyint(4) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a -128 ROUND(a) -128 +ROUND(a,1) -128 +ROUND(a,10) -128 TRUNCATE(a,0) -128 FLOOR(a) -128 CEILING(a) -128 a 127 ROUND(a) 127 +ROUND(a,1) 127 +ROUND(a,10) 127 TRUNCATE(a,0) 127 FLOOR(a) 127 CEILING(a) 127 @@ -452,17 +459,23 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` smallint(6) DEFAULT NULL, `ROUND(a)` smallint(6) DEFAULT NULL, + `ROUND(a,1)` smallint(6) DEFAULT NULL, + `ROUND(a,10)` smallint(6) DEFAULT NULL, `TRUNCATE(a,0)` smallint(6) DEFAULT NULL, `FLOOR(a)` smallint(6) DEFAULT NULL, `CEILING(a)` smallint(6) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a -32768 ROUND(a) -32768 +ROUND(a,1) -32768 +ROUND(a,10) -32768 TRUNCATE(a,0) -32768 FLOOR(a) -32768 CEILING(a) -32768 a 32767 ROUND(a) 32767 +ROUND(a,1) 32767 +ROUND(a,10) 32767 TRUNCATE(a,0) 32767 FLOOR(a) 32767 CEILING(a) 32767 @@ -472,17 +485,23 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` mediumint(9) DEFAULT NULL, `ROUND(a)` mediumint(9) DEFAULT NULL, + `ROUND(a,1)` mediumint(9) DEFAULT NULL, + `ROUND(a,10)` mediumint(9) DEFAULT NULL, `TRUNCATE(a,0)` mediumint(9) DEFAULT NULL, `FLOOR(a)` mediumint(9) DEFAULT NULL, `CEILING(a)` mediumint(9) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a -8388608 ROUND(a) -8388608 +ROUND(a,1) -8388608 +ROUND(a,10) -8388608 TRUNCATE(a,0) -8388608 FLOOR(a) -8388608 CEILING(a) -8388608 a 8388607 ROUND(a) 8388607 +ROUND(a,1) 8388607 +ROUND(a,10) 8388607 TRUNCATE(a,0) 8388607 FLOOR(a) 8388607 CEILING(a) 8388607 @@ -492,17 +511,23 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` int(11) DEFAULT NULL, `ROUND(a)` int(11) DEFAULT NULL, + `ROUND(a,1)` int(11) DEFAULT NULL, + `ROUND(a,10)` int(11) DEFAULT NULL, `TRUNCATE(a,0)` int(11) DEFAULT NULL, `FLOOR(a)` int(11) DEFAULT NULL, `CEILING(a)` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a -2147483648 ROUND(a) -2147483648 +ROUND(a,1) -2147483648 +ROUND(a,10) -2147483648 TRUNCATE(a,0) -2147483648 FLOOR(a) -2147483648 CEILING(a) -2147483648 a 2147483647 ROUND(a) 2147483647 +ROUND(a,1) 2147483647 +ROUND(a,10) 2147483647 TRUNCATE(a,0) 2147483647 FLOOR(a) 2147483647 CEILING(a) 2147483647 @@ -512,17 +537,153 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` bigint(20) DEFAULT NULL, `ROUND(a)` bigint(20) DEFAULT NULL, + `ROUND(a,1)` bigint(20) DEFAULT NULL, + `ROUND(a,10)` bigint(20) DEFAULT NULL, `TRUNCATE(a,0)` bigint(20) DEFAULT NULL, `FLOOR(a)` bigint(20) DEFAULT NULL, `CEILING(a)` bigint(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a -9223372036854775808 ROUND(a) -9223372036854775808 +ROUND(a,1) -9223372036854775808 +ROUND(a,10) -9223372036854775808 TRUNCATE(a,0) -9223372036854775808 FLOOR(a) -9223372036854775808 CEILING(a) -9223372036854775808 a 9223372036854775807 ROUND(a) 9223372036854775807 +ROUND(a,1) 9223372036854775807 +ROUND(a,10) 9223372036854775807 +TRUNCATE(a,0) 9223372036854775807 +FLOOR(a) 9223372036854775807 +CEILING(a) 9223372036854775807 +CALL p1('bigint(20)'); + bigint(20) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(20) DEFAULT NULL, + `ROUND(a)` bigint(20) DEFAULT NULL, + `ROUND(a,1)` bigint(20) DEFAULT NULL, + `ROUND(a,10)` bigint(20) DEFAULT NULL, + `TRUNCATE(a,0)` bigint(20) DEFAULT NULL, + `FLOOR(a)` bigint(20) DEFAULT NULL, + `CEILING(a)` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a) -9223372036854775808 +ROUND(a,1) -9223372036854775808 +ROUND(a,10) -9223372036854775808 +TRUNCATE(a,0) -9223372036854775808 +FLOOR(a) -9223372036854775808 +CEILING(a) -9223372036854775808 +a 9223372036854775807 +ROUND(a) 9223372036854775807 +ROUND(a,1) 9223372036854775807 +ROUND(a,10) 9223372036854775807 +TRUNCATE(a,0) 9223372036854775807 +FLOOR(a) 9223372036854775807 +CEILING(a) 9223372036854775807 +CALL p1('bigint(21)'); + bigint(21) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(21) DEFAULT NULL, + `ROUND(a)` bigint(21) DEFAULT NULL, + `ROUND(a,1)` bigint(21) DEFAULT NULL, + `ROUND(a,10)` bigint(21) DEFAULT NULL, + `TRUNCATE(a,0)` bigint(21) DEFAULT NULL, + `FLOOR(a)` bigint(21) DEFAULT NULL, + `CEILING(a)` bigint(21) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a) -9223372036854775808 +ROUND(a,1) -9223372036854775808 +ROUND(a,10) -9223372036854775808 +TRUNCATE(a,0) -9223372036854775808 +FLOOR(a) -9223372036854775808 +CEILING(a) -9223372036854775808 +a 9223372036854775807 +ROUND(a) 9223372036854775807 +ROUND(a,1) 9223372036854775807 +ROUND(a,10) 9223372036854775807 +TRUNCATE(a,0) 9223372036854775807 +FLOOR(a) 9223372036854775807 +CEILING(a) 9223372036854775807 +CALL p1('bigint(22)'); + bigint(22) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(22) DEFAULT NULL, + `ROUND(a)` bigint(22) DEFAULT NULL, + `ROUND(a,1)` bigint(22) DEFAULT NULL, + `ROUND(a,10)` bigint(22) DEFAULT NULL, + `TRUNCATE(a,0)` bigint(22) DEFAULT NULL, + `FLOOR(a)` bigint(22) DEFAULT NULL, + `CEILING(a)` bigint(22) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a) -9223372036854775808 +ROUND(a,1) -9223372036854775808 +ROUND(a,10) -9223372036854775808 +TRUNCATE(a,0) -9223372036854775808 +FLOOR(a) -9223372036854775808 +CEILING(a) -9223372036854775808 +a 9223372036854775807 +ROUND(a) 9223372036854775807 +ROUND(a,1) 9223372036854775807 +ROUND(a,10) 9223372036854775807 +TRUNCATE(a,0) 9223372036854775807 +FLOOR(a) 9223372036854775807 +CEILING(a) 9223372036854775807 +CALL p1('bigint(23)'); + bigint(23) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(23) DEFAULT NULL, + `ROUND(a)` bigint(23) DEFAULT NULL, + `ROUND(a,1)` bigint(23) DEFAULT NULL, + `ROUND(a,10)` bigint(23) DEFAULT NULL, + `TRUNCATE(a,0)` bigint(23) DEFAULT NULL, + `FLOOR(a)` bigint(23) DEFAULT NULL, + `CEILING(a)` bigint(23) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a) -9223372036854775808 +ROUND(a,1) -9223372036854775808 +ROUND(a,10) -9223372036854775808 +TRUNCATE(a,0) -9223372036854775808 +FLOOR(a) -9223372036854775808 +CEILING(a) -9223372036854775808 +a 9223372036854775807 +ROUND(a) 9223372036854775807 +ROUND(a,1) 9223372036854775807 +ROUND(a,10) 9223372036854775807 +TRUNCATE(a,0) 9223372036854775807 +FLOOR(a) 9223372036854775807 +CEILING(a) 9223372036854775807 +CALL p1('bigint(30)'); + bigint(30) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(30) DEFAULT NULL, + `ROUND(a)` bigint(30) DEFAULT NULL, + `ROUND(a,1)` bigint(30) DEFAULT NULL, + `ROUND(a,10)` bigint(30) DEFAULT NULL, + `TRUNCATE(a,0)` bigint(30) DEFAULT NULL, + `FLOOR(a)` bigint(30) DEFAULT NULL, + `CEILING(a)` bigint(30) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a) -9223372036854775808 +ROUND(a,1) -9223372036854775808 +ROUND(a,10) -9223372036854775808 +TRUNCATE(a,0) -9223372036854775808 +FLOOR(a) -9223372036854775808 +CEILING(a) -9223372036854775808 +a 9223372036854775807 +ROUND(a) 9223372036854775807 +ROUND(a,1) 9223372036854775807 +ROUND(a,10) 9223372036854775807 TRUNCATE(a,0) 9223372036854775807 FLOOR(a) 9223372036854775807 CEILING(a) 9223372036854775807 @@ -532,17 +693,23 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` tinyint(3) unsigned DEFAULT NULL, `ROUND(a)` tinyint(3) unsigned DEFAULT NULL, + `ROUND(a,1)` tinyint(3) unsigned DEFAULT NULL, + `ROUND(a,10)` tinyint(3) unsigned DEFAULT NULL, `TRUNCATE(a,0)` tinyint(3) unsigned DEFAULT NULL, `FLOOR(a)` tinyint(3) unsigned DEFAULT NULL, `CEILING(a)` tinyint(3) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a 0 ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 TRUNCATE(a,0) 0 FLOOR(a) 0 CEILING(a) 0 a 255 ROUND(a) 255 +ROUND(a,1) 255 +ROUND(a,10) 255 TRUNCATE(a,0) 255 FLOOR(a) 255 CEILING(a) 255 @@ -552,17 +719,23 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` smallint(5) unsigned DEFAULT NULL, `ROUND(a)` smallint(5) unsigned DEFAULT NULL, + `ROUND(a,1)` smallint(5) unsigned DEFAULT NULL, + `ROUND(a,10)` smallint(5) unsigned DEFAULT NULL, `TRUNCATE(a,0)` smallint(5) unsigned DEFAULT NULL, `FLOOR(a)` smallint(5) unsigned DEFAULT NULL, `CEILING(a)` smallint(5) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a 0 ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 TRUNCATE(a,0) 0 FLOOR(a) 0 CEILING(a) 0 a 65535 ROUND(a) 65535 +ROUND(a,1) 65535 +ROUND(a,10) 65535 TRUNCATE(a,0) 65535 FLOOR(a) 65535 CEILING(a) 65535 @@ -572,17 +745,23 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` mediumint(8) unsigned DEFAULT NULL, `ROUND(a)` mediumint(8) unsigned DEFAULT NULL, + `ROUND(a,1)` mediumint(8) unsigned DEFAULT NULL, + `ROUND(a,10)` mediumint(8) unsigned DEFAULT NULL, `TRUNCATE(a,0)` mediumint(8) unsigned DEFAULT NULL, `FLOOR(a)` mediumint(8) unsigned DEFAULT NULL, `CEILING(a)` mediumint(8) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a 0 ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 TRUNCATE(a,0) 0 FLOOR(a) 0 CEILING(a) 0 a 16777215 ROUND(a) 16777215 +ROUND(a,1) 16777215 +ROUND(a,10) 16777215 TRUNCATE(a,0) 16777215 FLOOR(a) 16777215 CEILING(a) 16777215 @@ -592,17 +771,23 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` int(10) unsigned DEFAULT NULL, `ROUND(a)` int(10) unsigned DEFAULT NULL, + `ROUND(a,1)` int(10) unsigned DEFAULT NULL, + `ROUND(a,10)` int(10) unsigned DEFAULT NULL, `TRUNCATE(a,0)` int(10) unsigned DEFAULT NULL, `FLOOR(a)` int(10) unsigned DEFAULT NULL, `CEILING(a)` int(10) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a 0 ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 TRUNCATE(a,0) 0 FLOOR(a) 0 CEILING(a) 0 a 4294967295 ROUND(a) 4294967295 +ROUND(a,1) 4294967295 +ROUND(a,10) 4294967295 TRUNCATE(a,0) 4294967295 FLOOR(a) 4294967295 CEILING(a) 4294967295 @@ -612,22 +797,700 @@ Table t2 Create Table CREATE TABLE `t2` ( `a` bigint(20) unsigned DEFAULT NULL, `ROUND(a)` bigint(20) unsigned DEFAULT NULL, + `ROUND(a,1)` bigint(20) unsigned DEFAULT NULL, + `ROUND(a,10)` bigint(20) unsigned DEFAULT NULL, `TRUNCATE(a,0)` bigint(20) unsigned DEFAULT NULL, `FLOOR(a)` bigint(20) unsigned DEFAULT NULL, `CEILING(a)` bigint(20) unsigned DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 a 0 ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 TRUNCATE(a,0) 0 FLOOR(a) 0 CEILING(a) 0 a 18446744073709551615 ROUND(a) 18446744073709551615 +ROUND(a,1) 18446744073709551615 +ROUND(a,10) 18446744073709551615 +TRUNCATE(a,0) 18446744073709551615 +FLOOR(a) 18446744073709551615 +CEILING(a) 18446744073709551615 +CALL p1('bigint(20) unsigned'); + bigint(20) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(20) unsigned DEFAULT NULL, + `ROUND(a)` bigint(20) unsigned DEFAULT NULL, + `ROUND(a,1)` bigint(20) unsigned DEFAULT NULL, + `ROUND(a,10)` bigint(20) unsigned DEFAULT NULL, + `TRUNCATE(a,0)` bigint(20) unsigned DEFAULT NULL, + `FLOOR(a)` bigint(20) unsigned DEFAULT NULL, + `CEILING(a)` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 +TRUNCATE(a,0) 0 +FLOOR(a) 0 +CEILING(a) 0 +a 18446744073709551615 +ROUND(a) 18446744073709551615 +ROUND(a,1) 18446744073709551615 +ROUND(a,10) 18446744073709551615 +TRUNCATE(a,0) 18446744073709551615 +FLOOR(a) 18446744073709551615 +CEILING(a) 18446744073709551615 +CALL p1('bigint(21) unsigned'); + bigint(21) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(21) unsigned DEFAULT NULL, + `ROUND(a)` bigint(21) unsigned DEFAULT NULL, + `ROUND(a,1)` bigint(21) unsigned DEFAULT NULL, + `ROUND(a,10)` bigint(21) unsigned DEFAULT NULL, + `TRUNCATE(a,0)` bigint(21) unsigned DEFAULT NULL, + `FLOOR(a)` bigint(21) unsigned DEFAULT NULL, + `CEILING(a)` bigint(21) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 +TRUNCATE(a,0) 0 +FLOOR(a) 0 +CEILING(a) 0 +a 18446744073709551615 +ROUND(a) 18446744073709551615 +ROUND(a,1) 18446744073709551615 +ROUND(a,10) 18446744073709551615 +TRUNCATE(a,0) 18446744073709551615 +FLOOR(a) 18446744073709551615 +CEILING(a) 18446744073709551615 +CALL p1('bigint(22) unsigned'); + bigint(22) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(22) unsigned DEFAULT NULL, + `ROUND(a)` bigint(22) unsigned DEFAULT NULL, + `ROUND(a,1)` bigint(22) unsigned DEFAULT NULL, + `ROUND(a,10)` bigint(22) unsigned DEFAULT NULL, + `TRUNCATE(a,0)` bigint(22) unsigned DEFAULT NULL, + `FLOOR(a)` bigint(22) unsigned DEFAULT NULL, + `CEILING(a)` bigint(22) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 +TRUNCATE(a,0) 0 +FLOOR(a) 0 +CEILING(a) 0 +a 18446744073709551615 +ROUND(a) 18446744073709551615 +ROUND(a,1) 18446744073709551615 +ROUND(a,10) 18446744073709551615 +TRUNCATE(a,0) 18446744073709551615 +FLOOR(a) 18446744073709551615 +CEILING(a) 18446744073709551615 +CALL p1('bigint(23) unsigned'); + bigint(23) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(23) unsigned DEFAULT NULL, + `ROUND(a)` bigint(23) unsigned DEFAULT NULL, + `ROUND(a,1)` bigint(23) unsigned DEFAULT NULL, + `ROUND(a,10)` bigint(23) unsigned DEFAULT NULL, + `TRUNCATE(a,0)` bigint(23) unsigned DEFAULT NULL, + `FLOOR(a)` bigint(23) unsigned DEFAULT NULL, + `CEILING(a)` bigint(23) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 +TRUNCATE(a,0) 0 +FLOOR(a) 0 +CEILING(a) 0 +a 18446744073709551615 +ROUND(a) 18446744073709551615 +ROUND(a,1) 18446744073709551615 +ROUND(a,10) 18446744073709551615 +TRUNCATE(a,0) 18446744073709551615 +FLOOR(a) 18446744073709551615 +CEILING(a) 18446744073709551615 +CALL p1('bigint(30) unsigned'); + bigint(30) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(30) unsigned DEFAULT NULL, + `ROUND(a)` bigint(30) unsigned DEFAULT NULL, + `ROUND(a,1)` bigint(30) unsigned DEFAULT NULL, + `ROUND(a,10)` bigint(30) unsigned DEFAULT NULL, + `TRUNCATE(a,0)` bigint(30) unsigned DEFAULT NULL, + `FLOOR(a)` bigint(30) unsigned DEFAULT NULL, + `CEILING(a)` bigint(30) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a) 0 +ROUND(a,1) 0 +ROUND(a,10) 0 +TRUNCATE(a,0) 0 +FLOOR(a) 0 +CEILING(a) 0 +a 18446744073709551615 +ROUND(a) 18446744073709551615 +ROUND(a,1) 18446744073709551615 +ROUND(a,10) 18446744073709551615 TRUNCATE(a,0) 18446744073709551615 FLOOR(a) 18446744073709551615 CEILING(a) 18446744073709551615 DROP PROCEDURE p1; # +# MDEV-23368 ROUND(18446744073709551615,-11) returns a wrong result +# +SELECT ROUND(18446744073709551615,-10), ROUND(18446744073709551615,-11); +ROUND(18446744073709551615,-10) ROUND(18446744073709551615,-11) +18446744070000000000 18446744100000000000 +CREATE TABLE t1 AS SELECT ROUND(18446744073709551615,-10), ROUND(18446744073709551615,-11); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `ROUND(18446744073709551615,-10)` decimal(21,0) unsigned NOT NULL, + `ROUND(18446744073709551615,-11)` decimal(21,0) unsigned NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t1; +ROUND(18446744073709551615,-10) ROUND(18446744073709551615,-11) +18446744070000000000 18446744100000000000 +DROP TABLE t1; +# +# MDEV-23367 ROUND(18446744073709551615,-1) returns a wrong result +# +SELECT +ROUND(18446744073709551615,-1) AS c01, +ROUND(18446744073709551615,-19) AS c19; +c01 18446744073709551620 +c19 20000000000000000000 +CREATE OR REPLACE TABLE t1 AS +SELECT +ROUND(18446744073709551615,-1) AS c01, +ROUND(18446744073709551615,-19) AS c19; +SELECT * FROM t1; +c01 18446744073709551620 +c19 20000000000000000000 +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `c01` decimal(21,0) unsigned NOT NULL, + `c19` decimal(21,0) unsigned NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE PROCEDURE p1(t VARCHAR(64)) +BEGIN +SELECT t AS ``; +EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a TYPE)', 'TYPE', t); +INSERT IGNORE INTO t1 VALUES (-100000000000000000000000000000); +INSERT IGNORE INTO t1 VALUES (100000000000000000000000000000); +CREATE TABLE t2 AS SELECT +a, ROUND(a,-1), ROUND(a,-2), ROUND(a,-19), ROUND(a,-20), ROUND(a,-30) +FROM t1 +ORDER BY a; +SHOW CREATE TABLE t2; +SELECT * FROM t2; +DROP TABLE t1, t2; +END; +$$ +CALL p1('tinyint'); + tinyint +Table t2 +Create Table CREATE TABLE `t2` ( + `a` tinyint(4) DEFAULT NULL, + `ROUND(a,-1)` int(5) DEFAULT NULL, + `ROUND(a,-2)` int(5) DEFAULT NULL, + `ROUND(a,-19)` int(5) DEFAULT NULL, + `ROUND(a,-20)` int(5) DEFAULT NULL, + `ROUND(a,-30)` int(5) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -128 +ROUND(a,-1) -130 +ROUND(a,-2) -100 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 127 +ROUND(a,-1) 130 +ROUND(a,-2) 100 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('smallint'); + smallint +Table t2 +Create Table CREATE TABLE `t2` ( + `a` smallint(6) DEFAULT NULL, + `ROUND(a,-1)` int(7) DEFAULT NULL, + `ROUND(a,-2)` int(7) DEFAULT NULL, + `ROUND(a,-19)` int(7) DEFAULT NULL, + `ROUND(a,-20)` int(7) DEFAULT NULL, + `ROUND(a,-30)` int(7) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -32768 +ROUND(a,-1) -32770 +ROUND(a,-2) -32800 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 32767 +ROUND(a,-1) 32770 +ROUND(a,-2) 32800 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('mediumint'); + mediumint +Table t2 +Create Table CREATE TABLE `t2` ( + `a` mediumint(9) DEFAULT NULL, + `ROUND(a,-1)` bigint(10) DEFAULT NULL, + `ROUND(a,-2)` bigint(10) DEFAULT NULL, + `ROUND(a,-19)` bigint(10) DEFAULT NULL, + `ROUND(a,-20)` bigint(10) DEFAULT NULL, + `ROUND(a,-30)` bigint(10) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -8388608 +ROUND(a,-1) -8388610 +ROUND(a,-2) -8388600 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 8388607 +ROUND(a,-1) 8388610 +ROUND(a,-2) 8388600 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('int'); + int +Table t2 +Create Table CREATE TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `ROUND(a,-1)` bigint(12) DEFAULT NULL, + `ROUND(a,-2)` bigint(12) DEFAULT NULL, + `ROUND(a,-19)` bigint(12) DEFAULT NULL, + `ROUND(a,-20)` bigint(12) DEFAULT NULL, + `ROUND(a,-30)` bigint(12) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -2147483648 +ROUND(a,-1) -2147483650 +ROUND(a,-2) -2147483600 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 2147483647 +ROUND(a,-1) 2147483650 +ROUND(a,-2) 2147483600 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint'); + bigint +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(20) DEFAULT NULL, + `ROUND(a,-1)` decimal(20,0) DEFAULT NULL, + `ROUND(a,-2)` decimal(20,0) DEFAULT NULL, + `ROUND(a,-19)` decimal(20,0) DEFAULT NULL, + `ROUND(a,-20)` decimal(20,0) DEFAULT NULL, + `ROUND(a,-30)` decimal(20,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a,-1) -9223372036854775810 +ROUND(a,-2) -9223372036854775800 +ROUND(a,-19) -10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 9223372036854775807 +ROUND(a,-1) 9223372036854775810 +ROUND(a,-2) 9223372036854775800 +ROUND(a,-19) 10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(20)'); + bigint(20) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(20) DEFAULT NULL, + `ROUND(a,-1)` decimal(20,0) DEFAULT NULL, + `ROUND(a,-2)` decimal(20,0) DEFAULT NULL, + `ROUND(a,-19)` decimal(20,0) DEFAULT NULL, + `ROUND(a,-20)` decimal(20,0) DEFAULT NULL, + `ROUND(a,-30)` decimal(20,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a,-1) -9223372036854775810 +ROUND(a,-2) -9223372036854775800 +ROUND(a,-19) -10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 9223372036854775807 +ROUND(a,-1) 9223372036854775810 +ROUND(a,-2) 9223372036854775800 +ROUND(a,-19) 10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(21)'); + bigint(21) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(21) DEFAULT NULL, + `ROUND(a,-1)` decimal(21,0) DEFAULT NULL, + `ROUND(a,-2)` decimal(21,0) DEFAULT NULL, + `ROUND(a,-19)` decimal(21,0) DEFAULT NULL, + `ROUND(a,-20)` decimal(21,0) DEFAULT NULL, + `ROUND(a,-30)` decimal(21,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a,-1) -9223372036854775810 +ROUND(a,-2) -9223372036854775800 +ROUND(a,-19) -10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 9223372036854775807 +ROUND(a,-1) 9223372036854775810 +ROUND(a,-2) 9223372036854775800 +ROUND(a,-19) 10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(22)'); + bigint(22) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(22) DEFAULT NULL, + `ROUND(a,-1)` decimal(22,0) DEFAULT NULL, + `ROUND(a,-2)` decimal(22,0) DEFAULT NULL, + `ROUND(a,-19)` decimal(22,0) DEFAULT NULL, + `ROUND(a,-20)` decimal(22,0) DEFAULT NULL, + `ROUND(a,-30)` decimal(22,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a,-1) -9223372036854775810 +ROUND(a,-2) -9223372036854775800 +ROUND(a,-19) -10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 9223372036854775807 +ROUND(a,-1) 9223372036854775810 +ROUND(a,-2) 9223372036854775800 +ROUND(a,-19) 10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(23)'); + bigint(23) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(23) DEFAULT NULL, + `ROUND(a,-1)` decimal(23,0) DEFAULT NULL, + `ROUND(a,-2)` decimal(23,0) DEFAULT NULL, + `ROUND(a,-19)` decimal(23,0) DEFAULT NULL, + `ROUND(a,-20)` decimal(23,0) DEFAULT NULL, + `ROUND(a,-30)` decimal(23,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a,-1) -9223372036854775810 +ROUND(a,-2) -9223372036854775800 +ROUND(a,-19) -10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 9223372036854775807 +ROUND(a,-1) 9223372036854775810 +ROUND(a,-2) 9223372036854775800 +ROUND(a,-19) 10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(30)'); + bigint(30) +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(30) DEFAULT NULL, + `ROUND(a,-1)` decimal(30,0) DEFAULT NULL, + `ROUND(a,-2)` decimal(30,0) DEFAULT NULL, + `ROUND(a,-19)` decimal(30,0) DEFAULT NULL, + `ROUND(a,-20)` decimal(30,0) DEFAULT NULL, + `ROUND(a,-30)` decimal(30,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a -9223372036854775808 +ROUND(a,-1) -9223372036854775810 +ROUND(a,-2) -9223372036854775800 +ROUND(a,-19) -10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 9223372036854775807 +ROUND(a,-1) 9223372036854775810 +ROUND(a,-2) 9223372036854775800 +ROUND(a,-19) 10000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('tinyint unsigned'); + tinyint unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` tinyint(3) unsigned DEFAULT NULL, + `ROUND(a,-1)` int(4) unsigned DEFAULT NULL, + `ROUND(a,-2)` int(4) unsigned DEFAULT NULL, + `ROUND(a,-19)` int(4) unsigned DEFAULT NULL, + `ROUND(a,-20)` int(4) unsigned DEFAULT NULL, + `ROUND(a,-30)` int(4) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 255 +ROUND(a,-1) 260 +ROUND(a,-2) 300 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('smallint unsigned'); + smallint unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` smallint(5) unsigned DEFAULT NULL, + `ROUND(a,-1)` int(6) unsigned DEFAULT NULL, + `ROUND(a,-2)` int(6) unsigned DEFAULT NULL, + `ROUND(a,-19)` int(6) unsigned DEFAULT NULL, + `ROUND(a,-20)` int(6) unsigned DEFAULT NULL, + `ROUND(a,-30)` int(6) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 65535 +ROUND(a,-1) 65540 +ROUND(a,-2) 65500 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('mediumint unsigned'); + mediumint unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` mediumint(8) unsigned DEFAULT NULL, + `ROUND(a,-1)` int(9) unsigned DEFAULT NULL, + `ROUND(a,-2)` int(9) unsigned DEFAULT NULL, + `ROUND(a,-19)` int(9) unsigned DEFAULT NULL, + `ROUND(a,-20)` int(9) unsigned DEFAULT NULL, + `ROUND(a,-30)` int(9) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 16777215 +ROUND(a,-1) 16777220 +ROUND(a,-2) 16777200 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('int unsigned'); + int unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` int(10) unsigned DEFAULT NULL, + `ROUND(a,-1)` bigint(11) unsigned DEFAULT NULL, + `ROUND(a,-2)` bigint(11) unsigned DEFAULT NULL, + `ROUND(a,-19)` bigint(11) unsigned DEFAULT NULL, + `ROUND(a,-20)` bigint(11) unsigned DEFAULT NULL, + `ROUND(a,-30)` bigint(11) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 4294967295 +ROUND(a,-1) 4294967300 +ROUND(a,-2) 4294967300 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint unsigned'); + bigint unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(20) unsigned DEFAULT NULL, + `ROUND(a,-1)` decimal(21,0) unsigned DEFAULT NULL, + `ROUND(a,-2)` decimal(21,0) unsigned DEFAULT NULL, + `ROUND(a,-19)` decimal(21,0) unsigned DEFAULT NULL, + `ROUND(a,-20)` decimal(21,0) unsigned DEFAULT NULL, + `ROUND(a,-30)` decimal(21,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 18446744073709551615 +ROUND(a,-1) 18446744073709551620 +ROUND(a,-2) 18446744073709551600 +ROUND(a,-19) 20000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(20) unsigned'); + bigint(20) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(20) unsigned DEFAULT NULL, + `ROUND(a,-1)` decimal(21,0) unsigned DEFAULT NULL, + `ROUND(a,-2)` decimal(21,0) unsigned DEFAULT NULL, + `ROUND(a,-19)` decimal(21,0) unsigned DEFAULT NULL, + `ROUND(a,-20)` decimal(21,0) unsigned DEFAULT NULL, + `ROUND(a,-30)` decimal(21,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 18446744073709551615 +ROUND(a,-1) 18446744073709551620 +ROUND(a,-2) 18446744073709551600 +ROUND(a,-19) 20000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(21) unsigned'); + bigint(21) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(21) unsigned DEFAULT NULL, + `ROUND(a,-1)` decimal(22,0) unsigned DEFAULT NULL, + `ROUND(a,-2)` decimal(22,0) unsigned DEFAULT NULL, + `ROUND(a,-19)` decimal(22,0) unsigned DEFAULT NULL, + `ROUND(a,-20)` decimal(22,0) unsigned DEFAULT NULL, + `ROUND(a,-30)` decimal(22,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 18446744073709551615 +ROUND(a,-1) 18446744073709551620 +ROUND(a,-2) 18446744073709551600 +ROUND(a,-19) 20000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(22) unsigned'); + bigint(22) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(22) unsigned DEFAULT NULL, + `ROUND(a,-1)` decimal(23,0) unsigned DEFAULT NULL, + `ROUND(a,-2)` decimal(23,0) unsigned DEFAULT NULL, + `ROUND(a,-19)` decimal(23,0) unsigned DEFAULT NULL, + `ROUND(a,-20)` decimal(23,0) unsigned DEFAULT NULL, + `ROUND(a,-30)` decimal(23,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 18446744073709551615 +ROUND(a,-1) 18446744073709551620 +ROUND(a,-2) 18446744073709551600 +ROUND(a,-19) 20000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(23) unsigned'); + bigint(23) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(23) unsigned DEFAULT NULL, + `ROUND(a,-1)` decimal(24,0) unsigned DEFAULT NULL, + `ROUND(a,-2)` decimal(24,0) unsigned DEFAULT NULL, + `ROUND(a,-19)` decimal(24,0) unsigned DEFAULT NULL, + `ROUND(a,-20)` decimal(24,0) unsigned DEFAULT NULL, + `ROUND(a,-30)` decimal(24,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 18446744073709551615 +ROUND(a,-1) 18446744073709551620 +ROUND(a,-2) 18446744073709551600 +ROUND(a,-19) 20000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +CALL p1('bigint(30) unsigned'); + bigint(30) unsigned +Table t2 +Create Table CREATE TABLE `t2` ( + `a` bigint(30) unsigned DEFAULT NULL, + `ROUND(a,-1)` decimal(31,0) unsigned DEFAULT NULL, + `ROUND(a,-2)` decimal(31,0) unsigned DEFAULT NULL, + `ROUND(a,-19)` decimal(31,0) unsigned DEFAULT NULL, + `ROUND(a,-20)` decimal(31,0) unsigned DEFAULT NULL, + `ROUND(a,-30)` decimal(31,0) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +a 0 +ROUND(a,-1) 0 +ROUND(a,-2) 0 +ROUND(a,-19) 0 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +a 18446744073709551615 +ROUND(a,-1) 18446744073709551620 +ROUND(a,-2) 18446744073709551600 +ROUND(a,-19) 20000000000000000000 +ROUND(a,-20) 0 +ROUND(a,-30) 0 +DROP PROCEDURE p1; +# +# MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result +# +SELECT +ROUND(18446744073709551615,NULL) AS c1, +ROUND(18446744073709551615,rand()*0) AS c2, +ROUND(18446744073709551615,rand()*0-19) AS c3; +c1 NULL +c2 18446744073709551615 +c3 20000000000000000000 +CREATE OR REPLACE TABLE t1 AS +SELECT +ROUND(18446744073709551615,NULL) AS c1, +ROUND(18446744073709551615,rand()*0) AS c2, +ROUND(18446744073709551615,rand()*0-19) AS c3; +SELECT * FROM t1; +c1 NULL +c2 18446744073709551615 +c3 20000000000000000000 +SHOW CREATE TABLE t1; +Table t1 +Create Table CREATE TABLE `t1` ( + `c1` bigint(20) unsigned DEFAULT NULL, + `c2` decimal(21,0) unsigned NOT NULL, + `c3` decimal(21,0) unsigned NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# # End of 10.4 tests # # diff --git a/mysql-test/main/type_int.test b/mysql-test/main/type_int.test index 04cb9edf606..c2edb0a9756 100644 --- a/mysql-test/main/type_int.test +++ b/mysql-test/main/type_int.test @@ -295,6 +295,7 @@ DROP TABLE t1; --echo # --echo # MDEV-23337 Rounding functions create a wrong data type for numeric input +--echo # MDEV-23350 ROUND(bigint_22_or_longer) returns a wrong data type --echo # DELIMITER $$; @@ -304,7 +305,7 @@ BEGIN EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a TYPE)', 'TYPE', t); INSERT IGNORE INTO t1 VALUES (-100000000000000000000000000000); INSERT IGNORE INTO t1 VALUES (100000000000000000000000000000); - CREATE TABLE t2 AS SELECT a, ROUND(a), TRUNCATE(a,0), FLOOR(a), CEILING(a) FROM t1; + CREATE TABLE t2 AS SELECT a, ROUND(a), ROUND(a,1), ROUND(a,10), TRUNCATE(a,0), FLOOR(a), CEILING(a) FROM t1; SHOW CREATE TABLE t2; SELECT * FROM t2; DROP TABLE t1, t2; @@ -318,16 +319,122 @@ CALL p1('smallint'); CALL p1('mediumint'); CALL p1('int'); CALL p1('bigint'); +CALL p1('bigint(20)'); +CALL p1('bigint(21)'); +CALL p1('bigint(22)'); +CALL p1('bigint(23)'); +CALL p1('bigint(30)'); CALL p1('tinyint unsigned'); CALL p1('smallint unsigned'); CALL p1('mediumint unsigned'); CALL p1('int unsigned'); CALL p1('bigint unsigned'); +CALL p1('bigint(20) unsigned'); +CALL p1('bigint(21) unsigned'); +CALL p1('bigint(22) unsigned'); +CALL p1('bigint(23) unsigned'); +CALL p1('bigint(30) unsigned'); --horizontal_results DROP PROCEDURE p1; +--echo # +--echo # MDEV-23368 ROUND(18446744073709551615,-11) returns a wrong result +--echo # + +SELECT ROUND(18446744073709551615,-10), ROUND(18446744073709551615,-11); +CREATE TABLE t1 AS SELECT ROUND(18446744073709551615,-10), ROUND(18446744073709551615,-11); +SHOW CREATE TABLE t1; +SELECT * FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-23367 ROUND(18446744073709551615,-1) returns a wrong result +--echo # + +--vertical_results +SELECT + ROUND(18446744073709551615,-1) AS c01, + ROUND(18446744073709551615,-19) AS c19; + +CREATE OR REPLACE TABLE t1 AS +SELECT + ROUND(18446744073709551615,-1) AS c01, + ROUND(18446744073709551615,-19) AS c19; + +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +--horizontal_results + +DELIMITER $$; +CREATE PROCEDURE p1(t VARCHAR(64)) +BEGIN + SELECT t AS ``; + EXECUTE IMMEDIATE REPLACE('CREATE TABLE t1 (a TYPE)', 'TYPE', t); + INSERT IGNORE INTO t1 VALUES (-100000000000000000000000000000); + INSERT IGNORE INTO t1 VALUES (100000000000000000000000000000); + CREATE TABLE t2 AS SELECT + a, ROUND(a,-1), ROUND(a,-2), ROUND(a,-19), ROUND(a,-20), ROUND(a,-30) + FROM t1 + ORDER BY a; + SHOW CREATE TABLE t2; + SELECT * FROM t2; + DROP TABLE t1, t2; +END; +$$ +DELIMITER ;$$ + +--vertical_results +CALL p1('tinyint'); +CALL p1('smallint'); +CALL p1('mediumint'); +CALL p1('int'); +CALL p1('bigint'); +CALL p1('bigint(20)'); +CALL p1('bigint(21)'); +CALL p1('bigint(22)'); +CALL p1('bigint(23)'); +CALL p1('bigint(30)'); + +CALL p1('tinyint unsigned'); +CALL p1('smallint unsigned'); +CALL p1('mediumint unsigned'); +CALL p1('int unsigned'); +CALL p1('bigint unsigned'); +CALL p1('bigint(20) unsigned'); +CALL p1('bigint(21) unsigned'); +CALL p1('bigint(22) unsigned'); +CALL p1('bigint(23) unsigned'); +CALL p1('bigint(30) unsigned'); +--horizontal_results + +DROP PROCEDURE p1; + + +--echo # +--echo # MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result +--echo # + +--vertical_results +SELECT + ROUND(18446744073709551615,NULL) AS c1, + ROUND(18446744073709551615,rand()*0) AS c2, + ROUND(18446744073709551615,rand()*0-19) AS c3; + +CREATE OR REPLACE TABLE t1 AS +SELECT + ROUND(18446744073709551615,NULL) AS c1, + ROUND(18446744073709551615,rand()*0) AS c2, + ROUND(18446744073709551615,rand()*0-19) AS c3; + +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +--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 d5fc6db107b..eac263296e2 100644 --- a/mysql-test/main/type_newdecimal.result +++ b/mysql-test/main/type_newdecimal.result @@ -1532,11 +1532,8 @@ select (1.20396873 * 0.89550000 * 0.68000000 * 1.08721696 * 0.99500000 * 1.01500000 * 1.01500000 * 0.99500000) 0.81298807395367312459230693948000000000 create table t1 as select 5.05 / 0.014; -Warnings: -Note 1265 Data truncated for column '5.05 / 0.014' at row 1 show warnings; Level Code Message -Note 1265 Data truncated for column '5.05 / 0.014' at row 1 show create table t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1651,8 +1648,6 @@ my_col 0.12345678912345678912345678912345678912 DROP TABLE t1; CREATE TABLE t1 SELECT 1 / .123456789123456789123456789123456789123456789123456789123456789123456789123456789 AS my_col; -Warnings: -Note 1265 Data truncated for column 'my_col' at row 1 DESCRIBE t1; Field Type Null Key Default Extra my_col decimal(65,4) YES NULL @@ -2345,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 # @@ -2411,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 @@ -1824,6 +1824,32 @@ CREATE TABLE t1 (a DECIMAL(2,1) DEFAULT 0.10001e0); 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 @@ -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/type_ranges.result b/mysql-test/main/type_ranges.result index 784a394d8b5..199c8a45c97 100644 --- a/mysql-test/main/type_ranges.result +++ b/mysql-test/main/type_ranges.result @@ -91,8 +91,6 @@ DROP INDEX test ON t1; insert into t1 values (10, 1,1,1,1,1,1,1,1,1,1,1,1,1,NULL,0,0,0,1,1,1,1,'one','one'); insert into t1 values (NULL,2,2,2,2,2,2,2,2,2,2,2,2,2,NULL,NULL,NULL,NULL,NULL,NULL,2,2,'two','two,one'); insert ignore into t1 values (0,1/3,3,3,3,3,3,3,3,3,3,3,3,3,NULL,'19970303','10:10:10','19970303101010','','','','3',3,3); -Warnings: -Warning 1265 Data truncated for column 'string' at row 1 insert ignore into t1 values (0,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,NULL,19970807,080706,19970403090807,-1,-1,-1,'-1',-1,-1); Warnings: Warning 1264 Out of range value for column 'utiny' at row 1 @@ -130,7 +128,7 @@ select auto,string,tiny,short,medium,long_int,longlong,real_float,real_double,ut auto string tiny short medium long_int longlong real_float real_double utiny ushort umedium ulong ulonglong mod(floor(time_stamp/1000000),1000000)-mod(curdate(),1000000) date_field time_field date_time blob_col tinyblob_col mediumblob_col longblob_col 10 1 1 1 1 1 1 1.0 1.0000 1 00001 1 1 1 0 0000-00-00 00:00:00 0000-00-00 00:00:00 1 1 1 1 11 2 2 2 2 2 2 2.0 2.0000 2 00002 2 2 2 0 NULL NULL NULL NULL NULL 2 2 -12 0.33333333 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3 +12 0.3333 3 3 3 3 3 3.0 3.0000 3 00003 3 3 3 0 1997-03-03 10:10:10 1997-03-03 10:10:10 3 13 -1 -1 -1 -1 -1 -1 -1.0 -1.0000 0 00000 0 0 0 0 1997-08-07 08:07:06 1997-04-03 09:08:07 -1 -1 -1 -1 14 -429496729 -128 -32768 -8388608 -2147483648 -4294967295 -4294967296.0 -4294967295.0000 0 00000 0 0 0 0 0000-00-00 00:00:00 0000-00-00 00:00:00 -4294967295 -4294967295 -4294967295 -4294967295 15 4294967295 127 32767 8388607 2147483647 4294967295 4294967296.0 4294967295.0000 255 65535 16777215 4294967295 4294967295 0 0000-00-00 00:00:00 0000-00-00 00:00:00 4294967295 4294967295 4294967295 4294967295 @@ -182,7 +180,7 @@ Warning 1265 Data truncated for column 'new_field' at row 7 select * from t2; auto string mediumblob_col new_field 1 2 2 ne -2 0.33333333 ne +2 0.3333 ne 3 -1 -1 ne 4 -429496729 -4294967295 ne 5 4294967295 4294967295 ne 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 @@ -2505,6 +2505,22 @@ SELECT cast((rank() over w1) as decimal (53,56)); --error ER_WRONG_WINDOW_SPEC_NAME 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/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index de07d018bdf..f3f50fdb2d0 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -179,6 +179,7 @@ my @DEFAULT_SUITES= qw( csv- compat/oracle- compat/mssql- + compat/maxdb- encryption- federated- funcs_1- @@ -691,8 +692,7 @@ sub run_test_server ($$$) { My::CoreDump->show($core_file, $exe_mysqld, $opt_parallel); # Limit number of core files saved - if ($opt_max_save_core > 0 && - $num_saved_cores >= $opt_max_save_core) + if ($num_saved_cores >= $opt_max_save_core) { mtr_report(" - deleting it, already saved", "$opt_max_save_core"); @@ -708,8 +708,7 @@ sub run_test_server ($$$) { }, $worker_savedir); - if ($opt_max_save_datadir > 0 && - $num_saved_datadir >= $opt_max_save_datadir) + if ($num_saved_datadir >= $opt_max_save_datadir) { mtr_report(" - skipping '$worker_savedir/'"); rmtree($worker_savedir); @@ -718,9 +717,9 @@ sub run_test_server ($$$) { { mtr_report(" - saving '$worker_savedir/' to '$savedir/'"); rename($worker_savedir, $savedir); + $num_saved_datadir++; } resfile_print_test(); - $num_saved_datadir++; $num_failed_test++ unless ($result->{retries} || $result->{exp_fail}); @@ -1277,6 +1276,17 @@ sub command_line_setup { report_option('verbose', $opt_verbose); } + # Negative values aren't meaningful on integer options + foreach(grep(/=i$/, keys %options)) + { + if (defined ${$options{$_}} && + do { no warnings "numeric"; int ${$options{$_}} < 0}) + { + my $v= (split /=/)[0]; + die("$v doesn't accept a negative value:"); + } + } + # Find the absolute path to the test directory $glob_mysql_test_dir= cwd(); if ($glob_mysql_test_dir =~ / /) @@ -6458,12 +6468,12 @@ Options for debugging the product test(s) max-save-core Limit the number of core files saved (to avoid filling up disks for heavily crashing server). Defaults to - $opt_max_save_core, set to 0 for no limit. Set - it's default with MTR_MAX_SAVE_CORE + $opt_max_save_core. Set its default with + MTR_MAX_SAVE_CORE max-save-datadir Limit the number of datadir saved (to avoid filling up disks for heavily crashing server). Defaults to - $opt_max_save_datadir, set to 0 for no limit. Set - it's default with MTR_MAX_SAVE_DATADIR + $opt_max_save_datadir. Set its default with + MTR_MAX_SAVE_DATADIR max-test-fail Limit the number of test failures before aborting the current test run. Defaults to $opt_max_test_fail, set to 0 for no limit. Set diff --git a/mysql-test/suite/compat/maxdb/rpl_mariadb_timestamp.result b/mysql-test/suite/compat/maxdb/rpl_mariadb_timestamp.result new file mode 100644 index 00000000000..7c2012945c9 --- /dev/null +++ b/mysql-test/suite/compat/maxdb/rpl_mariadb_timestamp.result @@ -0,0 +1,65 @@ +include/master-slave.inc +[connection master] +# +# MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode +# +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:00:00'); +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +SET sql_mode=MAXDB; +CREATE TABLE t2 SELECT * FROM t1; +SET timestamp=DEFAULT; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a TIMESTAMP) +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES ('2001-01-01 10:20:30') +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE "t2" ( + "a" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp() +) +master-bin.000001 # Annotate_rows # # CREATE TABLE t2 SELECT * FROM t1 +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +connection slave; +SELECT * FROM t1; +a +2001-01-01 10:00:00 +2001-01-01 10:20:30 +SET sql_mode=DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` timestamp NOT NULL DEFAULT current_timestamp() +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET sql_mode=MAXDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp() +) +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE "t2" ( + "a" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp() +) +connection master; +DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/compat/maxdb/rpl_mariadb_timestamp.test b/mysql-test/suite/compat/maxdb/rpl_mariadb_timestamp.test new file mode 100644 index 00000000000..50663229937 --- /dev/null +++ b/mysql-test/suite/compat/maxdb/rpl_mariadb_timestamp.test @@ -0,0 +1,34 @@ +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +--echo # +--echo # MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode +--echo # + +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:00:00'); +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +SET sql_mode=MAXDB; +CREATE TABLE t2 SELECT * FROM t1; +SET timestamp=DEFAULT; + +--let $binlog_file = LAST +source include/show_binlog_events.inc; + + +--sync_slave_with_master +SELECT * FROM t1; +SET sql_mode=DEFAULT; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +SET sql_mode=MAXDB; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +--connection master +DROP TABLE t1, t2; + +--source include/rpl_end.inc diff --git a/mysql-test/suite/compat/maxdb/type_timestamp.result b/mysql-test/suite/compat/maxdb/type_timestamp.result new file mode 100644 index 00000000000..355a4e28414 --- /dev/null +++ b/mysql-test/suite/compat/maxdb/type_timestamp.result @@ -0,0 +1,53 @@ +# +# MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 ( +def_timestamp TIMESTAMP, +mdb_timestamp mariadb_schema.TIMESTAMP, +ora_timestamp oracle_schema.TIMESTAMP, +max_timestamp maxdb_schema.TIMESTAMP +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `def_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `mdb_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `ora_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `max_timestamp` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET sql_mode=MAXDB; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "def_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp(), + "mdb_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + "ora_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + "max_timestamp" datetime DEFAULT NULL +) +DROP TABLE t1; +SET sql_mode=MAXDB; +CREATE TABLE t1 ( +def_timestamp TIMESTAMP, +mdb_timestamp mariadb_schema.TIMESTAMP, +ora_timestamp oracle_schema.TIMESTAMP, +max_timestamp maxdb_schema.TIMESTAMP +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "def_timestamp" datetime DEFAULT NULL, + "mdb_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT current_timestamp(), + "ora_timestamp" mariadb_schema.timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + "max_timestamp" datetime DEFAULT NULL +) +SET sql_mode=DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `def_timestamp` datetime DEFAULT NULL, + `mdb_timestamp` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), + `ora_timestamp` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', + `max_timestamp` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; diff --git a/mysql-test/suite/compat/maxdb/type_timestamp.test b/mysql-test/suite/compat/maxdb/type_timestamp.test new file mode 100644 index 00000000000..cd60ffc0795 --- /dev/null +++ b/mysql-test/suite/compat/maxdb/type_timestamp.test @@ -0,0 +1,29 @@ +--echo # +--echo # MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode +--echo # + + +SET sql_mode=DEFAULT; +CREATE TABLE t1 ( + def_timestamp TIMESTAMP, + mdb_timestamp mariadb_schema.TIMESTAMP, + ora_timestamp oracle_schema.TIMESTAMP, + max_timestamp maxdb_schema.TIMESTAMP +); +SHOW CREATE TABLE t1; +SET sql_mode=MAXDB; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +SET sql_mode=MAXDB; +CREATE TABLE t1 ( + def_timestamp TIMESTAMP, + mdb_timestamp mariadb_schema.TIMESTAMP, + ora_timestamp oracle_schema.TIMESTAMP, + max_timestamp maxdb_schema.TIMESTAMP +); +SHOW CREATE TABLE t1; +SET sql_mode=DEFAULT; +SHOW CREATE TABLE t1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/r/rpl_mariadb_date.result b/mysql-test/suite/compat/oracle/r/rpl_mariadb_date.result new file mode 100644 index 00000000000..9aca6fa3542 --- /dev/null +++ b/mysql-test/suite/compat/oracle/r/rpl_mariadb_date.result @@ -0,0 +1,86 @@ +include/master-slave.inc +[connection master] +SET SQL_MODE=DEFAULT; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES ('2001-01-01'); +SET SQL_MODE= ORACLE; +CREATE TABLE t2 SELECT * FROM t1; +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Gtid # # GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE t1 (a DATE) +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES (NULL) +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Annotate_rows # # INSERT INTO t1 VALUES ('2001-01-01') +master-bin.000001 # Table_map # # table_id: # (test.t1) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +master-bin.000001 # Gtid # # BEGIN GTID #-#-# +master-bin.000001 # Query # # use `test`; CREATE TABLE "t2" ( + "a" mariadb_schema.date DEFAULT NULL +) +master-bin.000001 # Annotate_rows # # CREATE TABLE t2 SELECT * FROM t1 +master-bin.000001 # Table_map # # table_id: # (test.t2) +master-bin.000001 # Write_rows_v1 # # table_id: # flags: STMT_END_F +master-bin.000001 # Query # # COMMIT +SET SQL_MODE= DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET SQL_MODE= ORACLE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mariadb_schema.date DEFAULT NULL +) +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE "t2" ( + "a" mariadb_schema.date DEFAULT NULL +) +connection slave; +SELECT * FROM t1; +a +NULL +2001-01-01 +SELECT * FROM t2; +a +NULL +2001-01-01 +SET SQL_MODE= DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET SQL_MODE= ORACLE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mariadb_schema.date DEFAULT NULL +) +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE "t2" ( + "a" mariadb_schema.date DEFAULT NULL +) +connection master; +DROP TABLE t1, t2; +include/rpl_end.inc diff --git a/mysql-test/suite/compat/oracle/r/type_date.result b/mysql-test/suite/compat/oracle/r/type_date.result index 0989fc593d2..ea37375c364 100644 --- a/mysql-test/suite/compat/oracle/r/type_date.result +++ b/mysql-test/suite/compat/oracle/r/type_date.result @@ -6,3 +6,150 @@ t1 CREATE TABLE "t1" ( "a" datetime DEFAULT NULL ) DROP TABLE t1; +# +# MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a unknown.DATE); +ERROR HY000: Unknown data type: 'unknown.date' +SET sql_mode=DEFAULT; +CREATE TABLE t1 ( +def_date DATE, +mdb_date mariadb_schema.DATE, +ora_date oracle_schema.DATE, +max_date maxdb_schema.DATE +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `def_date` date DEFAULT NULL, + `mdb_date` date DEFAULT NULL, + `ora_date` datetime DEFAULT NULL, + `max_date` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SET sql_mode=ORACLE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "def_date" mariadb_schema.date DEFAULT NULL, + "mdb_date" mariadb_schema.date DEFAULT NULL, + "ora_date" datetime DEFAULT NULL, + "max_date" mariadb_schema.date DEFAULT NULL +) +DROP TABLE t1; +SET sql_mode=ORACLE; +CREATE TABLE t1 ( +def_date DATE, +mdb_date mariadb_schema.DATE, +ora_date oracle_schema.DATE, +max_date maxdb_schema.DATE +); +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "def_date" datetime DEFAULT NULL, + "mdb_date" mariadb_schema.date DEFAULT NULL, + "ora_date" datetime DEFAULT NULL, + "max_date" mariadb_schema.date DEFAULT NULL +) +SET sql_mode=DEFAULT; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `def_date` datetime DEFAULT NULL, + `mdb_date` date DEFAULT NULL, + `ora_date` datetime DEFAULT NULL, + `max_date` date DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +# +# ALTER..MODIFY and ALTER..CHANGE understand qualifiers +# +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'); +SET sql_mode=ORACLE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mariadb_schema.date DEFAULT NULL +) +SELECT * FROM t1; +a +2001-01-01 +ALTER TABLE t1 MODIFY a DATE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" datetime DEFAULT NULL +) +SELECT * FROM t1; +a +2001-01-01 00:00:00 +ALTER TABLE t1 MODIFY a mariadb_schema.DATE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" mariadb_schema.date DEFAULT NULL +) +SELECT * FROM t1; +a +2001-01-01 +ALTER TABLE t1 MODIFY a oracle_schema.DATE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" datetime DEFAULT NULL +) +SELECT * FROM t1; +a +2001-01-01 00:00:00 +ALTER TABLE t1 CHANGE a b mariadb_schema.DATE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "b" mariadb_schema.date DEFAULT NULL +) +SELECT * FROM t1; +b +2001-01-01 +ALTER TABLE t1 CHANGE b a oracle_schema.DATE; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE "t1" ( + "a" datetime DEFAULT NULL +) +SELECT * FROM t1; +a +2001-01-01 00:00:00 +DROP TABLE t1; +# +# Qualified syntax is not supported yet in SP +# See MDEV-23353 Qualified data types in SP +# +SET sql_mode=ORACLE; +CREATE FUNCTION f1() RETURN mariadb_schema.DATE AS +BEGIN +RETURN CURRENT_DATE; +END; +$$ +ERROR HY000: Unknown data type: 'mariadb_schema' +CREATE PROCEDURE p1(a mariadb_schema.DATE) AS +BEGIN +NULL; +END; +$$ +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 ') AS +BEGIN +NULL; +END' at line 1 +CREATE PROCEDURE p1() AS +a mariadb_schema.DATE; +BEGIN +NULL; +END; +$$ +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 '; +BEGIN +NULL; +END' at line 2 diff --git a/mysql-test/suite/compat/oracle/t/rpl_mariadb_date.test b/mysql-test/suite/compat/oracle/t/rpl_mariadb_date.test new file mode 100644 index 00000000000..b2aff23333b --- /dev/null +++ b/mysql-test/suite/compat/oracle/t/rpl_mariadb_date.test @@ -0,0 +1,38 @@ +--source include/have_binlog_format_row.inc +--source include/master-slave.inc + +SET SQL_MODE=DEFAULT; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES (NULL); +INSERT INTO t1 VALUES ('2001-01-01'); + +SET SQL_MODE= ORACLE; +CREATE TABLE t2 SELECT * FROM t1; + +--let $binlog_file = LAST +source include/show_binlog_events.inc; + +SET SQL_MODE= DEFAULT; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +SET SQL_MODE= ORACLE; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +--sync_slave_with_master +SELECT * FROM t1; +SELECT * FROM t2; + +SET SQL_MODE= DEFAULT; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +SET SQL_MODE= ORACLE; +SHOW CREATE TABLE t1; +SHOW CREATE TABLE t2; + +# Cleanup +--connection master +DROP TABLE t1, t2; +--source include/rpl_end.inc diff --git a/mysql-test/suite/compat/oracle/t/type_date.test b/mysql-test/suite/compat/oracle/t/type_date.test index 61f7aa53944..f6886d15090 100644 --- a/mysql-test/suite/compat/oracle/t/type_date.test +++ b/mysql-test/suite/compat/oracle/t/type_date.test @@ -2,3 +2,100 @@ SET sql_mode=ORACLE; CREATE TABLE t1 (a DATE); SHOW CREATE TABLE t1; DROP TABLE t1; + + +--echo # +--echo # MDEV-19632 Replication aborts with ER_SLAVE_CONVERSION_FAILED upon CREATE ... SELECT in ORACLE mode +--echo # + +SET sql_mode=DEFAULT; +--error ER_UNKNOWN_DATA_TYPE +CREATE TABLE t1 (a unknown.DATE); + + +SET sql_mode=DEFAULT; +CREATE TABLE t1 ( + def_date DATE, + mdb_date mariadb_schema.DATE, + ora_date oracle_schema.DATE, + max_date maxdb_schema.DATE +); +SHOW CREATE TABLE t1; +SET sql_mode=ORACLE; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +SET sql_mode=ORACLE; +CREATE TABLE t1 ( + def_date DATE, + mdb_date mariadb_schema.DATE, + ora_date oracle_schema.DATE, + max_date maxdb_schema.DATE +); +SHOW CREATE TABLE t1; +SET sql_mode=DEFAULT; +SHOW CREATE TABLE t1; +DROP TABLE t1; + + +--echo # +--echo # ALTER..MODIFY and ALTER..CHANGE understand qualifiers +--echo # + +SET sql_mode=DEFAULT; +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES ('2001-01-01'); +SET sql_mode=ORACLE; +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +ALTER TABLE t1 MODIFY a DATE; +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +ALTER TABLE t1 MODIFY a mariadb_schema.DATE; +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +ALTER TABLE t1 MODIFY a oracle_schema.DATE; +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +ALTER TABLE t1 CHANGE a b mariadb_schema.DATE; +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +ALTER TABLE t1 CHANGE b a oracle_schema.DATE; +SHOW CREATE TABLE t1; +SELECT * FROM t1; + +DROP TABLE t1; + +--echo # +--echo # Qualified syntax is not supported yet in SP +--echo # See MDEV-23353 Qualified data types in SP +--echo # + +SET sql_mode=ORACLE; +DELIMITER $$; +--error ER_UNKNOWN_DATA_TYPE +CREATE FUNCTION f1() RETURN mariadb_schema.DATE AS +BEGIN + RETURN CURRENT_DATE; +END; +$$ +--error ER_PARSE_ERROR +CREATE PROCEDURE p1(a mariadb_schema.DATE) AS +BEGIN + NULL; +END; +$$ +--error ER_PARSE_ERROR +CREATE PROCEDURE p1() AS + a mariadb_schema.DATE; +BEGIN + NULL; +END; +$$ +DELIMITER ;$$ diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result index 1e6b7a08558..f167712d048 100644 --- a/mysql-test/suite/engines/iuds/r/insert_decimal.result +++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result @@ -1896,9 +1896,13 @@ Warnings: Warning 1264 Out of range value for column 'c1' at row 3 INSERT IGNORE INTO t5 VALUES('1e+52','-1e+52','1e+52',5),('1e-52','-1e-52','1e-52',6); Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 Warning 1264 Out of range value for column 'c3' at row 1 INSERT IGNORE INTO t5 VALUES('1e+53','-1e+53','1e+53',7),('1e-53','-1e-53','1e-53',8); Warnings: +Warning 1264 Out of range value for column 'c1' at row 1 +Warning 1264 Out of range value for column 'c2' at row 1 Warning 1264 Out of range value for column 'c3' at row 1 SELECT * FROM t5; c1 c2 c3 c4 diff --git a/mysql-test/suite/galera/disabled.def b/mysql-test/suite/galera/disabled.def index cfab7ce3472..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() @@ -46,3 +47,4 @@ partition : MDEV-19958 Galera test failure on galera.partition query_cache: MDEV-15805 Test failure on galera.query_cache sql_log_bin : MDEV-21491 galera.sql_log_bin versioning_trx_id : MDEV-18590 galera.versioning_trx_id +MW-328A : MDEV-22666? 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/innodb/r/default_row_format_alter,compact.rdiff b/mysql-test/suite/innodb/r/default_row_format_alter,compact.rdiff index 09095c90e29..c6c582fab93 100644 --- a/mysql-test/suite/innodb/r/default_row_format_alter,compact.rdiff +++ b/mysql-test/suite/innodb/r/default_row_format_alter,compact.rdiff @@ -1,10 +1,19 @@ --- default_row_format_alter.result +++ default_row_format_alter,compact.reject -@@ -91,6 +91,6 @@ +@@ -91,7 +91,7 @@ ALTER TABLE t1 ADD b INT; SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; ROW_FORMAT -Dynamic ++Compact + DROP TABLE t1; + # + # MDEV-23345 Assertion not_redundant() == old.not_redundant() failed +@@ -102,6 +102,6 @@ + ALTER TABLE t1 DROP b; + SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; + ROW_FORMAT +-Dynamic +Compact DROP TABLE t1; SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/r/default_row_format_alter,redundant.rdiff b/mysql-test/suite/innodb/r/default_row_format_alter,redundant.rdiff index 972ee9bdac8..a05a9914271 100644 --- a/mysql-test/suite/innodb/r/default_row_format_alter,redundant.rdiff +++ b/mysql-test/suite/innodb/r/default_row_format_alter,redundant.rdiff @@ -1,10 +1,19 @@ --- default_row_format_alter.result -+++ default_row_format_alter,compact.reject -@@ -91,6 +91,6 @@ ++++ default_row_format_alter,redundant.reject +@@ -91,7 +91,7 @@ ALTER TABLE t1 ADD b INT; SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; ROW_FORMAT -Dynamic ++Redundant + DROP TABLE t1; + # + # MDEV-23345 Assertion not_redundant() == old.not_redundant() failed +@@ -102,6 +102,6 @@ + ALTER TABLE t1 DROP b; + SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; + ROW_FORMAT +-Dynamic +Redundant DROP TABLE t1; SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/r/default_row_format_alter.result b/mysql-test/suite/innodb/r/default_row_format_alter.result index 42d006a2dd3..363954c1a6c 100644 --- a/mysql-test/suite/innodb/r/default_row_format_alter.result +++ b/mysql-test/suite/innodb/r/default_row_format_alter.result @@ -93,4 +93,15 @@ SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; ROW_FORMAT Dynamic DROP TABLE t1; +# +# MDEV-23345 Assertion not_redundant() == old.not_redundant() failed +# +SET GLOBAL innodb_default_row_format = @row_format; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB; +SET GLOBAL innodb_default_row_format= COMPACT; +ALTER TABLE t1 DROP b; +SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +ROW_FORMAT +Dynamic +DROP TABLE t1; SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/r/read_only_recover_committed.result b/mysql-test/suite/innodb/r/read_only_recover_committed.result index e4cfebd1ec0..e7895ce6d46 100644 --- a/mysql-test/suite/innodb/r/read_only_recover_committed.result +++ b/mysql-test/suite/innodb/r/read_only_recover_committed.result @@ -33,6 +33,7 @@ a 20 UPDATE t SET a=3 WHERE a=1; # restart: --innodb-read-only +SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output; # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. # In earlier versions, this would return the last committed version # (only a=3; no record for a=20)! diff --git a/mysql-test/suite/innodb/t/default_row_format_alter.test b/mysql-test/suite/innodb/t/default_row_format_alter.test index 6690bc5bddf..1f0b0d56bc4 100644 --- a/mysql-test/suite/innodb/t/default_row_format_alter.test +++ b/mysql-test/suite/innodb/t/default_row_format_alter.test @@ -106,4 +106,14 @@ ALTER TABLE t1 ADD b INT; SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; DROP TABLE t1; +--echo # +--echo # MDEV-23345 Assertion not_redundant() == old.not_redundant() failed +--echo # +SET GLOBAL innodb_default_row_format = @row_format; +CREATE TABLE t1 (a INT PRIMARY KEY, b INT, KEY(b)) ENGINE=InnoDB; +SET GLOBAL innodb_default_row_format= COMPACT; +ALTER TABLE t1 DROP b; +SELECT ROW_FORMAT FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME='t1'; +DROP TABLE t1; + SET GLOBAL innodb_default_row_format = @row_format; diff --git a/mysql-test/suite/innodb/t/read_only_recover_committed.test b/mysql-test/suite/innodb/t/read_only_recover_committed.test index 526d9fc02bf..9ad09bb9b3a 100644 --- a/mysql-test/suite/innodb/t/read_only_recover_committed.test +++ b/mysql-test/suite/innodb/t/read_only_recover_committed.test @@ -59,6 +59,7 @@ SELECT * FROM t; UPDATE t SET a=3 WHERE a=1; --let $restart_parameters= --innodb-read-only --source include/restart_mysqld.inc +SET GLOBAL innodb_status_output= @@GLOBAL.innodb_status_output; --echo # Starting with MariaDB 10.2, innodb_read_only implies READ UNCOMMITTED. --echo # In earlier versions, this would return the last committed version --echo # (only a=3; no record for a=20)! diff --git a/mysql-test/suite/innodb_zip/t/restart.test b/mysql-test/suite/innodb_zip/t/restart.test index e0e42a682ab..6a0e60f3ce6 100644 --- a/mysql-test/suite/innodb_zip/t/restart.test +++ b/mysql-test/suite/innodb_zip/t/restart.test @@ -163,14 +163,22 @@ SELECT count(*) FROM t7_restart; --echo # --source include/shutdown_mysqld.inc +--let $regexp=/#sql-ib[0-9a-f]+\.ibd\n// + --echo ---- MYSQL_DATA_DIR/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_DATA_DIR/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/alt_dir --list_files $MYSQL_TMP_DIR/alt_dir --echo ---- MYSQL_TMP_DIR/alt_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/alt_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo # --echo # Start the server and show that tables are still visible and accessible. @@ -255,11 +263,17 @@ SHOW CREATE TABLE t7_restart; --copy_file $MYSQL_DATA_DIR/test/t5_restart.frm $MYSQL_DATA_DIR/test/t5_restart.frm.bak --echo ---- MYSQL_DATA_DIR/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_DATA_DIR/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/alt_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/alt_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo # --echo # Start the server and show the tablespaces. @@ -306,11 +320,17 @@ RENAME TABLE t5_restart TO t55_restart; --remove_file $MYSQL_TMP_DIR/alt_dir/test/t5_restart.ibd.bak --echo ---- MYSQL_DATA_DIR/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_DATA_DIR/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/alt_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/alt_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo # --echo # Rename file table and tablespace @@ -338,11 +358,17 @@ SELECT count(*) FROM t77_restart; SHOW CREATE TABLE t77_restart; --echo ---- MYSQL_DATA_DIR/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_DATA_DIR/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/alt_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/alt_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo # --echo # Restart the server @@ -378,14 +404,23 @@ SHOW CREATE TABLE t77_restart; --mkdir $MYSQL_TMP_DIR/new_dir --mkdir $MYSQL_TMP_DIR/new_dir/test --echo ---- MYSQL_DATA_DIR/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_DATA_DIR/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/alt_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/alt_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/new_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/new_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/new_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo # Moving tablespace 't4_restart' from MYSQL_DATA_DIR to MYSQL_TMP_DIR/new_dir --copy_file $MYSQL_DATA_DIR/test/t4_restart.ibd $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd @@ -431,14 +466,23 @@ SHOW CREATE TABLE t77_restart; --exec echo $MYSQL_TMP_DIR/new_dir/test/t77_restart#P#p1#SP#s3.ibd > $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl --echo ---- MYSQL_DATA_DIR/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_DATA_DIR/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/alt_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/alt_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/alt_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/new_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/new_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/new_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo # --echo # Start the server and check tablespaces. @@ -478,11 +522,17 @@ SHOW CREATE TABLE t77_restart; --echo # --echo ---- MYSQL_DATA_DIR/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_DATA_DIR/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/new_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/new_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/new_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo # Moving 't4_restart' from MYSQL_TMP_DIR/new_dir to MYSQL_DATA_DIR --copy_file $MYSQL_TMP_DIR/new_dir/test/t4_restart.ibd $MYSQL_DATA_DIR/test/t4_restart.ibd @@ -520,11 +570,17 @@ SHOW CREATE TABLE t77_restart; --remove_file $MYSQL_DATA_DIR/test/t77_restart#P#p1#SP#s3.isl --echo ---- MYSQL_DATA_DIR/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_DATA_DIR/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_DATA_DIR/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo ---- MYSQL_TMP_DIR/new_dir/test +--list_files_write_file $MYSQLD_DATADIR.files.txt $MYSQL_TMP_DIR/new_dir/test +--replace_regex $regexp --replace_result #P# #p# #SP# #sp# ---list_files $MYSQL_TMP_DIR/new_dir/test +--cat_file $MYSQLD_DATADIR.files.txt +--remove_file $MYSQLD_DATADIR.files.txt --echo # --echo # Start the server and check tablespaces. diff --git a/mysql-test/suite/maria/encrypt-no-key.result b/mysql-test/suite/maria/encrypt-no-key.result new file mode 100644 index 00000000000..6745670dfac --- /dev/null +++ b/mysql-test/suite/maria/encrypt-no-key.result @@ -0,0 +1,15 @@ +call mtr.add_suppression('Unknown key id 1. Can''t continue'); +set global aria_encrypt_tables= 1; +create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1; +alter table t1 disable keys; +insert into t1 values (1,1); +alter table t1 enable keys; +ERROR HY000: Unknown key id 1. Can't continue! +repair table t1 use_frm; +Table Op Msg_type Msg_text +test.t1 repair warning Number of rows changed from 0 to 1 +test.t1 repair Error Unknown key id 1. Can't continue! +test.t1 repair Error Unknown key id 1. Can't continue! +test.t1 repair status OK +drop table t1; +set global aria_encrypt_tables= default; diff --git a/mysql-test/suite/maria/encrypt-no-key.test b/mysql-test/suite/maria/encrypt-no-key.test new file mode 100644 index 00000000000..2d586c50695 --- /dev/null +++ b/mysql-test/suite/maria/encrypt-no-key.test @@ -0,0 +1,14 @@ +# +# MDEV-18496 Crash when Aria encryption is enabled but plugin not available +# +call mtr.add_suppression('Unknown key id 1. Can''t continue'); + +set global aria_encrypt_tables= 1; +create table t1 (pk int primary key, a int, key(a)) engine=aria transactional=1; +alter table t1 disable keys; +insert into t1 values (1,1); +error 192; +alter table t1 enable keys; +repair table t1 use_frm; +drop table t1; +set global aria_encrypt_tables= default; diff --git a/mysql-test/suite/parts/r/partition_debug.result b/mysql-test/suite/parts/r/partition_debug.result index 130a23da7e6..7c083d826cf 100644 --- a/mysql-test/suite/parts/r/partition_debug.result +++ b/mysql-test/suite/parts/r/partition_debug.result @@ -1,3 +1,4 @@ +FLUSH TABLES; # # Bug#13737949: CRASH IN HA_PARTITION::INDEX_INIT # Bug#18694052: SERVER CRASH IN HA_PARTITION::INIT_RECORD_PRIORITY_QUEUE diff --git a/mysql-test/suite/parts/t/partition_debug.test b/mysql-test/suite/parts/t/partition_debug.test index 864452f8d8b..6d7cf3ae8b3 100644 --- a/mysql-test/suite/parts/t/partition_debug.test +++ b/mysql-test/suite/parts/t/partition_debug.test @@ -8,6 +8,10 @@ # Crash tests don't work with embedded --source include/not_embedded.inc +# Make sure system tables are not open, as the test will kill the server +# and it will cause corruption errors in the log +FLUSH TABLES; + # Partitioning test that require debug features --echo # diff --git a/mysql-test/suite/roles/drop_current_role.result b/mysql-test/suite/roles/drop_current_role.result new file mode 100644 index 00000000000..b6de0304d44 --- /dev/null +++ b/mysql-test/suite/roles/drop_current_role.result @@ -0,0 +1,5 @@ +create role r; +set role r; +drop role r; +revoke all on *.* from current_role; +ERROR OP000: Invalid role specification `r` diff --git a/mysql-test/suite/roles/drop_current_role.test b/mysql-test/suite/roles/drop_current_role.test new file mode 100644 index 00000000000..c8d6fc5d9df --- /dev/null +++ b/mysql-test/suite/roles/drop_current_role.test @@ -0,0 +1,9 @@ +--source include/not_embedded.inc +# +# MDEV-22521 Server crashes in traverse_role_graph_up or Assertion `user' fails in traverse_role_graph_impl +# +create role r; +set role r; +drop role r; +error ER_INVALID_ROLE; +revoke all on *.* from current_role; diff --git a/mysql-test/suite/rpl/r/rpl_parallel2.result b/mysql-test/suite/rpl/r/rpl_parallel2.result index 42270916e4f..559c56271b8 100644 --- a/mysql-test/suite/rpl/r/rpl_parallel2.result +++ b/mysql-test/suite/rpl/r/rpl_parallel2.result @@ -2,8 +2,10 @@ include/rpl_init.inc [topology=1->2] *** MDEV-5509: Incorrect value for Seconds_Behind_Master if parallel replication *** connection server_2; SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +set @old_parallel_mode= @@GLOBAL.slave_parallel_mode; include/stop_slave.inc SET GLOBAL slave_parallel_threads=5; +set global slave_parallel_mode= optimistic; include/start_slave.inc connection server_1; CREATE TABLE t1 (a INT PRIMARY KEY, b INT); @@ -157,6 +159,7 @@ UNLOCK TABLES; connection server_2; include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; +set global slave_parallel_mode= @old_parallel_mode; include/start_slave.inc connection server_1; DROP TABLE t1, t2; diff --git a/mysql-test/suite/rpl/t/rpl_parallel2.test b/mysql-test/suite/rpl/t/rpl_parallel2.test index 3a9c801175f..8934b15e546 100644 --- a/mysql-test/suite/rpl/t/rpl_parallel2.test +++ b/mysql-test/suite/rpl/t/rpl_parallel2.test @@ -8,8 +8,10 @@ --connection server_2 SET @old_parallel_threads=@@GLOBAL.slave_parallel_threads; +set @old_parallel_mode= @@GLOBAL.slave_parallel_mode; --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=5; +set global slave_parallel_mode= optimistic; --source include/start_slave.inc --connection server_1 @@ -219,6 +221,7 @@ UNLOCK TABLES; --connection server_2 --source include/stop_slave.inc SET GLOBAL slave_parallel_threads=@old_parallel_threads; +set global slave_parallel_mode= @old_parallel_mode; --source include/start_slave.inc --connection server_1 diff --git a/mysql-test/suite/sys_vars/r/div_precision_increment_func.result b/mysql-test/suite/sys_vars/r/div_precision_increment_func.result index c839dd6b289..e16ce76fed9 100644 --- a/mysql-test/suite/sys_vars/r/div_precision_increment_func.result +++ b/mysql-test/suite/sys_vars/r/div_precision_increment_func.result @@ -51,9 +51,9 @@ INSERT into t1(name, salary, income_tax) values('Record_2', 501, 501*2.5/1000); INSERT into t1(name, salary, income_tax) values('Record_3', 210, 210*2.5/1000); SELECT * from t1; id name salary income_tax -1 Record_1 100011 250.027 -2 Record_2 501 1.2525 -3 Record_3 210 0.525 +1 Record_1 100011 250.03 +2 Record_2 501 1.25 +3 Record_3 210 0.53 connect test_con2, localhost, root,,; connection test_con2; ## Verifying session & global value of variable ## @@ -69,11 +69,11 @@ INSERT into t1(name, salary, income_tax) values('Record_5', 501, 501*2.5/1000); INSERT into t1(name, salary, income_tax) values('Record_6', 210, 210*2.5/1000); SELECT * from t1; id name salary income_tax -1 Record_1 100011 250.027 -2 Record_2 501 1.2525 -3 Record_3 210 0.525 -4 Record_4 100011 250.027 -5 Record_5 501 1.2525 +1 Record_1 100011 250.03 +2 Record_2 501 1.25 +3 Record_3 210 0.53 +4 Record_4 100011 250.028 +5 Record_5 501 1.253 6 Record_6 210 0.525 ## Dropping table t1 ## drop table t1; diff --git a/mysql-test/suite/vcol/r/not_supported.result b/mysql-test/suite/vcol/r/not_supported.result index c804cf220d2..c524234e7e5 100644 --- a/mysql-test/suite/vcol/r/not_supported.result +++ b/mysql-test/suite/vcol/r/not_supported.result @@ -29,7 +29,7 @@ set time_zone='+1:00'; flush tables; select * from t1; a b v -1 2 0.3333333330000000000 +1 2 0.3333000000000000000 select * from t8; a b v 1234567890 2 2009-02-14 00:31:30 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/mysql-test/unstable-tests b/mysql-test/unstable-tests index d1c97dd1537..8b9c5ecfd6e 100644 --- a/mysql-test/unstable-tests +++ b/mysql-test/unstable-tests @@ -23,235 +23,238 @@ # ############################################################################## # -# Based on 10.5 e341fb0dae1008b98d6fc96f8847e6f1bd975db3 +# Based on bb-10.5-release 91c3c9efc192ac0ec2ec32fa801bdc0cb236ab5e +# Thu Aug 6 17:55:22 2020 +0200 - Merge branch '10.4' into 10.5 -main.alter_table : Modified in 10.5.4 -main.alter_table_trans : MDEV-12084 - timeout -main.alter_user : Modified in 10.4.13 -main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result -main.auth_named_pipe : MDEV-14724 - System error 2 -main.backup_interaction : Modified in 10.4.13 -main.backup_lock : Modified in 10.5.4 -main.backup_stages : Modified in 10.5.4 -main.binary_to_hex : MDEV-20211 - Wrong result -main.column_compression : Modified in 10.4.13 -main.comment_table : Modified in 10.5.4 -main.commit_1innodb : Include file modified in 10.5.4 -main.connect : MDEV-17282 - Wrong result -main.connect-abstract : MDEV-20162 - Could not execute 'check-testcase' -main.connect2 : MDEV-13885 - Server crash -main.connect_debug : MDEV-22950 - Server crash -main.count_distinct2 : MDEV-11768 - timeout -main.create_delayed : MDEV-10605 - failed with timeout -main.create_drop_event : MDEV-16271 - Wrong result -main.create_drop_view : Modified in 10.5.4 -main.create_or_replace : MDEV-22954 - Wrong result -main.cte_nonrecursive : Modified in 10.4.13 -main.cte_recursive : Modified in 10.5.4 -main.ctype_big5 : Modified in 10.5.4 -main.ctype_binary : Modified in 10.5.4 -main.ctype_cp932 : Modified in 10.5.4 -main.ctype_cp932_binlog_row : MDEV-20540 - Wrong result -main.ctype_cp932_binlog_stm : MDEV-20534 - Wrong result -main.ctype_dec8 : Added in 10.5.4 -main.ctype_eucjpms : Modified in 10.5.4 -main.ctype_euckr : Modified in 10.5.4 -main.ctype_filename : Modified in 10.5.4 -main.ctype_gb2312 : Modified in 10.5.4 -main.ctype_gbk : Modified in 10.5.4 -main.ctype_sjis : Modified in 10.5.4 -main.ctype_swe7 : Modified in 10.5.4 -main.ctype_ucs : MDEV-17681 - Data too long for column -main.ctype_upgrade : MDEV-16945 - Error upon mysql_upgrade -main.ctype_utf16 : MDEV-10675 - Timeout or extra warnings; modified in 10.5.4 -main.ctype_utf16_uca : Modified in 10.5.4 -main.ctype_utf16le : MDEV-10675 - Timeout or extra warnings; modified in 10.5.4 -main.ctype_utf32 : Modified in 10.5.4 -main.ctype_utf32_uca : Modified in 10.5.4 -main.ctype_utf8 : Modified in 10.5.4 -main.ctype_utf8mb4 : Modified in 10.5.4 -main.ctype_utf8mb4_heap : Include file modified in 10.5.4 -main.ctype_utf8mb4_innodb : MDEV-17744 - Timeout; MDEV-18567 - ASAN use-after-poison; include file modified in 10.5.4 -main.ctype_utf8mb4_myisam : Include file modified in 10.5.4 -main.custom_aggregate_functions : Modified in 10.5.4 -main.debug_sync : MDEV-10607 - internal error -main.default_storage_engine : Modified in 10.4.13 -main.delayed : MDEV-20961 - Assertion failure -main.derived_cond_pushdown : MDEV-20532 - Floating point differences; modified in 10.4.13 -main.derived_opt : MDEV-11768 - timeout -main.dirty_close : MDEV-19368 - mysqltest failed but provided no output -main.distinct : MDEV-14194 - Crash -main.drop : Modified in 10.5.4 -main.drop_bad_db_type : MDEV-15676 - Wrong result -main.drop_combinations : Added in 10.5.4 -main.drop_table_force : Added in 10.5.4 -main.dyncol : MDEV-19455 - Extra warning -main.errors : Modified in 10.4.13 -main.events_2 : MDEV-13277 - Crash -main.events_bugs : MDEV-12892 - Crash -main.events_restart : MDEV-12236 - Server shutdown problem; modified in 10.4.13 -main.events_slowlog : MDEV-12821 - Wrong result -main.failed_auth_3909 : Modified in 10.4.13 -main.failed_auth_unixsocket : Modified in 10.4.13 -main.flush : MDEV-19368 - mysqltest failed but provided no output -main.flush_read_lock : MDEV-22953 - Unknown XID; modified in 10.5.4 -main.flush_ssl : MDEV-21276 - Aria recovery failure -main.fulltext : Modified in 10.4.13 -main.func_bit : Added in 10.5.4 -main.func_gconcat : Modified in 10.5.4 -main.func_json : Modified in 10.5.4 -main.func_math : MDEV-20966 - Wrong error code; modified in 10.5.4 -main.func_str : Modified in 10.4.13 -main.gis : MDEV-13411 - wrong result on P8; modified in 10.5.4 -main.gis-rtree : Modified in 10.4.13 -main.gis_notembedded : MDEV-21264 - Wrong result with non-default charset -main.grant : Modified in 10.5.4 -main.grant2 : Modified in 10.4.13 -main.grant5 : Modified in 10.5.4 -main.grant_repair : Added in 10.4.13 -main.group_by : Modified in 10.4.13 -main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown -main.index_intersect_innodb : MDEV-10643 - failed with timeout -main.index_merge_innodb : MDEV-7142 - Plan mismatch; modified in 10.5.4 -main.index_merge_myisam : Modified in 10.4.13 -main.information_schema : Modified in 10.5.4 -main.information_schema_db : Modified in 10.5.4 -main.innodb_ext_key : Modified in 10.5.4 -main.innodb_icp : MDEV-20168 - Wrong execution plans; include file modified in 10.4.13 -main.innodb_mysql_lock : Modified in 10.4.13 -main.invisible_field_grant_completely : MDEV-22254 - Syscall param write points to uninitialised bytes -main.ipv4_and_ipv6 : MDEV-20964 - Wrong result -main.ipv6 : MDEV-20964 - Wrong result -main.join_cache : MDEV-17743 - Bad address from storage engine MyISAM; modified in 10.4.13 -main.key : Modified in 10.4.13 -main.kill : Modified in 10.5.4 -main.kill-2 : MDEV-13257 - Wrong result; modified in 10.5.4 -main.kill_processlist-6619 : MDEV-10793 - Wrong result -main.loaddata : MDEV-19368 - mysqltest failed but provided no output -main.locale : MDEV-20521 - Missing warning; configuration added in 10.4.13 -main.lock : Modified in 10.5.4 -main.lock_user : Modified in 10.4.13 -main.log_slow : MDEV-13263 - Wrong result -main.log_tables-big : MDEV-13408 - wrong result -main.log_tables_upgrade : MDEV-20962 - Wrong result -main.long_unique_bugs : Modified in 10.5.4 -main.long_unique_bugs_replication : Added in 10.5.4 -main.lowercase_fs_off : Modified in 10.4.13 -main.mdev-504 : MDEV-15171 - warning -main.mdev375 : MDEV-10607 - sporadic "can't connect"; modified in 10.4.13 -main.mdev_22370 : Added in 10.5.4 -main.mdl : MDEV-22954 - Wrong result -main.merge : MDEV-10607 - sporadic "can't connect" -main.multi_update : Modified in 10.4.13 -main.multi_update_debug : Modified in 10.4.13 -main.myisam_icp : Include file modified in 10.4.13 -main.myisampack : Modified in 10.5.4 -main.mysql : MDEV-20156 - Wrong result -main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2; MDEV-19511 - Big endian issue; modified in 10.4.13 -main.mysql_client_test_comp : MDEV-16641 - Error in exec -main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exec failed -main.mysql_cp932 : MDEV-21275 - Wrong result -main.mysql_upgrade : MDEV-20161 - Wrong result; MDEV-20166 - FATAL ERROR: Upgrade failed; modified in 10.5.4 -main.mysql_upgrade-6984 : MDEV-22514 - Wrong result; modified in 10.4.13 -main.mysql_upgrade_no_innodb : MDEV-20537 - Wrong result -main.mysql_upgrade_noengine : MDEV-14355 - Wrong result -main.mysql_upgrade_view : MDEV-20161 - Wrong result -main.mysqladmin : MDEV-20535 - Wrong result -main.mysqlbinlog_row_compressed : MDEV-22964 - Wrong result -main.mysqlcheck : MDEV-20164 - Wrong result -main.mysqld--defaults-file : Modified in 10.4.13 -main.mysqld_option_err : MDEV-21236 - Wrong error; MDEV-21571 - Crash on bootstrap -main.mysqldump : MDEV-14800 - Stack smashing detected; modified in 10.4.13 -main.mysqldump-max : MDEV-21272 - Wrong result -main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug -main.mysqlshow : MDEV-20965 - Wrong result; modified in 10.5.4 -main.mysqlslap : MDEV-11801 - timeout -main.mysqltest : MDEV-13887 - Wrong result -main.mysqltest_tracking_info : Modified in 10.5.4 -main.named_pipe : Modified in 10.5.4 -main.old-mode : MDEV-19373 - Wrong result -main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1 -main.opt_trace : Modified in 10.5.4 -main.order_by : Modified in 10.5.4 -main.order_by_optimizer_innodb : MDEV-10683 - Wrong result -main.parser : Modified in 10.4.13 -main.partition_alter : Modified in 10.5.4 -main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock -main.partition_innodb : MDEV-20169 - Wrong result; modified in 10.4.13 -main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings -main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1 -main.partition_innodb_stmt : MDEV-20213 - Server crash -main.partition_mrr_aria : Include file modified in 10.4.13 -main.partition_mrr_innodb : Include file modified in 10.4.13 -main.partition_mrr_myisam : Modified in 10.4.13 -main.partition_range : Modified in 10.4.13 -main.percona_nonflushing_analyze_debug : Added in 10.5.4 -main.plugin_auth : MDEV-20957 - Upgrade file was not properly created -main.plugin_auth_qa_2 : MDEV-20165 - Wrong result -main.pool_of_threads : MDEV-18135 - SSL error: key too small -main.processlist_notembedded : Modified in 10.5.4 -main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.5.4 -main.ps_grant : Modified in 10.4.13 -main.query_cache : MDEV-16180 - Wrong result; modified in 10.5.4 -main.query_cache_debug : MDEV-15281 - Query cache is disabled -main.range : Modified in 10.4.13 -main.range_innodb : Modified in 10.4.13 -main.range_vs_index_merge : Modified in 10.4.13 -main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away -main.repair : Modified in 10.5.4 -main.row : Modified in 10.5.4 -main.rowid_filter : Modified in 10.4.13 -main.rowid_filter_innodb : MDEV-20538 - Wrong result; modified in 10.4.13 -main.rpl_mysql_upgrade_slave_repo_check : Added in 10.4.13 -main.select : MDEV-20532 - Floating point differences -main.select_jcl6 : MDEV-20532 - Floating point differences -main.select_pkeycache : MDEV-20532 - Floating point differences -main.selectivity : Modified in 10.5.4 -main.set_statement : MDEV-13183 - Wrong result -main.set_statement_notembedded : MDEV-19414 - Wrong result -main.shm : MDEV-12727 - Mismatch, ERROR 2013 -main.show_explain : MDEV-10674 - Wrong result code -main.sp : MDEV-7866 - Mismatch -main.sp-error : Modified in 10.5.4 -main.sp-security : MDEV-10607 - sporadic "can't connect"; modified in 10.5.4 -main.sp-vars : Modified in 10.5.4 -main.sp2 : Added in 10.5.4 -main.sp_notembedded : MDEV-10607 - internal error -main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1 -main.ssl_7937 : MDEV-20958 - Wrong result -main.ssl_ca : MDEV-10895 - SSL connection error on Power -main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1 -main.ssl_crl : MDEV-19119 - Wrong error code -main.ssl_timeout : MDEV-11244 - Crash -main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding -main.status : MDEV-13255 - Wrong result -main.status_bug17954 : Modified in 10.5.4 -main.subselect : MDEV-20551 - Valgrind failure -main.subselect4 : Modified in 10.5.4 -main.subselect_innodb : MDEV-10614 - Wrong result -main.subselect_sj2_mat : Modified in 10.4.13 -main.table_value_constr : Modified in 10.5.4 -main.tc_heuristic_recover : MDEV-14189 - Wrong result -main.type_blob : MDEV-15195 - Wrong result; modified in 10.4.13 -main.type_date : Modified in 10.5.4 -main.type_datetime : Modified in 10.5.4 -main.type_datetime_hires : MDEV-10687 - Timeout; modified in 10.5.4 -main.type_float : MDEV-20532 - Floating point differences -main.type_newdecimal : MDEV-20532 - Floating point differences -main.type_ranges : MDEV-20532 - Floating point differences -main.type_time : Modified in 10.5.4 -main.type_timestamp : Modified in 10.5.4 -main.udf : Modified in 10.5.4 -main.upgrade_MDEV-19650 : Added in 10.4.13 -main.userstat : MDEV-12904 - SSL errors -main.view : Modified in 10.5.4 -main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query -main.warnings_debug : Modified in 10.5.4 -main.win : Modified in 10.5.4 -main.win_percentile : Modified in 10.5.4 -main.xa : MDEV-11769 - lock wait timeout; modified in 10.5.4 -main.xa_binlog : Modified in 10.5.4 -main.xml : MDEV-21968 - Crash on armhf +main.alter_table : Modified in 10.5.4 +main.alter_table_trans : MDEV-12084 - timeout +main.analyze_stmt_slow_query_log : MDEV-12237 - Wrong result +main.auth_named_pipe : MDEV-14724 - System error 2 +main.backup_lock : Modified in 10.5.4 +main.backup_stages : MDEV-23401 - Bad file descriptor; modified in 10.5.4 +main.binary_to_hex : MDEV-20211 - Wrong result +main.comment_table : Modified in 10.5.4 +main.commit_1innodb : Include file modified in 10.5.4 +main.connect : MDEV-17282 - Wrong result +main.connect-abstract : MDEV-20162 - Could not execute 'check-testcase' +main.connect2 : MDEV-13885 - Server crash +main.count_distinct2 : MDEV-11768 - timeout +main.create : Modified in 10.5.5 +main.create_delayed : MDEV-10605 - failed with timeout +main.create_drop_event : MDEV-16271 - Wrong result +main.create_drop_function : Modified in 10.5.5 +main.create_drop_view : Modified in 10.5.4 +main.create_or_replace : MDEV-22954 - Wrong result +main.cte_recursive : Modified in 10.5.4 +main.ctype_big5 : Modified in 10.5.4 +main.ctype_binary : Modified in 10.5.4 +main.ctype_cp932 : Modified in 10.5.4 +main.ctype_cp932_binlog_row : MDEV-20540 - Wrong result +main.ctype_cp932_binlog_stm : MDEV-20534 - Wrong result +main.ctype_dec8 : Added in 10.5.4 +main.ctype_eucjpms : Modified in 10.5.4 +main.ctype_euckr : Modified in 10.5.4 +main.ctype_filename : Modified in 10.5.4 +main.ctype_gb2312 : Modified in 10.5.4 +main.ctype_gbk : Modified in 10.5.4 +main.ctype_ldml : Modified in 10.5.5 +main.ctype_sjis : Modified in 10.5.4 +main.ctype_swe7 : Modified in 10.5.4 +main.ctype_ucs : MDEV-17681 - Data too long for column +main.ctype_upgrade : MDEV-16945 - Error upon mysql_upgrade +main.ctype_utf16 : MDEV-10675 - Timeout or extra warnings; modified in 10.5.4 +main.ctype_utf16_uca : Modified in 10.5.4 +main.ctype_utf16le : MDEV-10675 - Timeout or extra warnings; modified in 10.5.4 +main.ctype_utf32 : Modified in 10.5.4 +main.ctype_utf32_uca : Modified in 10.5.4 +main.ctype_utf8 : Modified in 10.5.4 +main.ctype_utf8mb4 : Modified in 10.5.4 +main.ctype_utf8mb4_heap : Include file modified in 10.5.4 +main.ctype_utf8mb4_innodb : MDEV-17744 - Timeout; MDEV-18567 - ASAN use-after-poison; include file modified in 10.5.4 +main.ctype_utf8mb4_myisam : Include file modified in 10.5.4 +main.custom_aggregate_functions : Modified in 10.5.4 +main.debug_sync : MDEV-10607 - internal error +main.delayed : MDEV-20961 - Assertion failure +main.delete_innodb : Added in 10.5.5 +main.derived_cond_pushdown : MDEV-20532 - Floating point differences +main.derived_opt : MDEV-11768 - timeout +main.dirty_close : MDEV-19368 - mysqltest failed but provided no output +main.distinct : MDEV-14194 - Crash +main.drop : Modified in 10.5.5 +main.drop_bad_db_type : MDEV-15676 - Wrong result +main.drop_combinations : Added in 10.5.4 +main.drop_table_force : Modified in 10.5.5 +main.dyncol : MDEV-19455 - Extra warning +main.events_2 : MDEV-13277 - Crash +main.events_bugs : MDEV-12892 - Crash +main.events_restart : MDEV-12236 - Server shutdown problem +main.events_slowlog : MDEV-12821 - Wrong result +main.flush : MDEV-19368 - mysqltest failed but provided no output +main.flush_read_lock : MDEV-22953 - Unknown XID; modified in 10.5.4 +main.flush_ssl : MDEV-21276 - Aria recovery failure +main.func_bit : Added in 10.5.4 +main.func_des_encrypt : Modified in 10.5.5 +main.func_gconcat : Modified in 10.5.4 +main.func_json : Modified in 10.5.5 +main.func_math : MDEV-20966 - Wrong error code; modified in 10.5.4 +main.gis : MDEV-13411 - wrong result on P8; modified in 10.5.4 +main.gis_notembedded : MDEV-21264 - Wrong result with non-default charset +main.grant : Modified in 10.5.4 +main.grant5 : Modified in 10.5.5 +main.having : MDEV-23420 - Server crash +main.host_cache_size_functionality : MDEV-10606 - sporadic failure on shutdown +main.index_intersect_innodb : MDEV-10643 - failed with timeout +main.index_merge_innodb : MDEV-7142 - Plan mismatch; modified in 10.5.4 +main.information_schema : Modified in 10.5.5 +main.information_schema_all_engines : MDEV-23421 - Wrong result; configuration modified in 10.5.5 +main.information_schema_db : Modified in 10.5.4 +main.innodb_ext_key : Modified in 10.5.4 +main.innodb_icp : MDEV-20168 - Wrong execution plans +main.innodb_mrr_cpk : MDEV-23370 - Server crash +main.invisible_field_grant_completely : MDEV-22254 - Syscall param write points to uninitialised bytes +main.ipv4_and_ipv6 : MDEV-20964 - Wrong result +main.ipv6 : MDEV-20964 - Wrong result +main.join_cache : MDEV-17743 - Bad address from storage engine MyISAM +main.join_outer : Modified in 10.5.5 +main.kill : Modified in 10.5.4 +main.kill-2 : MDEV-13257 - Wrong result; modified in 10.5.4 +main.kill_processlist-6619 : MDEV-10793 - Wrong result +main.loaddata : MDEV-19368 - mysqltest failed but provided no output +main.locale : MDEV-20521 - Missing warning +main.lock : Modified in 10.5.4 +main.log_slow : MDEV-13263 - Wrong result +main.log_tables : Modified in 10.5.5 +main.log_tables-big : MDEV-13408 - wrong result +main.log_tables_upgrade : MDEV-20962 - Wrong result +main.long_unique_bugs : Modified in 10.5.4 +main.long_unique_bugs_replication : Added in 10.5.4 +main.lowercase_fs_off : Modified in 10.5.5 +main.mdev-21101 : Added in 10.5.5 +main.mdev-504 : MDEV-15171 - warning +main.mdev375 : MDEV-10607 - sporadic "can't connect" +main.mdev_22370 : Added in 10.5.4 +main.mdl : MDEV-22954 - Wrong result; modified in 10.5.5 +main.merge : MDEV-10607 - sporadic "can't connect" +main.myisampack : Modified in 10.5.4 +main.mysql : MDEV-20156 - Wrong result +main.mysql_client_test : MDEV-19369 - error: 5888, status: 23, errno: 2; MDEV-19511 - Big endian issue +main.mysql_client_test_comp : MDEV-16641 - Error in exec +main.mysql_client_test_nonblock : CONC-208 - Error on Power; MDEV-15096 - exec failed +main.mysql_cp932 : MDEV-21275 - Wrong result +main.mysql_install_db_win : Modified in 10.5.5 +main.mysql_upgrade : MDEV-20161 - Wrong result; MDEV-20166 - FATAL ERROR: Upgrade failed; modified in 10.5.5 +main.mysql_upgrade-6984 : MDEV-22514 - Wrong result +main.mysql_upgrade_no_innodb : MDEV-20537 - Wrong result +main.mysql_upgrade_noengine : MDEV-14355 - Wrong result +main.mysql_upgrade_view : MDEV-23392 - Wrong result; MDEV-20161 - Wrong result +main.mysqladmin : MDEV-20535 - Wrong result +main.mysqlbinlog_row_compressed : MDEV-22964 - Wrong result +main.mysqlcheck : MDEV-20164 - Wrong result +main.mysqld--help-aria : Modified in 10.5.5 +main.mysqld_option_err : MDEV-21236 - Wrong error; MDEV-21571 - Crash on bootstrap +main.mysqldump : MDEV-14800 - Stack smashing detected +main.mysqldump-max : MDEV-21272 - Wrong result +main.mysqlhotcopy_myisam : MDEV-10995 - Hang on debug +main.mysqlshow : MDEV-20965 - Wrong result; modified in 10.5.4 +main.mysqlslap : MDEV-11801 - timeout +main.mysqltest : MDEV-13887 - Wrong result +main.mysqltest_tracking_info : Modified in 10.5.5 +main.named_pipe : MDEV-23279 - Test timeouts; modified in 10.5.4 +main.nested_profiling : Added in 10.5.5 +main.old-mode : MDEV-19373 - Wrong result +main.openssl_6975 : MDEV-17184 - Failures with OpenSSL 1.1.1 +main.opt_trace : Modified in 10.5.5 +main.order_by : Modified in 10.5.5 +main.order_by_optimizer_innodb : MDEV-10683 - Wrong result +main.parser : Modified in 10.5.5 +main.partition : Modified in 10.5.5 +main.partition_alter : Modified in 10.5.4 +main.partition_debug_sync : MDEV-15669 - Deadlock found when trying to get lock +main.partition_explicit_prune : Modified in 10.5.5 +main.partition_innodb : MDEV-20169 - Wrong result +main.partition_innodb_plugin : MDEV-12901 - Valgrind warnings +main.partition_innodb_semi_consistent : MDEV-19411 - Failed to start mysqld.1 +main.percona_nonflushing_analyze_debug : Added in 10.5.4 +main.plugin : Modified in 10.5.5 +main.plugin_auth : MDEV-20957 - Upgrade file was not properly created +main.plugin_auth_qa_2 : MDEV-20165 - Wrong result +main.pool_of_threads : MDEV-18135 - SSL error: key too small +main.processlist_notembedded : Modified in 10.5.4 +main.ps : MDEV-11017 - sporadic wrong Prepared_stmt_count; modified in 10.5.4 +main.query_cache : MDEV-16180 - Wrong result; modified in 10.5.4 +main.query_cache_debug : MDEV-15281 - Query cache is disabled +main.range_innodb : MDEV-23371 - Server crash +main.range_vs_index_merge_innodb : MDEV-15283 - Server has gone away +main.repair : Modified in 10.5.4 +main.row : Modified in 10.5.4 +main.rowid_filter_innodb : MDEV-20538 - Wrong result +main.rowid_filter_myisam : Added in 10.5.5 +main.select : MDEV-20532 - Floating point differences +main.select_jcl6 : MDEV-20532 - Floating point differences +main.select_pkeycache : MDEV-20532 - Floating point differences +main.selectivity : Modified in 10.5.4 +main.set_statement : MDEV-13183 - Wrong result +main.set_statement_notembedded : MDEV-19414 - Wrong result +main.shm : MDEV-12727 - Mismatch, ERROR 2013 +main.show_explain : MDEV-10674 - Wrong result code +main.signal : Modified in 10.5.5 +main.sp : MDEV-7866 - Mismatch; modified in 10.5.5 +main.sp-error : Modified in 10.5.5 +main.sp-security : MDEV-10607 - sporadic "can't connect"; modified in 10.5.4 +main.sp-vars : Modified in 10.5.4 +main.sp2 : Added in 10.5.4 +main.sp_notembedded : MDEV-10607 - internal error +main.ssl : MDEV-17184 - Failures with OpenSSL 1.1.1 +main.ssl_7937 : MDEV-20958 - Wrong result +main.ssl_ca : MDEV-10895 - SSL connection error on Power +main.ssl_cipher : MDEV-17184 - Failures with OpenSSL 1.1.1 +main.ssl_timeout : MDEV-11244 - Crash +main.stat_tables_innodb : Modified in 10.5.5 +main.stat_tables_par_innodb : MDEV-14155 - Wrong rounding +main.stat_tables_partition : Modified in 10.5.5 +main.status : MDEV-13255 - Wrong result +main.status_bug17954 : Modified in 10.5.4 +main.subselect : MDEV-20551 - Valgrind failure +main.subselect4 : Modified in 10.5.5 +main.subselect_exists2in : Modified in 10.5.5 +main.subselect_innodb : MDEV-10614 - Wrong result +main.table_value_constr : Modified in 10.5.4 +main.tc_heuristic_recover : MDEV-14189 - Wrong result +main.temp_table : Modified in 10.5.5 +main.tls_version : MDEV-23417 - Wrong result +main.type_bit : Modified in 10.5.5 +main.type_blob : MDEV-15195 - Wrong result +main.type_date : Modified in 10.5.5 +main.type_datetime : Modified in 10.5.4 +main.type_datetime_hires : MDEV-10687 - Timeout; modified in 10.5.5 +main.type_enum : Modified in 10.5.5 +main.type_float : MDEV-20532 - Floating point differences; modified in 10.5.5 +main.type_hex_hybrid : Modified in 10.5.5 +main.type_int : Modified in 10.5.5 +main.type_newdecimal : MDEV-20532 - Floating point differences +main.type_ranges : MDEV-20532 - Floating point differences +main.type_set : Modified in 10.5.5 +main.type_temporal_innodb : Modified in 10.5.5 +main.type_time : Modified in 10.5.4 +main.type_time_hires : Modified in 10.5.5 +main.type_timestamp : Modified in 10.5.4 +main.type_timestamp_hires : Modified in 10.5.5 +main.type_year : Modified in 10.5.5 +main.udf : Modified in 10.5.4 +main.union : Modified in 10.5.5 +main.upgrade_MDEV-19650 : Modified in 10.5.5 +main.upgrade_MDEV-23102-1 : Added in 10.5.5 +main.upgrade_MDEV-23102-2 : Added in 10.5.5 +main.userstat : MDEV-12904 - SSL errors +main.view : Modified in 10.5.4 +main.wait_timeout : MDEV-19023 - Lost connection to MySQL server during query +main.warnings_debug : Modified in 10.5.4 +main.win : Modified in 10.5.5 +main.win_ntile : Modified in 10.5.5 +main.win_percentile : Modified in 10.5.4 +main.xa : MDEV-11769 - lock wait timeout; modified in 10.5.4 +main.xa_binlog : Modified in 10.5.4 +main.xml : MDEV-21968 - Crash on armhf #----------------------------------------------------------------------- @@ -267,46 +270,43 @@ archive-test_sql_discovery.discover : MDEV-16817 - Table marked as crashed #----------------------------------------------------------------------- -binlog.binlog_base64_flag : Modified in 10.5.4 -binlog.binlog_commit_wait : MDEV-10150 - Mismatch -binlog.binlog_drop_if_exists : Modified in 10.5.4 -binlog.binlog_index : Include file modified in 10.2.31 -binlog.binlog_innodb : MDEV-22516 - Wrong result -binlog.binlog_invalid_read_in_rotate : MDEV-22455 - Server crash -binlog.binlog_ioerr : MDEV-20159 - Assertion failure; include file modified in 10.2.31 -binlog.binlog_killed : MDEV-12925 - Wrong result -binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown -binlog.binlog_mixed : Added in 10.5.4 -binlog.binlog_mysqlbinlog_row_frag : Modified in 10.5.4 -binlog.binlog_mysqlbinlog_row_innodb : MDEV-20530 - Binary files differ -binlog.binlog_mysqlbinlog_row_myisam : MDEV-20530 - Binary files differ -binlog.binlog_no_uniqfile_crash : Added in 10.5.4 -binlog.binlog_row_binlog : MDEV-20213 - Server crash; include file modified in 10.5.4 -binlog.binlog_show_binlog_event_random_pos : MDEV-22473 - Server crash -binlog.binlog_stm_binlog : MDEV-20412 - Wrong result; include file modified in 10.5.4 -binlog.binlog_write_error : Include file Include file modified in 10.2.31 -binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint -binlog.flashback-largebinlog : MDEV-19764 - Out of memory -binlog.load_data_stm_view : MDEV-16948 - Wrong result -binlog.show_concurrent_rotate : MDEV-20215 - Wrong result +binlog.binlog_base64_flag : Modified in 10.5.4 +binlog.binlog_commit_wait : MDEV-10150 - Mismatch +binlog.binlog_drop_if_exists : Modified in 10.5.4 +binlog.binlog_empty_xa_prepared : Added in 10.5.5 +binlog.binlog_innodb : MDEV-22516 - Wrong result +binlog.binlog_invalid_read_in_rotate : MDEV-22455 - Server crash +binlog.binlog_ioerr : MDEV-20159 - Assertion failure +binlog.binlog_killed : MDEV-12925 - Wrong result +binlog.binlog_max_extension : MDEV-19762 - Crash on shutdown +binlog.binlog_mixed : Added in 10.5.4 +binlog.binlog_mysqlbinlog_row_frag : Modified in 10.5.4 +binlog.binlog_mysqlbinlog_row_innodb : MDEV-20530 - Binary files differ +binlog.binlog_mysqlbinlog_row_myisam : MDEV-20530 - Binary files differ +binlog.binlog_no_uniqfile_crash : Added in 10.5.4 +binlog.binlog_parallel_replication_marks_row : Include file modified in 10.5.5 +binlog.binlog_parallel_replication_marks_stm_mix : Include file modified in 10.5.5 +binlog.binlog_row_binlog : MDEV-23402 - Wrong result; include file modified in 10.5.4 +binlog.binlog_show_binlog_event_random_pos : MDEV-22473 - Server crash +binlog.binlog_stm_binlog : MDEV-20412 - Wrong result; include file modified in 10.5.4 +binlog.binlog_xa_recover : MDEV-8517 - Extra checkpoint +binlog.flashback-largebinlog : MDEV-19764 - Out of memory +binlog.load_data_stm_view : MDEV-16948 - Wrong result +binlog.show_concurrent_rotate : MDEV-20215 - Wrong result #----------------------------------------------------------------------- -binlog_encryption.binlog_incident : MDEV-20213 - Server crash -binlog_encryption.binlog_row_annotate : MDEV-20213 - Server crash binlog_encryption.binlog_xa_recover : MDEV-12908 - Extra checkpoint binlog_encryption.encrypted_master : MDEV-14201 - Extra warnings binlog_encryption.encrypted_master_switch_to_unencrypted : MDEV-14190 - Can't init tc log binlog_encryption.encrypted_slave : MDEV-18135 - SSL error: key too small binlog_encryption.encryption_combo : MDEV-14199 - Table is marked as crashed -binlog_encryption.multisource : MDEV-20213 - Server crash; MDEV-21289 - Wrong error code -binlog_encryption.mysqlbinlog : MDEV-20213 - Server crash -binlog_encryption.rpl_binlog_errors : MDEV-12742 - Crash; include file include file modified in 10.4.13 +binlog_encryption.multisource : MDEV-21289 - Wrong error code +binlog_encryption.rpl_binlog_errors : MDEV-12742 - Crash binlog_encryption.rpl_checksum : MDEV-16951 - Wrong result -binlog_encryption.rpl_corruption : MDEV-20159 - Assertion failure; MDEV-20953 - Wrong error code; include file modified in 10.4.13 +binlog_encryption.rpl_corruption : MDEV-20159 - Assertion failure; MDEV-20953 - Wrong error code binlog_encryption.rpl_gtid_basic : MDEV-16947 - Server failed to start binlog_encryption.rpl_incident : MDEV-21569 - mutex: LOCK_global_system_variables unlocking -binlog_encryption.rpl_init_slave_errors : MDEV-20213 - Server crash binlog_encryption.rpl_loadfile : MDEV-16645 - Timeout in include binlog_encryption.rpl_mixed_binlog_max_cache_size : MDEV-20956 - Incorrect checksum for freed object binlog_encryption.rpl_parallel : MDEV-10653 - Timeout in include @@ -316,7 +316,6 @@ binlog_encryption.rpl_semi_sync : MDEV-11673 - Valgri binlog_encryption.rpl_skip_replication : MDEV-13571 - Unexpected warning; MDEV-20573 - Wrong result binlog_encryption.rpl_ssl : MDEV-14507 - Timeouts binlog_encryption.rpl_stm_relay_ign_space : MDEV-19375 - Test assertion failed -binlog_encryption.rpl_sync : MDEV-13830 - Assertion failure binlog_encryption.rpl_temporal_format_default_to_default : MDEV-21273 - Timeout binlog_encryption.rpl_temporal_format_mariadb53_to_mysql56 : MDEV-20159 - Assertion failure binlog_encryption.rpl_typeconv : MDEV-14362 - Lost connection to MySQL server during query @@ -327,26 +326,29 @@ columnstore.* : Engine enabled in 10.5.4 #----------------------------------------------------------------------- -compat/oracle.parser : Modified in 10.5.4 +compat/maxdb.rpl_mariadb_timestamp : Added in 10.5.5 +compat/maxdb.type_timestamp : Added in 10.5.5 + +#----------------------------------------------------------------------- + +compat/oracle.binlog_ptr_mysqlbinlog : Added in 10.5.5 +compat/oracle.parser : Modified in 10.5.4 +compat/oracle.rpl_mariadb_date : Added in 10.5.5 +compat/oracle.sp : Modified in 10.5.5 +compat/oracle.sp-cursor-rowtype : Modified in 10.5.5 +compat/oracle.type_date : Modified in 10.5.5 #----------------------------------------------------------------------- connect.alter : MDEV-18135 - SSL error: key too small connect.drop-open-error : MDEV-18135 - SSL error: key too small -connect.grant : Modified in 10.1.44 -connect.grant2 : Modified in 10.1.44 -connect.ini_grant : Modified in 10.1.44 connect.json : MDEV-18135 - SSL error: key too small -connect.mysql_grant : Modified in 10.1.44 -connect.mysql_index : Modified in 10.4.13 connect.part_file : MDEV-18135 - SSL error: key too small connect.part_table : MDEV-18135 - SSL error: key too small connect.pivot : MDEV-14803 - Failed to discover table connect.secure_file_priv : MDEV-18135 - SSL error: key too small connect.type_inet6 : Added in 10.5.4 connect.vcol : MDEV-12374 - Fails on Windows -connect.xml2_grant : Include file modified in 10.1.44 -connect.xml_grant : Include file modified in 10.1.44 connect.zip : MDEV-13884 - Wrong result #----------------------------------------------------------------------- @@ -361,7 +363,6 @@ encryption.debug_key_management : MDEV-13841 - Timeout encryption.encrypt_and_grep : MDEV-13765 - Wrong result encryption.innochecksum : MDEV-13644 - Assertion failure encryption.innodb-bad-key-change2 : MDEV-19118 - Can't connect to local MySQL server through socket -encryption.innodb-checksum-algorithm : MDEV-20213 - Server crash encryption.innodb-compressed-blob : MDEV-14728 - Unable to get certificate encryption.innodb-discard-import : MDEV-19113 - Timeout encryption.innodb-encryption-alter : MDEV-13566 - Lock wait timeout @@ -378,7 +379,7 @@ encryption.innodb-spatial-index : MDEV-13746 - Wrong result encryption.innodb_encrypt_key_rotation_age : MDEV-19763 - Timeout encryption.innodb_encrypt_log : MDEV-13725 - Wrong result encryption.innodb_encrypt_log_corruption : MDEV-14379 - Server crash -encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result +encryption.innodb_encrypt_temporary_tables : MDEV-20142 - Wrong result; modified in 10.5.5 encryption.innodb_encryption : MDEV-14728 - Unable to get certificate; MDEV-15675 - Timeout encryption.innodb_encryption-page-compression : MDEV-12630 - Crash or assertion failure; MDEV-21843 - Assertion failure encryption.innodb_encryption_discard_import : MDEV-16116 - Wrong result @@ -411,7 +412,7 @@ federated.federated_innodb : MDEV-10617 - Wrong checksum federated.federated_partition : MDEV-10417 - Fails on Mips federated.federated_transactions : MDEV-10617 - Wrong checksum federated.federatedx : MDEV-10617 - Wrong checksum -federated.federatedx_create_handlers : Modified in 10.4.13 +federated.federatedx_create_handlers : Modified in 10.5.5 federated.federatedx_versioning : Modified in 10.5.4 #----------------------------------------------------------------------- @@ -439,12 +440,14 @@ galera_3nodes.* : Suite is not stable yet #----------------------------------------------------------------------- +gcol.gcol_bugfixes : Modified in 10.5.5 gcol.gcol_purge : Added in 10.5.4 -gcol.gcol_rollback : MDEV-16954 - Unknown storage engine 'InnoDB' gcol.innodb_virtual_basic : MDEV-16950 - Failing assertion -gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result; modified in 10.4.13 +gcol.innodb_virtual_debug : MDEV-23404 - Server crash; MDEV-23112 - Server crash +gcol.innodb_virtual_debug_purge : MDEV-16952 - Wrong result gcol.innodb_virtual_fk_restart : MDEV-17466 - Assertion failure gcol.innodb_virtual_purge : MDEV-22952 - Lock wait timeout +gcol.main_alter_table : MDEV-23403 - Wrong result #----------------------------------------------------------------------- @@ -455,35 +458,35 @@ handler.myisam : Include file modified in 10.5.4 #----------------------------------------------------------------------- +heap.drop : Added in 10.5.5 + +#----------------------------------------------------------------------- + innodb.101_compatibility : MDEV-13891 - Wrong result -innodb.alter_algorithm : Modified in 10.4.13 -innodb.alter_algorithm2 : Added in 10.4.13 innodb.alter_copy : MDEV-16181 - Assertion failure innodb.alter_crash : MDEV-16944 - The process cannot access the file; modified in 10.5.4 innodb.alter_large_dml : MDEV-20148 - Debug sync point wait timed out -innodb.alter_missing_tablespace : Modified in 10.4.13 +innodb.alter_primary_key : Added in 10.5.5 innodb.analyze_table : Modified in 10.5.4 -innodb.autoinc_persist : MDEV-15282 - Assertion failure innodb.binlog_consistent : MDEV-10618 - Server fails to start -innodb.blob-crash : MDEV-19298 - Assertion failure -innodb.buf_pool_resize_oom : Added in 10.4.13 +innodb.blob-crash : MDEV-20481 - Crash during recovery innodb.corrupted_during_recovery : Modified in 10.5.4 innodb.create-index : MDEV-20159 - Assertion failure +innodb.default_row_format_alter : Modified in 10.5.5 innodb.default_row_format_compatibility : MDEV-20159 - Assertion failure innodb.doublewrite : MDEV-12905 - Server crash -innodb.foreign_key : Modified in 10.5.4 -innodb.foreign_key_debug : Added in 10.4.13 +innodb.foreign_key : MDEV-21283 - Extra warning; modified in 10.5.4 innodb.group_commit_crash : MDEV-14191 - InnoDB registration failed -innodb.group_commit_crash_no_optimize_thread : MDEV-13830 - Assertion failure +innodb.group_commit_crash_no_optimize_thread : MDEV-11770 - Checksum mismatch innodb.ibuf_not_empty : MDEV-19021 - Wrong result +innodb.innodb : Modified in 10.5.5 innodb.innodb-32k-crash : MDEV-20194 - Extra warnings innodb.innodb-64k-crash : MDEV-13872 - Failure and crash on startup -innodb.innodb-alter : MDEV-22955 - Extra warning; MDEV-22955 - Extra warning +innodb.innodb-alter : MDEV-22955 - Extra warning; modified in 10.5.5 innodb.innodb-alter-debug : MDEV-13182 - InnoDB: adjusting FSP_SPACE_FLAGS; modified in 10.5.4 innodb.innodb-alter-table : MDEV-10619 - Testcase timeout -innodb.innodb-alter-timestamp : Modified in 10.4.13 innodb.innodb-bigblob : MDEV-18655 - ASAN unknown crash -innodb.innodb-blob : MDEV-12053 - Client crash; modified in 10.4.13 +innodb.innodb-blob : MDEV-12053 - Client crash innodb.innodb-change-buffer-recovery : MDEV-19115 - Lost connection to MySQL server during query innodb.innodb-dict : MDEV-20159 - Assertion failure innodb.innodb-fk : MDEV-13832 - Assertion failure on shutdown; modified in 10.5.4 @@ -496,59 +499,55 @@ innodb.innodb-page_compression_tables : MDEV-13644 - Assertion failure innodb.innodb-page_compression_zip : MDEV-10641 - mutex problem innodb.innodb-table-online : MDEV-13894 - Wrong result innodb.innodb-timeout : MDEV-20159 - Assertion failure -innodb.innodb-wl5522 : MDEV-13644 - Assertion failure; modified in 10.4.13 +innodb.innodb-ucs2 : MDEV-23370 - Server crash +innodb.innodb-wl5522 : MDEV-13644 - Assertion failure innodb.innodb-wl5522-1 : MDEV-22945 - Server crash -innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno; modified in 10.4.13 +innodb.innodb-wl5522-debug : MDEV-14200 - Wrong errno innodb.innodb_buffer_pool_dump_pct : MDEV-20139 - Timeout in wait_condition.inc -innodb.innodb_buffer_pool_load_now : Added in 10.4.13 innodb.innodb_buffer_pool_resize : MDEV-16964 - Assertion failure -innodb.innodb_buffer_pool_resize_debug : MDEV-22515 - Timeout in wait_condition; added in 10.4.13 +innodb.innodb_buffer_pool_resize_debug : MDEV-22515 - Timeout in wait_condition; modified in 10.5.5 innodb.innodb_buffer_pool_resize_with_chunks : MDEV-16964 - Assertion failure innodb.innodb_bug14147491 : MDEV-11808 - Index is corrupt; modified in 10.5.4 innodb.innodb_bug30423 : MDEV-7311 - Wrong result innodb.innodb_bug47167 : MDEV-20524 - Table 'user' is marked as crashed and should be repaired innodb.innodb_bug48024 : MDEV-14352 - Assertion failure -innodb.innodb_bug59641 : MDEV-13830 - Assertion failure -innodb.innodb_bug60049 : MDEV-20213 - Server crash innodb.innodb_bulk_create_index_replication : MDEV-15273 - Slave failed to start -innodb.innodb_defrag_concurrent : Modified in 10.4.13 +innodb.innodb_ctype_ldml : Modified in 10.5.5 innodb.innodb_defrag_stats_many_tables : MDEV-14198 - Table is full -innodb.innodb_force_recovery : MDEV-20213 - Server crash; modified in 10.5.4 -innodb.innodb_force_recovery_rollback : MDEV-22889 - Wrong result; added in 10.5.4 +innodb.innodb_force_recovery : Modified in 10.5.4 +innodb.innodb_force_recovery_rollback : MDEV-22889 - Wrong result; modified in 10.5.5 innodb.innodb_information_schema : MDEV-8851 - Wrong result -innodb.innodb_information_schema_buffer : Modified in 10.5.4 +innodb.innodb_information_schema_buffer : MDEV-23418 - Wrong result; modified in 10.5.4 innodb.innodb_max_recordsize_32k : MDEV-14801 - Operation failed innodb.innodb_max_recordsize_64k : MDEV-15203 - Wrong result innodb.innodb_monitor : MDEV-10939 - Testcase timeout -innodb.innodb_mysql : MDEV-19873 - Wrong result -innodb.innodb_prefix_index_restart_server : MDEV-20213 - Server crash +innodb.innodb_mutexes : MDEV-23416 - Extra warning +innodb.innodb_mysql : MDEV-19873 - Wrong result; include file modified in 10.5.5 innodb.innodb_scrub : Added in 10.5.4 innodb.innodb_simulate_comp_failures_small : MDEV-20526 - ASAN use-after-poison +innodb.innodb_skip_innodb_is_tables : Configuration modified in 10.5.5 innodb.innodb_stats : MDEV-10682 - wrong result innodb.innodb_stats_persistent : MDEV-17745 - Wrong result; MDEV-21567 - Wrong result in execution plan innodb.innodb_stats_persistent_debug : MDEV-14801 - Operation failed innodb.innodb_sys_semaphore_waits : MDEV-10331 - Semaphore wait -innodb.innodb_sys_var_valgrind : Added in 10.4.13 innodb.innodb_zip_innochecksum2 : MDEV-13882 - Warning: difficult to find free blocks -innodb.instant_alter : Modified in 10.4.13 -innodb.instant_alter_bugs : Modified in 10.4.13 -innodb.instant_alter_charset : Modified in 10.4.13 -innodb.instant_alter_crash : MDEV-13830 - Assertion failure -innodb.instant_alter_debug : MDEV-22958 - Wrong result; modified in 10.5.4 -innodb.instant_alter_extend : MDEV-20963 - Binary files differ -innodb.instant_alter_index_rename : Modified in 10.4.13 +innodb.instant_alter_bugs : Modified in 10.5.5 +innodb.instant_alter_charset : Modified in 10.5.5 +innodb.instant_alter_debug : MDEV-22958 - Wrong result; modified in 10.5.5 +innodb.instant_alter_extend : MDEV-20963 - Binary files differ; modified in 10.5.5 innodb.instant_alter_limit : Modified in 10.5.4 innodb.leaf_page_corrupted_during_recovery : Modified in 10.5.4 innodb.log_corruption : MDEV-13251 - Wrong result innodb.log_data_file_size : MDEV-14204 - Server failed to start; MDEV-20648 - Assertion failure innodb.log_file : MDEV-20159 - Assertion failure innodb.log_file_name : MDEV-14193 - Exception -innodb.log_file_name_debug : Modified in 10.4.13 innodb.log_file_size : MDEV-15668 - Not found pattern innodb.monitor : MDEV-16179 - Wrong result +innodb.mvcc : Modified in 10.5.5 innodb.page_id_innochecksum : MDEV-20159 - Assertion failure innodb.purge_secondary : MDEV-15681 - Wrong result innodb.purge_thread_shutdown : MDEV-13792 - Wrong result +innodb.read_only_recover_committed : Modified in 10.5.5 innodb.read_only_recovery : MDEV-13886 - Server crash innodb.recovery_shutdown : MDEV-15671 - Checksum mismatch in datafile innodb.row_format_redundant : MDEV-15192 - Trying to access missing tablespace @@ -556,8 +555,7 @@ innodb.table_definition_cache_debug : MDEV-14206 - Extra warning innodb.table_flags : MDEV-13572 - Wrong result; MDEV-19374 - Server failed to start innodb.temp_table_savepoint : Modified in 10.5.4 innodb.temporary_table : MDEV-13265 - Wrong result -innodb.truncate_foreign : MDEV-22511 - Wrong error code -innodb.truncate_inject : Modified in 10.2.31 +innodb.truncate_foreign : Modified in 10.5.5 innodb.undo_truncate : MDEV-17340 - Server hung; MDEV-20840 - Sporadic timeout innodb.undo_truncate_recover : MDEV-17679 - Server has gone away; MDEV-19200 - Shutdown fails innodb.update_time : MDEV-14804 - Wrong result @@ -566,32 +564,22 @@ innodb.xa_recovery_debug : Modified in 10.5.4 #----------------------------------------------------------------------- -innodb_fts.innodb_fts_misc : MDEV-22955 - Extra warning; modified in 10.4.13 +innodb_fts.innodb-fts-ddl : Modified in 10.5.5 +innodb_fts.innodb_fts_misc : MDEV-22955 - Extra warning innodb_fts.innodb_fts_misc_debug : MDEV-14156 - Unexpected warning innodb_fts.innodb_fts_plugin : MDEV-13888 - Errors in server log innodb_fts.innodb_fts_stopword_charset : MDEV-13259 - Table crashed -innodb_fts.misc_debug : Modified in 10.4.13 -innodb_fts.misc_debug2 : Added in 10.4.13 -innodb_fts.stopword : Added in 10.4.13 -innodb_fts.sync : Modified in 10.4.13 innodb_fts.sync_ddl : MDEV-21568 - Errno: 2000; MDEV-18654 - Assertion failure #----------------------------------------------------------------------- innodb_gis.alter_spatial_index : MDEV-13745 - Server crash -innodb_gis.bug16236208 : Modified in 10.4.13 -innodb_gis.bug16266012 : Modified in 10.4.13 -innodb_gis.geometry : Modified in 10.4.13 -innodb_gis.gis_split_inf : Modified in 10.4.13 innodb_gis.gis_split_nan : MDEV-21678 - Cannot get geometry object -innodb_gis.innodb_gis_rtree : MDEV-20213 - Server crash -innodb_gis.point_big : Re-enabled in 10.4.13 innodb_gis.rtree_compress2 : MDEV-16269 - Wrong result innodb_gis.rtree_concurrent_srch : MDEV-15284 - Wrong result with embedded -innodb_gis.rtree_multi_pk : Modified in 10.4.13 innodb_gis.rtree_purge : MDEV-15275 - Timeout innodb_gis.rtree_recovery : MDEV-15274 - Error on check -innodb_gis.rtree_split : MDEV-14208 - Too many arguments; modified in 10.4.13 +innodb_gis.rtree_split : MDEV-14208 - Too many arguments innodb_gis.rtree_undo : MDEV-14456 - Timeout in include file innodb_gis.types : MDEV-15679 - Table is marked as crashed @@ -602,11 +590,9 @@ innodb_zip.create_options : MDEV-21329 - Assertion failure innodb_zip.index_large_prefix_4k : MDEV-21679 - Row size too large innodb_zip.innochecksum : MDEV-14486 - Server failed to shut down innodb_zip.innochecksum_3 : MDEV-13279 - Extra warnings -innodb_zip.page_size : MDEV-14711 - Assertion failure innodb_zip.recover : MDEV-22512 - Server failed to restart -innodb_zip.restart : MDEV-20213 - Server crash -innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2; modified in 10.4.13 -innodb_zip.wl5522_zip : Modified in 10.4.13 +innodb_zip.restart : MDEV-23422 - Wrong result +innodb_zip.wl5522_debug_zip : MDEV-11600 - Operating system error number 2 innodb_zip.wl6470_1 : MDEV-14240 - Assertion failure innodb_zip.wl6501_1 : MDEV-10891 - Can't create UNIX socket innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error 192 @@ -615,7 +601,7 @@ innodb_zip.wl6501_scale_1 : MDEV-13254 - Timeout, MDEV-14104 - Error 192 maria.bulk_insert_crash : Added in 10.5.4 maria.create : Modified in 10.5.4 -maria.icp : Include file modified in 10.4.13 +maria.encrypt-no-key : Added in 10.5.5 maria.insert_select : MDEV-12757 - Timeout maria.insert_select-7314 : MDEV-16492 - Timeout maria.lock : Modified in 10.5.4 @@ -627,23 +613,19 @@ maria.transaction : Added in 10.5.4 #----------------------------------------------------------------------- -mariabackup.* : suite.pm modified in 10.4.13 mariabackup.absolute_ibdata_paths : MDEV-16571 - Wrong result mariabackup.apply-log-only : MDEV-20135 - Timeout -mariabackup.backup_lock_wait_timeout : Added in 10.4.13 mariabackup.create_with_data_directory_during_backup : MDEV-20159 - Assertion failure mariabackup.data_directory : MDEV-15270 - Error on exec mariabackup.full_backup : MDEV-16571 - Wrong result -mariabackup.huge_lsn : MDEV-15662 - Sequence number is in the future; MDEV-18569 - Table doesn't exist +mariabackup.huge_lsn : MDEV-18569 - Table doesn't exist; modified in 10.5.5 mariabackup.incremental_backup : MDEV-21222 - Memory allocation failure mariabackup.incremental_encrypted : MDEV-15667 - timeout mariabackup.incremental_rocksdb : MDEV-20954 - Cannot access the file -mariabackup.innodb_xa_rollback : Added in 10.4.13 mariabackup.log_checksum_mismatch : MDEV-16571 - Wrong result mariabackup.mdev-14447 : MDEV-15201 - Timeout -mariabackup.options_check : Added in 10.5.4 -mariabackup.partial : MDEV-19298 - Assertion failure -mariabackup.partial_exclude : MDEV-15270 - Error on exec; modified in 10.4.13 +mariabackup.options_check : Modified in 10.5.5 +mariabackup.partial_exclude : MDEV-15270 - Error on exec mariabackup.unencrypted_page_compressed : MDEV-18653 - Wrong error mariabackup.xb_compressed_encrypted : MDEV-14812 - Segmentation fault mariabackup.xb_file_key_management : MDEV-16571 - Wrong result @@ -654,23 +636,14 @@ mariabackup.xb_rocksdb : MDEV-17338 - Server hung #----------------------------------------------------------------------- -mroonga/storage.column_datetime_32bit_2038 : Wrong result on Alpha -mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha -mroonga/storage.column_datetime_32bit_max : Wrong result on Alpha -mroonga/storage.column_datetime_32bit_out_of_range : Wrong result on Alpha -mroonga/storage.index_multiple_column_unique_date_32bit_equal : Wrong result on Alpha -mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong result on Alpha -mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - Valgrind -mroonga/storage.optimization_count_skip_index_between : Modified in 10.4.13 -mroonga/storage.optimization_count_skip_index_greater : Modified in 10.4.13 -mroonga/storage.optimization_count_skip_index_greater_equal : Modified in 10.4.13 -mroonga/storage.optimization_count_skip_index_less : Modified in 10.4.13 -mroonga/storage.optimization_count_skip_index_less_equal : Modified in 10.4.13 -mroonga/storage.optimization_count_skip_primary_key_between : Modified in 10.4.13 -mroonga/storage.optimization_count_skip_primary_key_greater : Modified in 10.4.13 -mroonga/storage.optimization_count_skip_primary_key_greater_equal : Modified in 10.4.13 -mroonga/storage.repair_table_no_index_file : MDEV-9364 - wrong result, MDEV-14807 - wrong error message -mroonga/storage.variable_max_n_records_for_estimate_not_found_in_limit : Modified in 10.4.13 +mroonga/storage.column_datetime_32bit_2038 : Wrong result on Alpha +mroonga/storage.column_datetime_32bit_before_unix_epoch : Wrong result on Alpha +mroonga/storage.column_datetime_32bit_max : Wrong result on Alpha +mroonga/storage.column_datetime_32bit_out_of_range : Wrong result on Alpha +mroonga/storage.index_multiple_column_unique_date_32bit_equal : Wrong result on Alpha +mroonga/storage.index_multiple_column_unique_date_order_32bit_desc : Wrong result on Alpha +mroonga/storage.index_multiple_column_unique_datetime_index_read : MDEV-8643 - Valgrind +mroonga/storage.repair_table_no_index_file : MDEV-9364 - wrong result, MDEV-14807 - wrong error message #----------------------------------------------------------------------- @@ -679,7 +652,7 @@ mroonga/wrapper.repair_table_no_index_file : MDEV-14807 - Wrong error message #----------------------------------------------------------------------- multi_source.gtid : MDEV-14202 - Crash -multi_source.info_logs : MDEV-12629 - Valgrind, MDEV-10042 - wrong result; MDEV-21290 - Wrong result +multi_source.info_logs : MDEV-12629 - Valgrind; MDEV-10042 - wrong result; MDEV-21290 - Wrong result multi_source.load_data : MDEV-21235 - Slave crash multi_source.mdev-8874 : MDEV-19415 - AddressSanitizer: heap-use-after-free multi_source.mdev-9544 : MDEV-19415 - AddressSanitizer: heap-use-after-free @@ -691,11 +664,11 @@ multi_source.status_vars : MDEV-4632 - failed while waiting #----------------------------------------------------------------------- -oqgraph.social : MDEV-22280 - Timeout; MDEV-22280 - Timeout +oqgraph.social : MDEV-22280 - Timeout #----------------------------------------------------------------------- -parts.alter_table : Added in 10.5.4 +parts.alter_table : Modified in 10.5.5 parts.debug_innodb_crash : Added in 10.5.4 parts.debug_innodb_fail : Added in 10.5.4 parts.debug_myisam_crash : Include file modified in 10.5.4 @@ -705,7 +678,6 @@ parts.partition_alter1_1_2_innodb : MDEV-18655 - ASAN unknown crash parts.partition_alter1_1_innodb : MDEV-18655 - ASAN unknown crash parts.partition_alter1_2_innodb : MDEV-18655 - ASAN unknown crash parts.partition_alter2_2_maria : MDEV-14364 - Lost connection to MySQL server during query -parts.partition_alter_instant : Added in 10.4.13 parts.partition_auto_increment_archive : MDEV-16491 - Marked as crashed and should be repaired; include file modified in 10.5.4 parts.partition_auto_increment_blackhole : Include file modified in 10.5.4 parts.partition_auto_increment_innodb : Include file modified in 10.5.4 @@ -713,11 +685,12 @@ parts.partition_auto_increment_maria : MDEV-14430 - Extra warning; include f parts.partition_auto_increment_memory : Include file modified in 10.5.4 parts.partition_auto_increment_myisam : Include file modified in 10.5.4 parts.partition_basic_innodb : MDEV-20214 - ASAN error +parts.partition_debug : Modified in 10.5.5 parts.partition_debug_innodb : MDEV-10891 - Can't create UNIX socket; MDEV-15095 - Table doesn't exist; modified in 10.5.4 parts.partition_debug_myisam : Modified in 10.5.4 parts.partition_exch_qa_10 : MDEV-11765 - wrong result parts.partition_innodb_status_file : MDEV-12901 - Valgrind -parts.partition_special_innodb : MDEV-16942 - Timeout; modified in 10.4.13 +parts.partition_special_innodb : MDEV-16942 - Timeout parts.percona_nonflushing_analyze_debug : Added in 10.5.4 #----------------------------------------------------------------------- @@ -737,8 +710,9 @@ perfschema.hostcache_ipv4_addrinfo_again_allow : MDEV-12759 - Crash perfschema.hostcache_ipv6_addrinfo_again_allow : MDEV-12752 - Crash perfschema.hostcache_ipv6_addrinfo_bad_allow : MDEV-13260 - Crash perfschema.hostcache_ipv6_ssl : MDEV-10696 - Crash +perfschema.memory_aggregate_no_a : MDEV-22949 - Wrong result perfschema.memory_aggregate_no_a_no_h : MDEV-22949 - Wrong result -perfschema.memory_aggregate_no_a_no_u : MDEV-22949 - Wrong result; MDEV-22949 - Wrong result +perfschema.memory_aggregate_no_a_no_u : MDEV-22949 - Wrong result perfschema.no_threads : Modified in 10.5.4 perfschema.one_thread_per_con : Modified in 10.5.4 perfschema.pfs_upgrade_event : MDEV-20957 - Wrong result @@ -770,18 +744,17 @@ perfschema_stress.* : MDEV-10996 - Not maintained #----------------------------------------------------------------------- -period.alter : Modified in 10.4.13 period.engines : Combinations modified in 10.5.4 period.overlaps : Modified in 10.5.4 -period.update : Modified in 10.4.13 period.versioning : MDEV-20159 - Assertion failure; include file modified in 10.5.4 #----------------------------------------------------------------------- +plugins.audit_null_debug : Modified in 10.5.5 plugins.feedback_plugin_send : MDEV-7932, MDEV-11118 - Connection problems and such -plugins.multiauth : MDEV-20163 - Plugin could not be loaded; modified in 10.4.13 +plugins.multiauth : MDEV-20163 - Plugin could not be loaded plugins.processlist : MDEV-16574 - Wrong result -plugins.server_audit : MDEV-14295 - Wrong result; modified in 10.4.13 +plugins.server_audit : MDEV-14295 - Wrong result plugins.thread_pool_server_audit : MDEV-14295 - Wrong result #----------------------------------------------------------------------- @@ -822,142 +795,128 @@ rocksdb_sys_vars.rocksdb_rate_limiter_bytes_per_sec_basic : MDEV-16639 - Crash #----------------------------------------------------------------------- roles.create_and_grant_role : MDEV-11772 - wrong result -roles.grant_revoke_current : Modified in 10.4.13 +roles.drop_current_role : Added in 10.5.5 roles.set_default_role_invalid : Modified in 10.5.4 #----------------------------------------------------------------------- -rpl.circular_serverid0 : MDEV-19372 - ASAN heap-use-after-free; modified in 10.4.13 -rpl.create_or_replace2 : MDEV-19412 - Lost connection to MySQL server -rpl.create_or_replace_mix : MDEV-20523 - Wrong result -rpl.create_or_replace_statement : MDEV-20523 - Wrong result -rpl.create_select : MDEV-14121 - Assertion failure -rpl.last_insert_id : MDEV-10625 - warnings in error log -rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips -rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips -rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log -rpl.rpl_binlog_errors : MDEV-12742 - Crash; include file modified in 10.4.13 -rpl.rpl_binlog_grant : MDEV-21274 - Lost connection at handshake -rpl.rpl_binlog_index : MDEV-9501 - Failed registering on master -rpl.rpl_bug41902 : Configuration deleted in 10.4.13 -rpl.rpl_cant_read_event_incident : MDEV-20960 - Abort on shutdown -rpl.rpl_checksum : Include file modified in 10.2.31 -rpl.rpl_checksum_cache : MDEV-22510 - Server crash -rpl.rpl_circular_for_4_hosts : MDEV-20536 - Server crash -rpl.rpl_colSize : MDEV-16112 - Server crash -rpl.rpl_conditional_comments : Modified in 10.4.13 -rpl.rpl_corruption : MDEV-20527 - Slave stopped with wrong error code; include file modified in 10.4.13 -rpl.rpl_create_tmp_table_if_not_exists : MDEV-20159 - Assertion failure -rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac -rpl.rpl_ddl : MDEV-10417 - Fails on Mips -rpl.rpl_domain_id_filter : MDEV-20213 - Server crash -rpl.rpl_domain_id_filter_io_crash : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash; modified in 10.4.13 -rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Table marked as crashed -rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result; MDEV-19043 - Table marked as crashed -rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start -rpl.rpl_dual_pos_advance : MDEV-20213 - Server crash -rpl.rpl_extra_col_master_innodb : MDEV-16570 - Extra warning -rpl.rpl_extra_col_master_myisam : MDEV-14203 - Extra warning -rpl.rpl_fail_register : Modified in 10.5.4 -rpl.rpl_flushlog_loop : MDEV-21570 - Server crash -rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output -rpl.rpl_get_master_version_and_clock : Re-enabled in 10.4.13; include file modified in 10.4.13 -rpl.rpl_gtid_basic : MDEV-10681 - server startup problem -rpl.rpl_gtid_crash : MDEV-9501 - Failed registering on master, MDEV-13643 - Lost connection -rpl.rpl_gtid_delete_domain : MDEV-14463 - Timeout -rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash -rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings -rpl.rpl_gtid_reconnect : MDEV-14497 - Crash -rpl.rpl_gtid_startpos : MDEV-20141 - mysqltest failed but provided no output -rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings -rpl.rpl_gtid_strict : Modified in 10.4.13 -rpl.rpl_gtid_until : MDEV-10625 - warnings in error log -rpl.rpl_heartbeat : MDEV-20213 - Server crash -rpl.rpl_ignore_grant : MDEV-20159 - Assertion failure -rpl.rpl_ignore_table : Modified in 10.4.13 -rpl.rpl_ignore_table_update : MDEV-20159 - Assertion failure -rpl.rpl_incident : Include file modified in 10.2.31 -rpl.rpl_init_slave_errors : Include file modified in 10.2.31 -rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips -rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_insert_id : MDEV-15197 - Wrong result -rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure -rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query -rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips -rpl.rpl_ipv4_as_ipv6 : MDEV-20147 - Incorrect checksum for freed object -rpl.rpl_known_bugs_detection : MDEV-20213 - Server crash -rpl.rpl_lcase_tblnames_rewrite_db : MDEV-20213 - Server crash -rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog -rpl.rpl_mdev-11092 : MDEV-20213 - Server crash -rpl.rpl_mdev12179 : MDEV-19043 - Table marked as crashed -rpl.rpl_mdev6020 : MDEV-15272 - Server crash -rpl.rpl_mixed_mixing_engines : MDEV-21266 - Timeout -rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master_pos_wait -rpl.rpl_old_master : MDEV-22956 - Assertion failure -rpl.rpl_parallel : MDEV-10653 - Timeouts -rpl.rpl_parallel2 : MDEV-17390 - Operation cannot be performed -rpl.rpl_parallel_conflicts : MDEV-15272 - Server crash -rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure -rpl.rpl_parallel_multilevel : MDEV-20160 - Server crash -rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout -rpl.rpl_parallel_optimistic : MDEV-15278 - Failed to sync with master -rpl.rpl_parallel_optimistic_nobinlog : MDEV-15278 - Failed to sync with master -rpl.rpl_parallel_optimistic_until : Added in 10.5.4 -rpl.rpl_parallel_retry : MDEV-11119 - Crash; MDEV-17109 - Timeout -rpl.rpl_parallel_temptable : MDEV-10356 - Crash; MDEV-19076 - Wrong result -rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips -rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings -rpl.rpl_plugin_load : MDEV-20213 - Server crash -rpl.rpl_read_only : MDEV-20159 - Assertion failure -rpl.rpl_relayrotate : MDEV-20213 - Server crash -rpl.rpl_row_001 : MDEV-16653 - MTR's internal check fails -rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start -rpl.rpl_row_basic_2myisam : MDEV-13875 - command "diff_files" failed -rpl.rpl_row_corruption : MDEV-21569 - mutex: LOCK_global_system_variables unlocking; modified in 10.4.13 -rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result -rpl.rpl_row_end_of_statement_loss : MDEV-21237 - Server crash -rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed -rpl.rpl_row_img_eng_min : MDEV-13875 - diff_files failed -rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed -rpl.rpl_row_index_choice : MDEV-15196 - Slave crash -rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x -rpl.rpl_row_until : MDEV-14052 - Master will not send events with checksum -rpl.rpl_semi_sync : MDEV-11220 - Wrong result -rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result -rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result -rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings -rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures -rpl.rpl_semi_sync_wait_no_slave : MDEV-20159 - Assertion failure -rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition -rpl.rpl_semisync_ali_issues : MDEV-16272 - Wrong result -rpl.rpl_set_null_myisam : MDEV-20213 - Server crash -rpl.rpl_set_statement_default_master : MDEV-13258 - Extra warning -rpl.rpl_show_slave_hosts : MDEV-10681 - Crash -rpl.rpl_shutdown_wait_semisync_slaves : MDEV-20213 - Server crash -rpl.rpl_shutdown_wait_slaves : MDEV-22517 - Timeout on sync_with_master -rpl.rpl_skip_replication : MDEV-13258 - Extra warning -rpl.rpl_slave_alias_replica : MDEV-22951 - Wrong result -rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock -rpl.rpl_slave_load_in : MDEV-20159 - Assertion failure -rpl.rpl_slave_load_tmpdir_not_exist : MDEV-14203 - Extra warning -rpl.rpl_slow_query_log : MDEV-13250 - Test abort -rpl.rpl_sp_effects : MDEV-13249 - Crash -rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout -rpl.rpl_stm_multi_query : MDEV-9501 - Failed registering on master -rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion -rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash; include file modified in 10.4.13 -rpl.rpl_sync : MDEV-13830 - Assertion failure -rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master -rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries -rpl.rpl_test_framework : MDEV-19368 - mysqltest failed but provided no output -rpl.rpl_trigger : MDEV-18055 - Wrong result -rpl.rpl_truncate_3innodb : MDEV-19454 - Syntax error -rpl.rpl_upgrade_master_info : MDEV-16567 - Assertion failure -rpl.rpl_user_variables : MDEV-20522 - Wrong result -rpl.rpl_variables : MDEV-20150 - Server crash -rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result -rpl.show_status_stop_slave_race-7126 : MDEV-17438 - Timeout +rpl.circular_serverid0 : MDEV-19372 - ASAN heap-use-after-free +rpl.create_or_replace2 : MDEV-19412 - Lost connection to MySQL server +rpl.create_or_replace_mix : MDEV-20523 - Wrong result +rpl.create_or_replace_statement : MDEV-20523 - Wrong result +rpl.create_select : MDEV-14121 - Assertion failure +rpl.last_insert_id : MDEV-10625 - warnings in error log +rpl.parallel_backup : Added in 10.5.5 +rpl.rpl_auto_increment : MDEV-10417 - Fails on Mips +rpl.rpl_auto_increment_bug45679 : MDEV-10417 - Fails on Mips +rpl.rpl_auto_increment_update_failure : MDEV-10625 - warnings in error log +rpl.rpl_binlog_dump_slave_gtid_state_info : Added in 10.5.5 +rpl.rpl_binlog_errors : MDEV-12742 - Crash +rpl.rpl_binlog_grant : MDEV-21274 - Lost connection at handshake +rpl.rpl_binlog_index : MDEV-9501 - Failed registering on master +rpl.rpl_cant_read_event_incident : MDEV-20960 - Abort on shutdown +rpl.rpl_checksum_cache : MDEV-22510 - Server crash +rpl.rpl_circular_for_4_hosts : MDEV-20536 - Server crash +rpl.rpl_colSize : MDEV-16112 - Server crash +rpl.rpl_corruption : MDEV-20527 - Slave stopped with wrong error code +rpl.rpl_create_tmp_table_if_not_exists : MDEV-20159 - Assertion failure +rpl.rpl_ctype_latin1 : MDEV-14813 - Wrong result on Mac +rpl.rpl_ddl : MDEV-10417 - Fails on Mips +rpl.rpl_domain_id_filter_io_crash : MDEV-12729 - Timeout in include file, MDEV-13677 - Server crash +rpl.rpl_domain_id_filter_master_crash : MDEV-19043 - Table marked as crashed +rpl.rpl_domain_id_filter_restart : MDEV-10684 - Wrong result; MDEV-19043 - Table marked as crashed +rpl.rpl_drop_db_fail : MDEV-16898 - Slave fails to start +rpl.rpl_dump_request_retry_warning : Added in 10.5.5 +rpl.rpl_extra_col_master_innodb : MDEV-16570 - Extra warning +rpl.rpl_fail_register : Modified in 10.5.4 +rpl.rpl_flushlog_loop : MDEV-21570 - Server crash +rpl.rpl_get_lock : MDEV-19368 - mysqltest failed but provided no output +rpl.rpl_gtid_basic : MDEV-10681 - server startup problem +rpl.rpl_gtid_crash : MDEV-9501 - Failed registering on master, MDEV-13643 - Lost connection +rpl.rpl_gtid_delete_domain : MDEV-23103 - Could not delete gtid domain; MDEV-14463 - Timeout +rpl.rpl_gtid_errorhandling : MDEV-13261 - Crash +rpl.rpl_gtid_mdev9033 : MDEV-10680 - warnings +rpl.rpl_gtid_reconnect : MDEV-14497 - Crash +rpl.rpl_gtid_startpos : MDEV-20141 - mysqltest failed but provided no output +rpl.rpl_gtid_stop_start : MDEV-10629 - Crash on shutdown, MDEV-12629 - Valgrind warnings +rpl.rpl_gtid_until : MDEV-10625 - warnings in error log +rpl.rpl_ignore_grant : MDEV-20159 - Assertion failure +rpl.rpl_ignore_table_update : MDEV-20159 - Assertion failure +rpl.rpl_innodb_bug30888 : MDEV-10417 - Fails on Mips +rpl.rpl_insert : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_insert_delayed : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_insert_id : MDEV-15197 - Wrong result +rpl.rpl_insert_id_pk : MDEV-16567 - Assertion failure +rpl.rpl_insert_ignore : MDEV-14365 - Lost connection to MySQL server during query +rpl.rpl_invoked_features : MDEV-10417 - Fails on Mips +rpl.rpl_ipv4_as_ipv6 : MDEV-20147 - Incorrect checksum for freed object +rpl.rpl_mariadb_slave_capability : MDEV-11018 - Extra lines in binlog +rpl.rpl_mdev12179 : MDEV-19043 - Table marked as crashed +rpl.rpl_mdev6020 : MDEV-15272 - Server crash +rpl.rpl_mixed_mixing_engines : MDEV-21266 - Timeout +rpl.rpl_multi_engine : MDEV-23419 - Server crash +rpl.rpl_non_direct_row_mixing_engines : MDEV-16561 - Timeout in master_pos_wait +rpl.rpl_old_master : MDEV-22956 - Assertion failure +rpl.rpl_parallel : MDEV-10653 - Timeouts +rpl.rpl_parallel2 : MDEV-17390 - Operation cannot be performed; modified in 10.5.5 +rpl.rpl_parallel_conflicts : MDEV-15272 - Server crash +rpl.rpl_parallel_mdev6589 : MDEV-12979 - Assertion failure +rpl.rpl_parallel_multilevel : MDEV-20160 - Server crash +rpl.rpl_parallel_multilevel2 : MDEV-14723 - Timeout +rpl.rpl_parallel_optimistic : MDEV-15278 - Failed to sync with master +rpl.rpl_parallel_optimistic_nobinlog : MDEV-15278 - Failed to sync with master +rpl.rpl_parallel_optimistic_until : MDEV-23021 - Query didn't return a result set; added in 10.5.4 +rpl.rpl_parallel_retry : MDEV-11119 - Crash; MDEV-17109 - Timeout +rpl.rpl_parallel_temptable : MDEV-10356 - Crash; MDEV-19076 - Wrong result +rpl.rpl_partition_innodb : MDEV-10417 - Fails on Mips +rpl.rpl_password_boundaries : MDEV-11534 - Slave IO warnings +rpl.rpl_read_only : MDEV-20159 - Assertion failure +rpl.rpl_row_001 : MDEV-16653 - MTR's internal check fails +rpl.rpl_row_basic_11bugs : MDEV-12171 - Server failed to start +rpl.rpl_row_basic_2myisam : MDEV-13875 - command "diff_files" failed +rpl.rpl_row_corruption : MDEV-21569 - mutex: LOCK_global_system_variables unlocking +rpl.rpl_row_drop_create_temp_table : MDEV-14487 - Wrong result +rpl.rpl_row_end_of_statement_loss : MDEV-21237 - Server crash +rpl.rpl_row_img_blobs : MDEV-13875 - command "diff_files" failed +rpl.rpl_row_img_eng_min : MDEV-13875 - diff_files failed +rpl.rpl_row_img_eng_noblob : MDEV-13875 - command "diff_files" failed +rpl.rpl_row_index_choice : MDEV-15196 - Slave crash +rpl.rpl_row_sp001 : MDEV-9329 - Fails on Ubuntu/s390x +rpl.rpl_row_until : MDEV-14052 - Master will not send events with checksum +rpl.rpl_row_virt : Added in 10.5.5 +rpl.rpl_semi_sync : MDEV-11220 - Wrong result +rpl.rpl_semi_sync_after_sync : MDEV-14366 - Wrong result +rpl.rpl_semi_sync_after_sync_row : MDEV-14366 - Wrong result +rpl.rpl_semi_sync_event_after_sync : MDEV-11806 - warnings +rpl.rpl_semi_sync_skip_repl : MDEV-23371 - Server crash +rpl.rpl_semi_sync_uninstall_plugin : MDEV-7140 - Assorted failures +rpl.rpl_semi_sync_wait_no_slave : MDEV-20159 - Assertion failure +rpl.rpl_semi_sync_wait_point : MDEV-11807 - timeout in wait condition +rpl.rpl_semisync_ali_issues : MDEV-16272 - Wrong result +rpl.rpl_show_slave_hosts : MDEV-10681 - Crash +rpl.rpl_shutdown_wait_slaves : MDEV-22517 - Timeout on sync_with_master +rpl.rpl_skip_replication : MDEV-23372 - Extra warning +rpl.rpl_slave_alias_replica : Modified in 10.5.5 +rpl.rpl_slave_grp_exec : MDEV-10514 - Deadlock +rpl.rpl_slave_load_in : MDEV-20159 - Assertion failure +rpl.rpl_slow_query_log : MDEV-13250 - Test abort +rpl.rpl_sp_effects : MDEV-13249 - Crash +rpl.rpl_start_stop_slave : MDEV-13567 - Sync slave timeout +rpl.rpl_stm_multi_query : MDEV-9501 - Failed registering on master +rpl.rpl_stm_relay_ign_space : MDEV-14360 - Test assertion +rpl.rpl_stm_start_stop_slave : MDEV-23180 - ASAN heap-use-after-free +rpl.rpl_stm_stop_middle_group : MDEV-13791 - Server crash +rpl.rpl_sync : MDEV-10633 - Database page corruption +rpl.rpl_temporal_mysql56_to_mariadb53 : MDEV-9501 - Failed registering on master +rpl.rpl_temporary_error2 : MDEV-10634 - Wrong number of retries +rpl.rpl_test_framework : MDEV-19368 - mysqltest failed but provided no output +rpl.rpl_trigger : MDEV-18055 - Wrong result +rpl.rpl_truncate_3innodb : MDEV-19454 - Syntax error +rpl.rpl_upgrade_master_info : MDEV-16567 - Assertion failure +rpl.rpl_user_variables : MDEV-20522 - Wrong result +rpl.rpl_variables : MDEV-20150 - Server crash +rpl.sec_behind_master-5114 : MDEV-13878 - Wrong result +rpl.show_status_stop_slave_race-7126 : MDEV-17438 - Timeout #----------------------------------------------------------------------- @@ -999,15 +958,11 @@ spider/bg.vp_fixes : MDEV-9329 - Fails on Ubuntu/s390x #----------------------------------------------------------------------- -spider/bugfix.* : Include fieles modified in 10.5.4 -spider/bugfix.insert_select : Added in 10.5.4 -spider/bugfix.mdev_20502 : Added in 10.4.13 -spider/bugfix.mdev_21884 : Added in 10.4.13 -spider/bugfix.return_found_rows_insert : Modified in 10.4.13 -spider/bugfix.return_found_rows_update : Modified in 10.4.13 -spider/bugfix.self_reference : Added in 10.5.4 -spider/bugfix.slave_trx_isolation : Modified in 10.5.4 -spider/bugfix.strict_group_by : Added in 10.5.4 +spider/bugfix.* : Include fieles modified in 10.5.4 +spider/bugfix.insert_select : Added in 10.5.4 +spider/bugfix.self_reference : Added in 10.5.4 +spider/bugfix.slave_trx_isolation : Modified in 10.5.4 +spider/bugfix.strict_group_by : Added in 10.5.4 #----------------------------------------------------------------------- @@ -1018,7 +973,8 @@ spider/handler.* : MDEV-10987, MDEV-10990 - Tests have not been maintained sql_sequence.alter : Modified in 10.5.4 sql_sequence.concurrent_create : MDEV-16635 - Server crash sql_sequence.create : Modified in 10.5.4 -sql_sequence.rebuild : Modified in 10.4.13 +sql_sequence.kill : MDEV-23393 - Server crash; added in 10.5.5 +sql_sequence.read_only : MDEV-22956 - Failing assertion #----------------------------------------------------------------------- @@ -1033,25 +989,22 @@ stress.misc : Added in 10.5.4 #----------------------------------------------------------------------- sys_vars.all_vars : Modified in 10.5.4 -sys_vars.alter_algorithm_basic : Added in 10.4.13 sys_vars.autocommit_func2 : MDEV-9329 - Fails on Ubuntu/s390x sys_vars.host_cache_size_auto : MDEV-20112 - Wrong result sys_vars.innodb_buffer_pool_dump_at_shutdown_basic : MDEV-14280 - Unexpected error sys_vars.innodb_checksum_algorithm_basic : MDEV-21568 - Errno: 2000 +sys_vars.innodb_commit_concurrency_basic : Modified in 10.5.5 sys_vars.innodb_fatal_semaphore_wait_threshold : MDEV-22961 - Server failed to dissapear -sys_vars.innodb_instant_alter_column_allowed_basic : Added in 10.4.13 sys_vars.keep_files_on_create_basic : MDEV-10676 - timeout sys_vars.log_slow_admin_statements_func : MDEV-12235 - Server crash sys_vars.max_sort_length_basic : Modified in 10.5.4 +sys_vars.optimizer_switch_basic : Modified in 10.5.5 sys_vars.rpl_init_slave_func : MDEV-10149 - Test assertion +sys_vars.session_track_system_variables_basic : Modified in 10.5.5 sys_vars.slow_query_log_func : MDEV-14273 - Wrong result sys_vars.thread_cache_size_func : MDEV-11775 - Wrong result sys_vars.thread_pool_size_basic : Modified in 10.5.4 sys_vars.wait_timeout_func : MDEV-12896 - Wrong result; modified in 10.5.4 -tokudb_parts.partition_auto_increment_tokudb : Include file modified in 10.5.4 -tokudb_parts.partition_debug_tokudb : Include file modified in 10.5.4 - -#----------------------------------------------------------------------- type_inet.type_inet6 : Modified in 10.5.4 type_inet.type_inet6_stat_tables : Modified in 10.5.4 @@ -1087,26 +1040,22 @@ versioning.engines : Combinations modified in 10.5.4 versioning.foreign : Include file modified in 10.5.4 versioning.insert : Include file modified in 10.5.4 versioning.online : Include file modified in 10.5.4 -versioning.partition : Modified in 10.5.4 +versioning.partition : Modified in 10.5.5 versioning.replace : MDEV-22960 - OS errors, crash; include file modified in 10.5.4 versioning.select : Modified in 10.5.4 versioning.select2 : Modified in 10.5.4 -versioning.sysvars : Modified in 10.5.4 -versioning.update : MDEV-22475 - Wrong result code; include file modified in 10.5.4 +versioning.sysvars : Modified in 10.5.5 +versioning.update : MDEV-22475 - Wrong result code; modified in 10.5.5 versioning.update-big : Include file modified in 10.5.4 versioning.view : Modified in 10.5.4 #----------------------------------------------------------------------- -wsrep.* : suite.pm modified in 10.4.13 -wsrep.MDEV-20625 : Added in 10.4.13 wsrep.foreign_key : MDEV-14725 - WSREP has not yet prepared node wsrep.mdev_6832 : MDEV-14195 - Check testcase failed wsrep.pool_of_threads : MDEV-17345 - WSREP has not yet prepared node for application use -wsrep.trans : Modified in 10.4.13 wsrep.variables : MDEV-17585 - Deadlock #----------------------------------------------------------------------- -wsrep_info.* : suite.pm modified in 10.4.13 wsrep_info.plugin : MDEV-22470 - WSREP: no nodes coming from prim view, prim not possible diff --git a/mysys/stacktrace.c b/mysys/stacktrace.c index 958ca506c59..36731e14a58 100644 --- a/mysys/stacktrace.c +++ b/mysys/stacktrace.c @@ -33,13 +33,14 @@ #include #endif +#ifdef __linux__ #define PTR_SANE(p) ((p) && (char*)(p) >= heap_start && (char*)(p) <= heap_end) - static char *heap_start; +char *__bss_start; +#else +#define PTR_SANE(p) (p) +#endif /* __linux */ -#if(defined HAVE_BSS_START) && !(defined __linux__) -extern char *__bss_start; -#endif /** Default handler for printing stacktrace @@ -67,9 +68,9 @@ static sig_handler default_handle_fatal_signal(int sig) void my_init_stacktrace(int setup_handlers) { -#if(defined HAVE_BSS_START) && !(defined __linux__) +#ifdef __linux__ heap_start = (char*) &__bss_start; -#endif +#endif /* __linux */ if (setup_handlers) { struct sigaction sa; @@ -186,15 +187,15 @@ static int safe_print_str(const char *addr, size_t max_len) int my_safe_print_str(const char* val, size_t max_len) { +#ifdef __linux__ char *heap_end; -#ifdef __linux__ // Try and make use of /proc filesystem to safely print memory contents. if (!safe_print_str(val, max_len)) return 0; -#endif heap_end= (char*) sbrk(0); +#endif if (!PTR_SANE(val)) { diff --git a/plugin/type_geom/plugin.cc b/plugin/type_geom/plugin.cc index 0f4dccc6a06..b462a34cef9 100644 --- a/plugin/type_geom/plugin.cc +++ b/plugin/type_geom/plugin.cc @@ -234,7 +234,7 @@ maria_declare_plugin(type_geom) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity (see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE // Maturity (see include/mysql/plugin.h)*/ }, { MYSQL_INFORMATION_SCHEMA_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -249,6 +249,6 @@ maria_declare_plugin(type_geom) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity (see include/mysql/plugin.h) + MariaDB_PLUGIN_MATURITY_STABLE // Maturity (see include/mysql/plugin.h) } maria_declare_plugin_end; diff --git a/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.result b/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.result index 5cbce33048c..9ee1a0202b0 100644 --- a/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.result +++ b/plugin/type_inet/mysql-test/type_inet/func_inet_plugin.result @@ -35,7 +35,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function INET6_ATON() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 ---- ---- PLUGIN_NAME inet6_ntoa @@ -45,7 +45,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function INET6_NTOA() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 ---- ---- PLUGIN_NAME inet_aton @@ -55,7 +55,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function INET_ATON() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 ---- ---- PLUGIN_NAME inet_ntoa @@ -65,7 +65,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function INET_NTOA() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 ---- ---- PLUGIN_NAME is_ipv4 @@ -75,7 +75,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function IS_IPV4() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 ---- ---- PLUGIN_NAME is_ipv4_compat @@ -85,7 +85,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function IS_IPV4_COMPAT() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 ---- ---- PLUGIN_NAME is_ipv4_mapped @@ -95,7 +95,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function IS_IPV4_MAPPED() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 ---- ---- PLUGIN_NAME is_ipv6 @@ -105,7 +105,7 @@ PLUGIN_TYPE FUNCTION PLUGIN_AUTHOR MariaDB Corporation PLUGIN_DESCRIPTION Function IS_IPV6() PLUGIN_LICENSE GPL -PLUGIN_MATURITY Alpha +PLUGIN_MATURITY Stable PLUGIN_AUTH_VERSION 1.0 # # End of 10.5 tests diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.result b/plugin/type_inet/mysql-test/type_inet/type_inet6.result index ecf64d8484a..da949481337 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.result +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.result @@ -2120,3 +2120,42 @@ t2 CREATE TABLE `t2` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t2; DROP TABLE t1; +# +# MDEV-22758 Assertion `!item->null_value' failed in Type_handler_inet6::make_sort_key_part +# +CREATE TABLE t1 (c INET6); +INSERT INTO t1 VALUES ('::'),(NULL); +SELECT * FROM t1 ORDER BY IFNULL(c, 'foo'); +c +NULL +:: +Warnings: +Warning 1292 Incorrect inet6 value: 'foo' +DROP TABLE t1; +CREATE TABLE t1 (c INET6); +INSERT INTO t1 VALUES ('::'),(NULL); +CREATE TABLE t2 AS SELECT IFNULL(c, 'foo') FROM t1; +Warnings: +Warning 1292 Incorrect inet6 value: 'foo' +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(c, 'foo')` inet6 DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t2; +IFNULL(c, 'foo') +:: +NULL +DROP TABLE t2; +CREATE TABLE t2 AS SELECT IFNULL(c, '::1') FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `IFNULL(c, '::1')` inet6 NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +SELECT * FROM t2; +IFNULL(c, '::1') +:: +::1 +DROP TABLE t2; +DROP TABLE t1; diff --git a/plugin/type_inet/mysql-test/type_inet/type_inet6.test b/plugin/type_inet/mysql-test/type_inet/type_inet6.test index 69583286380..ad4cfe57986 100644 --- a/plugin/type_inet/mysql-test/type_inet/type_inet6.test +++ b/plugin/type_inet/mysql-test/type_inet/type_inet6.test @@ -1560,3 +1560,29 @@ SHOW CREATE TABLE t2; DROP TABLE t2; DROP TABLE t1; + +--echo # +--echo # MDEV-22758 Assertion `!item->null_value' failed in Type_handler_inet6::make_sort_key_part +--echo # + +CREATE TABLE t1 (c INET6); +INSERT INTO t1 VALUES ('::'),(NULL); +SELECT * FROM t1 ORDER BY IFNULL(c, 'foo'); +DROP TABLE t1; + +CREATE TABLE t1 (c INET6); +INSERT INTO t1 VALUES ('::'),(NULL); + +# Expect a NULL column +CREATE TABLE t2 AS SELECT IFNULL(c, 'foo') FROM t1; +SHOW CREATE TABLE t2; +SELECT * FROM t2; +DROP TABLE t2; + +# Expect a NOT NULL column +CREATE TABLE t2 AS SELECT IFNULL(c, '::1') FROM t1; +SHOW CREATE TABLE t2; +SELECT * FROM t2; +DROP TABLE t2; + +DROP TABLE t1; diff --git a/plugin/type_inet/plugin.cc b/plugin/type_inet/plugin.cc index 31205aab5e9..d7990b2bc5a 100644 --- a/plugin/type_inet/plugin.cc +++ b/plugin/type_inet/plugin.cc @@ -201,7 +201,7 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -216,7 +216,7 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -231,7 +231,7 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -246,7 +246,7 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -261,7 +261,7 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -276,7 +276,7 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -291,7 +291,7 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ }, { MariaDB_FUNCTION_PLUGIN, // the plugin type (see include/mysql/plugin.h) @@ -306,6 +306,6 @@ maria_declare_plugin(type_inet) NULL, // Status variables NULL, // System variables "1.0", // String version representation - MariaDB_PLUGIN_MATURITY_ALPHA // Maturity(see include/mysql/plugin.h)*/ + MariaDB_PLUGIN_MATURITY_STABLE// Maturity(see include/mysql/plugin.h)*/ } maria_declare_plugin_end; diff --git a/plugin/type_inet/sql_type_inet.h b/plugin/type_inet/sql_type_inet.h index e924e966357..8c42431ccaa 100644 --- a/plugin/type_inet/sql_type_inet.h +++ b/plugin/type_inet/sql_type_inet.h @@ -720,7 +720,17 @@ public: { attr->Type_std_attributes::operator=(Type_std_attributes_inet6()); h->set_handler(this); - for (uint i= 0; i < nitems; i++) + /* + If some of the arguments cannot be safely converted to "INET6 NOT NULL", + then mark the entire function nullability as NULL-able. + Otherwise, keep the generic nullability calculated by earlier stages: + - either by the most generic way in Item_func::fix_fields() + - or by Item_func_xxx::fix_length_and_dec() before the call of + Item_hybrid_func_fix_attributes() + IFNULL() is special. It does not need to test args[0]. + */ + uint first= dynamic_cast(attr) ? 1 : 0; + for (uint i= first; i < nitems; i++) { if (Inet6::fix_fields_maybe_null_on_conversion_to_inet6(items[i])) { diff --git a/scripts/mysql_install_db.sh b/scripts/mysql_install_db.sh index 62d0b3a58c7..5f183afe8fc 100644 --- a/scripts/mysql_install_db.sh +++ b/scripts/mysql_install_db.sh @@ -67,6 +67,7 @@ Usage: $0 [OPTIONS] --cross-bootstrap For internal use. Used when building the MariaDB system tables on a different host than the target. --datadir=path The path to the MariaDB data directory. + --no-defaults Don't read default options from any option file. --defaults-extra-file=name Read this file after the global files are read. --defaults-file=name Only read default options from the given file name. @@ -79,8 +80,6 @@ Usage: $0 [OPTIONS] --help Display this help and exit. --ldata=path The path to the MariaDB data directory. Same as --datadir. - --no-defaults Don't read default options from any option file. - --defaults-file=path Read only this configuration file. --rpm For internal use. This option is used by RPM files during the MariaDB installation process. --skip-name-resolve Use IP addresses rather than hostnames when creating diff --git a/sql/CMakeLists.txt b/sql/CMakeLists.txt index 1a53db4aa61..fb1bb29b8e7 100644 --- a/sql/CMakeLists.txt +++ b/sql/CMakeLists.txt @@ -145,6 +145,7 @@ SET (SQL_SOURCE rpl_gtid.cc rpl_parallel.cc semisync.cc semisync_master.cc semisync_slave.cc semisync_master_ack_receiver.cc + sql_schema.cc sql_type.cc sql_mode.cc sql_type_json.cc sql_type_string.cc sql_type_geom.cc diff --git a/sql/compat56.cc b/sql/compat56.cc index a500fcc46e1..3d8574419d3 100644 --- a/sql/compat56.cc +++ b/sql/compat56.cc @@ -305,7 +305,7 @@ uint my_datetime_binary_length(uint dec) /* On disk we store as unsigned number with DATETIMEF_INT_OFS offset, - for HA_KETYPE_BINARY compatibilty purposes. + for HA_KETYPE_BINARY compatibility purposes. */ #define DATETIMEF_INT_OFS 0x8000000000LL diff --git a/sql/debug_sync.cc b/sql/debug_sync.cc index 2fc2e00d043..d2656f36967 100644 --- a/sql/debug_sync.cc +++ b/sql/debug_sync.cc @@ -34,7 +34,7 @@ /* Action to perform at a synchronization point. NOTE: This structure is moved around in memory by realloc(), qsort(), - and memmove(). Do not add objects with non-trivial constuctors + and memmove(). Do not add objects with non-trivial constructors or destructors, which might prevent moving of this structure with these functions. */ @@ -571,7 +571,7 @@ static void debug_sync_reset(THD *thd) @description Removing an action mainly means to decrement the ds_active counter. But if the action is between other active action in the array, then - the array needs to be shrinked. The active actions above the one to + the array needs to be shrunk. The active actions above the one to be removed have to be moved down by one slot. */ diff --git a/sql/derror.cc b/sql/derror.cc index 1c10bdfdd92..187d5bc20d2 100644 --- a/sql/derror.cc +++ b/sql/derror.cc @@ -237,7 +237,7 @@ static File open_error_msg_file(const char *file_name, const char *language, MYF(0))) < 0) { /* - Trying pre-5.4 sematics of the --language parameter. + Trying pre-5.4 semantics of the --language parameter. It included the language-specific part, e.g.: --language=/path/to/english/ */ diff --git a/sql/encryption.cc b/sql/encryption.cc index 9c38713fdfa..13239b91910 100644 --- a/sql/encryption.cc +++ b/sql/encryption.cc @@ -78,8 +78,8 @@ int initialize_encryption_plugin(st_plugin_int *plugin) (struct st_mariadb_encryption*) plugin->plugin->info; /* - Copmiler on Spark doesn't like the '?' operator here as it - belives the (uint (*)...) implies the C++ call model. + Compiler on Spark doesn't like the '?' operator here as it + believes the (uint (*)...) implies the C++ call model. */ if (handle->crypt_ctx_size) encryption_handler.encryption_ctx_size_func= handle->crypt_ctx_size; diff --git a/sql/event_data_objects.cc b/sql/event_data_objects.cc index bd457fba4fa..91d1d871307 100644 --- a/sql/event_data_objects.cc +++ b/sql/event_data_objects.cc @@ -173,7 +173,7 @@ Event_creation_ctx::load_from_db(THD *thd, /*************************************************************************/ /* - Initiliazes dbname and name of an Event_queue_element_for_exec + Initializes dbname and name of an Event_queue_element_for_exec object SYNOPSIS diff --git a/sql/event_db_repository.cc b/sql/event_db_repository.cc index 9e8e5f06043..9d0764cab14 100644 --- a/sql/event_db_repository.cc +++ b/sql/event_db_repository.cc @@ -678,7 +678,7 @@ Event_db_repository::create_event(THD *thd, Event_parse_data *parse_data, DBUG_PRINT("info", ("name: %.*s", (int) parse_data->name.length, parse_data->name.str)); - DBUG_PRINT("info", ("check existance of an event with the same name")); + DBUG_PRINT("info", ("check existence of an event with the same name")); if (!find_named_event(&parse_data->dbname, &parse_data->name, table)) { if (thd->lex->create_info.or_replace()) diff --git a/sql/event_parse_data.cc b/sql/event_parse_data.cc index e2f73cd2bb4..d2a168e538e 100644 --- a/sql/event_parse_data.cc +++ b/sql/event_parse_data.cc @@ -97,7 +97,7 @@ Event_parse_data::init_name(THD *thd, sp_name *spn) ENDS or AT is in the past, we are trying to create an event that will never be executed. If it has ON COMPLETION NOT PRESERVE (default), then it would normally be dropped already, so on CREATE - EVENT we give a warning, and do not create anyting. On ALTER EVENT + EVENT we give a warning, and do not create anything. On ALTER EVENT we give a error, and do not change the event. If the event has ON COMPLETION PRESERVE, then we see if the event is @@ -362,7 +362,7 @@ wrong_value: EVERY 5 MINUTE STARTS "2004-12-12 10:00:00" means that the event will be executed every 5 minutes but this will start at the date shown above. Expressions are possible : - DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tommorow at + DATE_ADD(NOW(), INTERVAL 1 DAY) -- start tomorrow at same time. RETURN VALUE @@ -417,7 +417,7 @@ wrong_value: EVERY 5 MINUTE ENDS "2004-12-12 10:00:00" means that the event will be executed every 5 minutes but this will end at the date shown above. Expressions are possible : - DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tommorow at + DATE_ADD(NOW(), INTERVAL 1 DAY) -- end tomorrow at same time. RETURN VALUE diff --git a/sql/event_queue.cc b/sql/event_queue.cc index 71d1d2c68ee..86356e4325d 100644 --- a/sql/event_queue.cc +++ b/sql/event_queue.cc @@ -364,7 +364,7 @@ Event_queue::drop_matching_events(THD *thd, const LEX_CSTRING *pattern, We don't call mysql_cond_broadcast(&COND_queue_state); If we remove the top event: 1. The queue is empty. The scheduler will wake up at some time and - realize that the queue is empty. If create_event() comes inbetween + realize that the queue is empty. If create_event() comes in between it will signal the scheduler 2. The queue is not empty, but the next event after the previous top, won't be executed any time sooner than the element we removed. Hence, diff --git a/sql/events.cc b/sql/events.cc index acf472736e8..33ddcdac3cb 100644 --- a/sql/events.cc +++ b/sql/events.cc @@ -130,7 +130,7 @@ bool Events::check_if_system_tables_error() /** Reconstructs interval expression from interval type and expression - value that is in form of a value of the smalles entity: + value that is in form of a value of the smallest entity: For YEAR_MONTH - expression is in months DAY_MINUTE - expression is in minutes diff --git a/sql/field.cc b/sql/field.cc index 8cd619571c4..f50ddec1c80 100644 --- a/sql/field.cc +++ b/sql/field.cc @@ -42,7 +42,7 @@ #define MAX_EXPONENT 1024 /***************************************************************************** - Instansiate templates and static variables + Instantiate templates and static variables *****************************************************************************/ static const char *zero_timestamp="0000-00-00 00:00:00.000000"; @@ -88,7 +88,7 @@ bool Field::marked_for_write_or_computed() const /* Rules for merging different types of fields in UNION - NOTE: to avoid 256*256 table, gap in table types numeration is skiped + NOTE: to avoid 256*256 table, gap in table types numeration is skipped following #defines describe that gap and how to canculate number of fields and index of field in this array. */ @@ -1087,7 +1087,7 @@ Field_longstr::pack_sort_string(uchar *to, const SORT_FIELD_ATTR *sort_field) { StringBuffer buf; val_str(&buf, &buf); - return to + sort_field->pack_sort_string(to, &buf); + return to + sort_field->pack_sort_string(to, &buf, field_charset()); } @@ -1552,7 +1552,7 @@ Item *Field_num::get_equal_zerofill_const_item(THD *thd, const Context &ctx, /** - Contruct warning parameters using thd->no_errors +Construct warning parameters using thd->no_errors to determine whether to generate or suppress warnings. We can get here in a query like this: SELECT COUNT(@@basedir); @@ -1600,7 +1600,7 @@ Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd, if (filter.want_warning_edom()) { /* - We can use err.ptr() here as ErrConvString is guranteed to put an + We can use err.ptr() here as ErrConvString is guaranteed to put an end \0 here. */ THD *wthd= thd ? thd : current_thd; @@ -1632,7 +1632,7 @@ Value_source::Converter_string_to_number::check_edom_and_truncation(THD *thd, - found garbage at the end of the string. @param type Data type name (e.g. "decimal", "integer", "double") - @param edom Indicates that the string-to-number routine retuned + @param edom Indicates that the string-to-number routine returned an error code equivalent to EDOM (value out of domain), i.e. the string fully consisted of garbage and the conversion routine could not get any digits from it. @@ -1695,7 +1695,7 @@ int Field_num::check_edom_and_truncation(const char *type, bool edom, /* - Conver a string to an integer then check bounds. + Convert a string to an integer then check bounds. SYNOPSIS Field_num::get_int @@ -2809,7 +2809,7 @@ int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs) We only have to generate warnings if count_cuted_fields is set. This is to avoid extra checks of the number when they are not needed. Even if this flag is not set, it's OK to increment warnings, if - it makes the code easer to read. + it makes the code easier to read. */ if (get_thd()->count_cuted_fields > CHECK_FIELD_EXPRESSION) @@ -2892,7 +2892,7 @@ int Field_decimal::store(const char *from_arg, size_t len, CHARSET_INFO *cs) } /* - Now write the formated number + Now write the formatted number First the digits of the int_% parts. Do we have enough room to write these digits ? @@ -3409,7 +3409,7 @@ int Field_new_decimal::store(const char *from, size_t length, If check_decimal() failed because of EDOM-alike error, (e.g. E_DEC_BAD_NUM), we have to initialize decimal_value to zero. Note: if check_decimal() failed because of truncation, - decimal_value is alreay properly initialized. + decimal_value is already properly initialized. */ my_decimal_set_zero(&decimal_value); /* @@ -4781,11 +4781,12 @@ int truncate_double(double *nr, uint field_length, uint dec, { uint order= field_length - dec; uint step= array_elements(log_10) - 1; - max_value= 1.0; + double max_value_by_dec= 1.0; for (; order > step; order-= step) - max_value*= log_10[step]; - max_value*= log_10[order]; - max_value-= 1.0 / log_10[dec]; + max_value_by_dec*= log_10[step]; + max_value_by_dec*= log_10[order]; + max_value_by_dec-= 1.0 / log_10[dec]; + set_if_smaller(max_value, max_value_by_dec); /* Check for infinity so we don't get NaN in calculations */ if (!std::isinf(res)) @@ -5076,7 +5077,7 @@ Field_timestamp::Field_timestamp(uchar *ptr_arg, uint32 len_arg, { /* We mark the flag with TIMESTAMP_FLAG to indicate to the client that - this field will be automaticly updated on insert. + this field will be automatically updated on insert. */ flags|= TIMESTAMP_FLAG; if (unireg_check != TIMESTAMP_DN_FIELD) @@ -7505,7 +7506,7 @@ Field_string::unpack(uchar *to, const uchar *from, const uchar *from_end, with the real type. Since all allowable types have 0xF as most significant bits of the metadata word, lengths <256 will not affect the real type at all, while all other values will result in a - non-existant type in the range 17-244. + non-existent type in the range 17-244. @see Field_string::unpack @@ -7706,8 +7707,7 @@ void Field_varstring::mark_unused_memory_as_defined() #endif -int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr, - uint max_len) const +int Field_varstring::cmp(const uchar *a_ptr, const uchar *b_ptr) const { uint a_length, b_length; int diff; @@ -7722,14 +7722,51 @@ int Field_varstring::cmp_max(const uchar *a_ptr, const uchar *b_ptr, a_length= uint2korr(a_ptr); b_length= uint2korr(b_ptr); } - set_if_smaller(a_length, max_len); - set_if_smaller(b_length, max_len); + set_if_smaller(a_length, field_length); + set_if_smaller(b_length, field_length); diff= field_charset()->strnncollsp(a_ptr + length_bytes, a_length, b_ptr + length_bytes, b_length); return diff; } +static int cmp_str_prefix(const uchar *ua, size_t alen, const uchar *ub, + size_t blen, size_t prefix, CHARSET_INFO *cs) +{ + const char *a= (char*)ua, *b= (char*)ub; + MY_STRCOPY_STATUS status; + prefix/= cs->mbmaxlen; + alen= cs->cset->well_formed_char_length(cs, a, a + alen, prefix, &status); + blen= cs->cset->well_formed_char_length(cs, b, b + blen, prefix, &status); + return cs->coll->strnncollsp(cs, ua, alen, ub, blen); +} + + + +int Field_varstring::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr, + size_t prefix_len) const +{ + /* avoid expensive well_formed_char_length if possible */ + if (prefix_len == table->field[field_index]->field_length) + return Field_varstring::cmp(a_ptr, b_ptr); + + size_t a_length, b_length; + + if (length_bytes == 1) + { + a_length= *a_ptr; + b_length= *b_ptr; + } + else + { + a_length= uint2korr(a_ptr); + b_length= uint2korr(b_ptr); + } + return cmp_str_prefix(a_ptr+length_bytes, a_length, b_ptr+length_bytes, + b_length, prefix_len, field_charset()); +} + + /** @note varstring and blob keys are ALWAYS stored with a 2 byte length prefix @@ -8235,8 +8272,8 @@ longlong Field_varstring_compressed::val_int(void) } -int Field_varstring_compressed::cmp_max(const uchar *a_ptr, const uchar *b_ptr, - uint max_len) const +int Field_varstring_compressed::cmp(const uchar *a_ptr, + const uchar *b_ptr) const { String a, b; uint a_length, b_length; @@ -8255,13 +8292,10 @@ int Field_varstring_compressed::cmp_max(const uchar *a_ptr, const uchar *b_ptr, uncompress(&a, &a, a_ptr + length_bytes, a_length); uncompress(&b, &b, b_ptr + length_bytes, b_length); - if (a.length() > max_len) - a.length(max_len); - if (b.length() > max_len) - b.length(max_len); - return sortcmp(&a, &b, field_charset()); } + + Binlog_type_info Field_varstring_compressed::binlog_type_info() const { return Binlog_type_info(Field_varstring_compressed::binlog_type(), @@ -8498,16 +8532,25 @@ int Field_blob::cmp(const uchar *a,uint32 a_length, const uchar *b, } -int Field_blob::cmp_max(const uchar *a_ptr, const uchar *b_ptr, - uint max_length) const +int Field_blob::cmp(const uchar *a_ptr, const uchar *b_ptr) const { uchar *blob1,*blob2; memcpy(&blob1, a_ptr+packlength, sizeof(char*)); memcpy(&blob2, b_ptr+packlength, sizeof(char*)); - uint a_len= get_length(a_ptr), b_len= get_length(b_ptr); - set_if_smaller(a_len, max_length); - set_if_smaller(b_len, max_length); - return Field_blob::cmp(blob1,a_len,blob2,b_len); + size_t a_len= get_length(a_ptr), b_len= get_length(b_ptr); + return cmp(blob1, (uint32)a_len, blob2, (uint32)b_len); +} + + +int Field_blob::cmp_prefix(const uchar *a_ptr, const uchar *b_ptr, + size_t prefix_len) const +{ + uchar *blob1,*blob2; + memcpy(&blob1, a_ptr+packlength, sizeof(char*)); + memcpy(&blob2, b_ptr+packlength, sizeof(char*)); + size_t a_len= get_length(a_ptr), b_len= get_length(b_ptr); + return cmp_str_prefix(blob1, a_len, blob2, b_len, prefix_len, + field_charset()); } @@ -9690,7 +9733,8 @@ my_decimal *Field_bit::val_decimal(my_decimal *deciaml_value) The a and b pointer must be pointers to the field in a record (not the table->record[0] necessarily) */ -int Field_bit::cmp_max(const uchar *a, const uchar *b, uint max_len) const +int Field_bit::cmp_prefix(const uchar *a, const uchar *b, + size_t prefix_len) const { my_ptrdiff_t a_diff= a - ptr; my_ptrdiff_t b_diff= b - ptr; diff --git a/sql/field.h b/sql/field.h index 72c99c37fb7..0f531564116 100644 --- a/sql/field.h +++ b/sql/field.h @@ -321,7 +321,7 @@ protected: }; - // String-to-number convertion methods for the old code compatibility + // String-to-number conversion methods for the old code compatibility longlong longlong_from_string_with_check(CHARSET_INFO *cs, const char *cptr, const char *end) const { @@ -402,7 +402,7 @@ public: /* Item context attributes. Comparison functions pass their attributes to propagate_equal_fields(). - For exmple, for string comparison, the collation of the comparison + For example, for string comparison, the collation of the comparison operation is important inside propagate_equal_fields(). */ class Context @@ -1273,8 +1273,13 @@ public: const Conv_param ¶m) const; inline int cmp(const uchar *str) const { return cmp(ptr,str); } - virtual int cmp_max(const uchar *a, const uchar *b, uint max_len) const - { return cmp(a, b); } + /* + The following method is used for comparing prefix keys. + Currently it's only used in partitioning. + */ + virtual int cmp_prefix(const uchar *a, const uchar *b, + size_t prefix_len) const + { return cmp(a, b); } virtual int cmp(const uchar *,const uchar *) const=0; virtual int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const { return memcmp(a,b,pack_length()); } @@ -2269,7 +2274,7 @@ public: }; -class Field_decimal :public Field_real { +class Field_decimal final :public Field_real { public: Field_decimal(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, @@ -2315,7 +2320,7 @@ public: /* New decimal/numeric field which use fixed point arithmetic */ -class Field_new_decimal :public Field_num { +class Field_new_decimal final :public Field_num { public: /* The maximum number of decimal digits can be stored */ uint precision; @@ -2545,7 +2550,7 @@ public: }; -class Field_short :public Field_int +class Field_short final :public Field_int { const Type_handler_general_purpose_int *type_handler_priv() const { @@ -2598,7 +2603,7 @@ public: } }; -class Field_medium :public Field_int +class Field_medium final :public Field_int { const Type_handler_general_purpose_int *type_handler_priv() const { @@ -2644,7 +2649,7 @@ public: }; -class Field_long :public Field_int +class Field_long final :public Field_int { const Type_handler_general_purpose_int *type_handler_priv() const { @@ -2807,7 +2812,7 @@ public: }; -class Field_float :public Field_real { +class Field_float final :public Field_real { public: Field_float(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, @@ -2893,28 +2898,28 @@ public: } const Type_handler *type_handler() const override { return &type_handler_double; } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_DOUBLE; } - int store(const char *to,size_t length,CHARSET_INFO *charset) override; - int store(double nr) override; - int store(longlong nr, bool unsigned_val) override; - int reset() override { bzero(ptr,sizeof(double)); return 0; } - double val_real() override; - longlong val_int() override { return val_int_from_real(false); } - ulonglong val_uint() override { return (ulonglong) val_int_from_real(true); } - String *val_str(String *, String *) override; - bool send_binary(Protocol *protocol) override; - int cmp(const uchar *,const uchar *) const override; - void sort_string(uchar *buff, uint length) override; - uint32 pack_length() const override { return sizeof(double); } - uint row_pack_length() const override { return pack_length(); } - ulonglong get_max_int_value() const override + enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_DOUBLE; } + int store(const char *to,size_t length,CHARSET_INFO *charset) override final; + int store(double nr) override final; + int store(longlong nr, bool unsigned_val) override final; + int reset() override final { bzero(ptr,sizeof(double)); return 0; } + double val_real() override final; + longlong val_int() override final { return val_int_from_real(false); } + ulonglong val_uint() override final { return (ulonglong) val_int_from_real(true); } + String *val_str(String *, String *) override final; + bool send_binary(Protocol *protocol) override final; + int cmp(const uchar *,const uchar *) const override final; + void sort_string(uchar *buff, uint length) override final; + uint32 pack_length() const override final { return sizeof(double); } + uint row_pack_length() const override final { return pack_length(); } + ulonglong get_max_int_value() const override final { /* We use the maximum as per IEEE754-2008 standard, 2^53 */ return 0x20000000000000ULL; } - Binlog_type_info binlog_type_info() const override; + Binlog_type_info binlog_type_info() const override final; }; @@ -2943,40 +2948,40 @@ public: { return do_field_string; } - int store(const char *to, size_t length, CHARSET_INFO *cs) override + int store(const char *to, size_t length, CHARSET_INFO *cs) override final { null[0]=1; return 0; } - int store(double nr) override { null[0]=1; return 0; } - int store(longlong nr, bool unsigned_val) override { null[0]=1; return 0; } - int store_decimal(const my_decimal *d) override { null[0]=1; return 0; } - int reset() override { return 0; } - double val_real() override { return 0.0;} - longlong val_int() override { return 0;} - bool val_bool() override { return false; } - my_decimal *val_decimal(my_decimal *) override { return 0; } - String *val_str(String *value,String *value2) override + int store(double nr) override final { null[0]=1; return 0; } + int store(longlong nr, bool unsigned_val) override final { null[0]=1; return 0; } + int store_decimal(const my_decimal *d) override final { null[0]=1; return 0; } + int reset() override final { return 0; } + double val_real() override final { return 0.0;} + longlong val_int() override final { return 0;} + bool val_bool() override final { return false; } + my_decimal *val_decimal(my_decimal *) override final { return 0; } + String *val_str(String *value,String *value2) override final { value2->length(0); return value2;} - bool is_equal(const Column_definition &new_field) const override; - int cmp(const uchar *a, const uchar *b) const override { return 0;} - void sort_string(uchar *buff, uint length) override {} - uint32 pack_length() const override { return 0; } - void sql_type(String &str) const override; - uint size_of() const override { return sizeof *this; } - uint32 max_display_length() const override { return 4; } - void move_field_offset(my_ptrdiff_t ptr_diff) override {} + bool is_equal(const Column_definition &new_field) const override final; + int cmp(const uchar *a, const uchar *b) const override final { return 0;} + void sort_string(uchar *buff, uint length) override final {} + uint32 pack_length() const override final { return 0; } + void sql_type(String &str) const override final; + uint size_of() const override final { return sizeof *this; } + uint32 max_display_length() const override final { return 4; } + void move_field_offset(my_ptrdiff_t ptr_diff) override final {} bool can_optimize_keypart_ref(const Item_bool_func *cond, - const Item *item) const override + const Item *item) const override final { return false; } bool can_optimize_group_min_max(const Item_bool_func *cond, - const Item *const_item) const override + const Item *const_item) const override final { return false; } }; -class Field_temporal: public Field { +class Field_temporal :public Field { protected: Item *get_equal_const_item_datetime(THD *thd, const Context &ctx, Item *const_item); @@ -3093,7 +3098,7 @@ public: - DATETIME(1..6) - DATETIME(0..6) - MySQL56 version */ -class Field_temporal_with_date: public Field_temporal { +class Field_temporal_with_date :public Field_temporal { protected: virtual void store_TIME(const MYSQL_TIME *ltime) = 0; void store_datetime(const Datetime &dt) @@ -3300,7 +3305,7 @@ public: /** TIMESTAMP(0..6) - MySQL56 version */ -class Field_timestampf :public Field_timestamp_with_dec { +class Field_timestampf final :public Field_timestamp_with_dec { void store_TIMEVAL(const timeval &tv) override; public: Field_timestampf(uchar *ptr_arg, @@ -3348,7 +3353,7 @@ public: }; -class Field_year :public Field_tiny { +class Field_year final :public Field_tiny { public: Field_year(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, @@ -3409,7 +3414,7 @@ public: }; -class Field_date_common: public Field_temporal_with_date +class Field_date_common :public Field_temporal_with_date { protected: int store_TIME_with_warning(const Datetime *ltime, const ErrConv *str, @@ -3434,7 +3439,7 @@ public: }; -class Field_date :public Field_date_common +class Field_date final :public Field_date_common { void store_TIME(const MYSQL_TIME *ltime) override; bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) @@ -3475,7 +3480,7 @@ public: }; -class Field_newdate :public Field_date_common +class Field_newdate final :public Field_date_common { void store_TIME(const MYSQL_TIME *ltime) override; bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) @@ -3566,7 +3571,7 @@ public: }; -class Field_time0: public Field_time +class Field_time0 final :public Field_time { protected: void store_TIME(const MYSQL_TIME *ltime) override; @@ -3623,7 +3628,7 @@ public: /** TIME(1..6) */ -class Field_time_hires :public Field_time_with_dec { +class Field_time_hires final :public Field_time_with_dec { longlong zero_point; void store_TIME(const MYSQL_TIME *) override; public: @@ -3656,7 +3661,7 @@ public: /** TIME(0..6) - MySQL56 version */ -class Field_timef :public Field_time_with_dec { +class Field_timef final :public Field_time_with_dec { void store_TIME(const MYSQL_TIME *ltime) override; public: Field_timef(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, @@ -3741,7 +3746,11 @@ public: }; -class Field_datetime0 :public Field_datetime +/* + Stored as a 8 byte unsigned int. Should sometimes be change to a 6 byte +*/ + +class Field_datetime0 final :public Field_datetime { void store_TIME(const MYSQL_TIME *ltime) override; bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) @@ -3803,30 +3812,30 @@ public: { DBUG_ASSERT(dec <= TIME_SECOND_PART_DIGITS); } - uint decimals() const override { return dec; } - enum ha_base_keytype key_type() const override { return HA_KEYTYPE_BINARY; } - void make_send_field(Send_field *field) override; - bool send_binary(Protocol *protocol) override; - uchar *pack(uchar *to, const uchar *from, uint max_length) override + uint decimals() const override final { return dec; } + enum ha_base_keytype key_type() const override final { return HA_KEYTYPE_BINARY; } + void make_send_field(Send_field *field) override final; + bool send_binary(Protocol *protocol) override final; + uchar *pack(uchar *to, const uchar *from, uint max_length) override final { return Field::pack(to, from, max_length); } const uchar *unpack(uchar* to, const uchar *from, const uchar *from_end, - uint param_data) override + uint param_data) override final { return Field::unpack(to, from, from_end, param_data); } - void sort_string(uchar *to, uint length) override + void sort_string(uchar *to, uint length) override final { DBUG_ASSERT(length == pack_length()); memcpy(to, ptr, length); } - double val_real() override; - longlong val_int() override; - String *val_str(String *, String *) override; + double val_real() override final; + longlong val_int() override final; + String *val_str(String *, String *) override final; }; /** DATETIME(1..6) */ -class Field_datetime_hires :public Field_datetime_with_dec { +class Field_datetime_hires final :public Field_datetime_with_dec { void store_TIME(const MYSQL_TIME *ltime) override; bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) const override; @@ -3856,7 +3865,8 @@ public: /** DATETIME(0..6) - MySQL56 version */ -class Field_datetimef :public Field_datetime_with_dec { + +class Field_datetimef final :public Field_datetime_with_dec { void store_TIME(const MYSQL_TIME *ltime) override; bool get_TIME(MYSQL_TIME *ltime, const uchar *pos, date_mode_t fuzzydate) const override; @@ -3950,7 +3960,7 @@ new_Field_datetime(MEM_ROOT *root, uchar *ptr, uchar *null_ptr, uchar null_bit, unireg_check, field_name, dec); } -class Field_string :public Field_longstr { +class Field_string final :public Field_longstr { class Warn_filter_string: public Warn_filter { public: @@ -4143,11 +4153,9 @@ public: longlong val_int() override; String *val_str(String *, String *) override; my_decimal *val_decimal(my_decimal *) override; - int cmp_max(const uchar *, const uchar *, uint max_length) const override; - int cmp(const uchar *a,const uchar *b) const override - { - return cmp_max(a, b, ~0U); - } + int cmp(const uchar *a,const uchar *b) const override; + int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) const + override; void sort_string(uchar *buff,uint length) override; uint get_key_image(uchar *buff, uint length, const uchar *ptr_arg, imagetype type) const override; @@ -4185,7 +4193,7 @@ public: }; -class Field_varstring_compressed: public Field_varstring { +class Field_varstring_compressed final :public Field_varstring { public: Field_varstring_compressed(uchar *ptr_arg, uint32 len_arg, uint length_bytes_arg, @@ -4222,8 +4230,7 @@ private: { return (field_length - 1) / mbmaxlen(); } - int cmp_max(const uchar *a_ptr, const uchar *b_ptr, uint max_len) const - override; + int cmp(const uchar *a_ptr, const uchar *b_ptr) const override; /* Compressed fields can't have keys as two rows may have different @@ -4434,9 +4441,9 @@ public: longlong val_int() override; String *val_str(String *, String *) override; my_decimal *val_decimal(my_decimal *) override; - int cmp_max(const uchar *, const uchar *, uint max_length) const override; - int cmp(const uchar *a,const uchar *b) const override - { return cmp_max(a, b, ~0U); } + int cmp(const uchar *a, const uchar *b) const override; + int cmp_prefix(const uchar *a, const uchar *b, size_t prefix_len) const + override; int cmp(const uchar *a, uint32 a_length, const uchar *b, uint32 b_length) const; int cmp_binary(const uchar *a,const uchar *b, uint32 max_length=~0U) const @@ -4588,7 +4595,7 @@ public: }; -class Field_blob_compressed: public Field_blob { +class Field_blob_compressed final :public Field_blob { public: Field_blob_compressed(uchar *ptr_arg, uchar *null_ptr_arg, uchar null_bit_arg, enum utype unireg_check_arg, @@ -4754,7 +4761,7 @@ private: }; -class Field_set :public Field_enum { +class Field_set final :public Field_enum { public: Field_set(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, @@ -4802,7 +4809,7 @@ private: This is the reason: - Field_bit::cmp_binary() is only implemented in the base class (Field::cmp_binary()). - - Field::cmp_binary() currenly use pack_length() to calculate how + - Field::cmp_binary() currently uses pack_length() to calculate how long the data is. - pack_length() includes size of the bits stored in the NULL bytes of the record. @@ -4874,7 +4881,8 @@ public: } int cmp_binary_offset(uint row_offset) override { return cmp_offset(row_offset); } - int cmp_max(const uchar *a, const uchar *b, uint max_length) const override; + int cmp_prefix(const uchar *a, const uchar *b, + size_t max_length) const override; int key_cmp(const uchar *a, const uchar *b) const override { return cmp_binary((uchar *) a, (uchar *) b); } int key_cmp(const uchar *str, uint length) const override; @@ -5002,7 +5010,7 @@ private: an extended version of Field_bit_as_char and not the other way around. Hence, we should refactor it to fix the hierarchy order. */ -class Field_bit_as_char: public Field_bit { +class Field_bit_as_char final :public Field_bit { public: Field_bit_as_char(uchar *ptr_arg, uint32 len_arg, uchar *null_ptr_arg, uchar null_bit_arg, @@ -5017,7 +5025,7 @@ public: }; -class Field_row: public Field_null +class Field_row final :public Field_null { class Virtual_tmp_table *m_table; public: diff --git a/sql/filesort.cc b/sql/filesort.cc index 1e811473a32..8469e7b0fa8 100644 --- a/sql/filesort.cc +++ b/sql/filesort.cc @@ -984,12 +984,12 @@ static ha_rows find_all_keys(THD *thd, Sort_param *param, SQL_SELECT *select, } if (!quick_select) { - (void) file->extra(HA_EXTRA_NO_CACHE); /* End cacheing of records */ + (void) file->extra(HA_EXTRA_NO_CACHE); /* End caching of records */ if (!next_pos) file->ha_rnd_end(); } - /* Signal we should use orignal column read and write maps */ + /* Signal we should use original column read and write maps */ sort_form->column_bitmaps_set(save_read_set, save_write_set); if (unlikely(thd->is_error())) @@ -2553,12 +2553,13 @@ Type_handler_string_result::make_packed_sort_key_part(uchar *to, Item *item, const SORT_FIELD_ATTR *sort_field, Sort_param *param) const { + CHARSET_INFO *cs= item->collation.collation; bool maybe_null= item->maybe_null; if (maybe_null) *to++= 1; - String *res= item->str_result(¶m->tmp_buffer); + Binary_string *res= item->str_result(¶m->tmp_buffer); if (!res) { if (maybe_null) @@ -2582,7 +2583,7 @@ Type_handler_string_result::make_packed_sort_key_part(uchar *to, Item *item, return sort_field->original_length; } } - return sort_field->pack_sort_string(to, res); + return sort_field->pack_sort_string(to, res, cs); } @@ -2946,7 +2947,8 @@ int compare_packed_sort_keys(void *sort_param, */ uint -SORT_FIELD_ATTR::pack_sort_string(uchar *to, String *str) const +SORT_FIELD_ATTR::pack_sort_string(uchar *to, const Binary_string *str, + CHARSET_INFO *cs) const { uchar *orig_to= to; uint32 length, data_length; @@ -2965,7 +2967,7 @@ SORT_FIELD_ATTR::pack_sort_string(uchar *to, String *str) const memcpy(to, (uchar*)str->ptr(), data_length); to+= data_length; - if (str->charset() == &my_charset_bin && suffix_length) + if (cs == &my_charset_bin && suffix_length) { // suffix length stored in bigendian form store_bigendian(length, to, suffix_length); diff --git a/sql/gcalc_slicescan.cc b/sql/gcalc_slicescan.cc index 6d7ab7e29c3..93561f5fe97 100644 --- a/sql/gcalc_slicescan.cc +++ b/sql/gcalc_slicescan.cc @@ -1877,7 +1877,7 @@ int Gcalc_scan_iterator::add_eq_node(Gcalc_heap::Info *node, point *sp) if (!en) GCALC_DBUG_RETURN(1); - /* eq_node iserted after teh equal point. */ + /* eq_node inserted after the equal point. */ en->next= node->get_next(); node->next= en; diff --git a/sql/gcalc_slicescan.h b/sql/gcalc_slicescan.h index 54b12962d2a..b5188f29dfd 100644 --- a/sql/gcalc_slicescan.h +++ b/sql/gcalc_slicescan.h @@ -362,9 +362,9 @@ enum Gcalc_scan_events /* - Gcalc_scan_iterator incapsulates the slisescan algorithm. - It takes filled Gcalc_heap as an datasource. Then can be - iterated trought the vertexes and intersection points with + Gcalc_scan_iterator incapsulates the slicescan algorithm. + It takes filled Gcalc_heap as a datasource. Then can be + iterated through the vertexes and intersection points with the step() method. After the 'step()' one usually observes the current 'slice' to do the necessary calculations, like looking for intersections, calculating the area, whatever. diff --git a/sql/gcalc_tools.cc b/sql/gcalc_tools.cc index 14a7c6331f3..307f063fb43 100644 --- a/sql/gcalc_tools.cc +++ b/sql/gcalc_tools.cc @@ -1184,14 +1184,14 @@ int Gcalc_operation_reducer::connect_threads( { rp0->outer_poly= prev_range->thread_start; tb->thread_start= prev_range->thread_start; - /* Chack if needed */ + /* Check if needed */ ta->thread_start= prev_range->thread_start; } else { rp0->outer_poly= 0; ta->thread_start= rp0; - /* Chack if needed */ + /* Check if needed */ tb->thread_start= rp0; } GCALC_DBUG_RETURN(0); diff --git a/sql/ha_partition.cc b/sql/ha_partition.cc index 307f7ff24af..0a378bde0bd 100644 --- a/sql/ha_partition.cc +++ b/sql/ha_partition.cc @@ -1522,7 +1522,7 @@ int ha_partition::handle_opt_partitions(THD *thd, HA_CHECK_OPT *check_opt, /** - @brief Check and repair the table if neccesary + @brief Check and repair the table if necessary @param thd Thread object @@ -3049,7 +3049,7 @@ error: /** Read the .par file to get the partitions engines and names - @param name Name of table file (without extention) + @param name Name of table file (without extension) @return Operation status @retval true Failure @@ -3279,7 +3279,7 @@ static uchar *get_part_name(PART_NAME_DEF *part, size_t *length, @return Operation status @retval true Failure - @retval false Sucess + @retval false Success */ bool ha_partition::insert_partition_name_in_hash(const char *name, uint part_id, @@ -3405,7 +3405,7 @@ err: @return Operation status @retval true Failure - @retval false Sucess + @retval false Success */ bool ha_partition::set_ha_share_ref(Handler_share **ha_share_arg) @@ -4396,7 +4396,7 @@ int ha_partition::write_row(const uchar * buf) /* If we have failed to set the auto-increment value for this row, it is highly likely that we will not be able to insert it into - the correct partition. We must check and fail if neccessary. + the correct partition. We must check and fail if necessary. */ if (unlikely(error)) goto exit; @@ -4465,7 +4465,7 @@ exit: have the previous row record in it, while new_data will have the newest data in it. Keep in mind that the server can do updates based on ordering if an - ORDER BY clause was used. Consecutive ordering is not guarenteed. + ORDER BY clause was used. Consecutive ordering is not guaranteed. Called from sql_select.cc, sql_acl.cc, sql_update.cc, and sql_insert.cc. new_data is always record[0] @@ -4593,7 +4593,7 @@ exit: (from either a previous rnd_xxx() or index_xxx() call). If you keep a pointer to the last row or can access a primary key it will make doing the deletion quite a bit easier. - Keep in mind that the server does no guarentee consecutive deletions. + Keep in mind that the server does no guarantee consecutive deletions. ORDER BY clauses can be used. Called in sql_acl.cc and sql_udf.cc to manage internal table information. @@ -5011,7 +5011,7 @@ int ha_partition::end_bulk_insert() When scan is used we will scan one handler partition at a time. When preparing for rnd_pos we will init all handler partitions. - No extra cache handling is needed when scannning is not performed. + No extra cache handling is needed when scanning is not performed. Before initialising we will call rnd_end to ensure that we clean up from any previous incarnation of a table scan. @@ -8714,7 +8714,7 @@ static int end_keyread_cb(handler* h, void *unused) function after completing a query. 3) It is called when deleting the QUICK_RANGE_SELECT object if the QUICK_RANGE_SELECT object had its own handler object. It is called - immediatley before close of this local handler object. + immediately before close of this local handler object. HA_EXTRA_KEYREAD: HA_EXTRA_NO_KEYREAD: These parameters are used to provide an optimisation hint to the handler. @@ -8751,7 +8751,7 @@ static int end_keyread_cb(handler* h, void *unused) HA_EXTRA_IGNORE_DUP_KEY: HA_EXTRA_NO_IGNORE_DUP_KEY: Informs the handler to we will not stop the transaction if we get an - duplicate key errors during insert/upate. + duplicate key errors during insert/update. Always called in pair, triggered by INSERT IGNORE and other similar SQL constructs. Not used by MyISAM. @@ -10251,7 +10251,7 @@ bool ha_partition::prepare_inplace_alter_table(TABLE *altered_table, /* Changing to similar partitioning, only update metadata. - Non allowed changes would be catched in prep_alter_part_table(). + Non allowed changes would be caought in prep_alter_part_table(). */ if (ha_alter_info->alter_info->partition_flags == ALTER_PARTITION_INFO) { @@ -10287,7 +10287,7 @@ bool ha_partition::inplace_alter_table(TABLE *altered_table, /* Changing to similar partitioning, only update metadata. - Non allowed changes would be catched in prep_alter_part_table(). + Non allowed changes would be caught in prep_alter_part_table(). */ if (ha_alter_info->alter_info->partition_flags == ALTER_PARTITION_INFO) { @@ -10335,7 +10335,7 @@ bool ha_partition::commit_inplace_alter_table(TABLE *altered_table, /* Changing to similar partitioning, only update metadata. - Non allowed changes would be catched in prep_alter_part_table(). + Non allowed changes would be caught in prep_alter_part_table(). */ if (ha_alter_info->alter_info->partition_flags == ALTER_PARTITION_INFO) { diff --git a/sql/ha_partition.h b/sql/ha_partition.h index 120d5cb2b30..4556c5f482e 100644 --- a/sql/ha_partition.h +++ b/sql/ha_partition.h @@ -515,7 +515,7 @@ public: ------------------------------------------------------------------------- MODULE create/delete handler object ------------------------------------------------------------------------- - Object create/delete methode. The normal called when a table object + Object create/delete method. Normally called when a table object exists. There is also a method to create the handler object with only partition information. This is used from mysql_create_table when the table is to be created and the engine type is deduced to be the @@ -832,7 +832,7 @@ public: /** @breif - Positions an index cursor to the index specified in the hanlde. Fetches the + Positions an index cursor to the index specified in the handle. Fetches the row if available. If the key value is null, begin at first key of the index. */ @@ -1132,7 +1132,7 @@ public: HA_REC_NOT_IN_SEQ: This flag is set for handlers that cannot guarantee that the rows are - returned accroding to incremental positions (0, 1, 2, 3...). + returned according to incremental positions (0, 1, 2, 3...). This also means that rnd_next() should return HA_ERR_RECORD_DELETED if it finds a deleted row. (MyISAM (not fixed length row), HEAP, InnoDB) diff --git a/sql/handle_connections_win.cc b/sql/handle_connections_win.cc index 49b24d96210..80c62c69b46 100644 --- a/sql/handle_connections_win.cc +++ b/sql/handle_connections_win.cc @@ -318,7 +318,7 @@ struct Pipe_Listener : public Listener { PTP_CALLBACK_ENVIRON m_tp_env; Pipe_Listener(): - Listener(INVALID_HANDLE_VALUE, CreateEvent(0, FALSE, FALSE, 0)), + Listener(create_named_pipe(), CreateEvent(0, FALSE, FALSE, 0)), m_tp_env(get_threadpool_win_callback_environ()) { } @@ -387,7 +387,6 @@ struct Pipe_Listener : public Listener void begin_accept() { - m_handle= create_named_pipe(); BOOL connected= ConnectNamedPipe(m_handle, &m_overlapped); if (connected) { @@ -432,11 +431,12 @@ struct Pipe_Listener : public Listener sql_print_warning("ConnectNamedPipe completed with %u", GetLastError()); #endif CloseHandle(m_handle); - m_handle= INVALID_HANDLE_VALUE; + m_handle= create_named_pipe(); begin_accept(); return; } HANDLE pipe= m_handle; + m_handle= create_named_pipe(); begin_accept(); // If threadpool is on, create connection in threadpool thread if (!m_tp_env || !TrySubmitThreadpoolCallback(tp_create_pipe_connection, pipe, m_tp_env)) @@ -493,13 +493,12 @@ static void create_shutdown_event() #define SHUTDOWN_IDX 0 #define LISTENER_START_IDX 1 -void handle_connections_win() -{ - Listener* all_listeners[MAX_WAIT_HANDLES]= {}; - HANDLE wait_events[MAX_WAIT_HANDLES]= {}; - int n_listeners= 0; - int n_waits= 0; +static Listener *all_listeners[MAX_WAIT_HANDLES]; +static HANDLE wait_events[MAX_WAIT_HANDLES]; +static int n_listeners; +void network_init_win() +{ Socket_Listener::init_winsock_extensions(); /* Listen for TCP connections on "extra-port" (no threadpool).*/ @@ -528,18 +527,24 @@ void handle_connections_win() sql_print_error("Either TCP connections or named pipe connections must be enabled."); unireg_abort(1); } +} + +void handle_connections_win() +{ + DBUG_ASSERT(hEventShutdown); + int n_waits; create_shutdown_event(); wait_events[SHUTDOWN_IDX]= hEventShutdown; - n_waits = 1; + n_waits= 1; - for (int i= 0; i < n_listeners; i++) + for (int i= 0; i < n_listeners; i++) { HANDLE wait_handle= all_listeners[i]->wait_handle(); - if(wait_handle) + if (wait_handle) { - DBUG_ASSERT((i == 0) || (all_listeners[i-1]->wait_handle() != 0)); + DBUG_ASSERT((i == 0) || (all_listeners[i - 1]->wait_handle() != 0)); wait_events[n_waits++]= wait_handle; } all_listeners[i]->begin_accept(); diff --git a/sql/handle_connections_win.h b/sql/handle_connections_win.h index a81f4346fb2..bf66c081473 100644 --- a/sql/handle_connections_win.h +++ b/sql/handle_connections_win.h @@ -18,3 +18,4 @@ Creates new (THD) connections.. */ extern void handle_connections_win(); +extern void network_init_win(); diff --git a/sql/handler.cc b/sql/handler.cc index 58f1c60edf9..64d13d1601f 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -804,7 +804,7 @@ int ha_end() DBUG_ENTER("ha_end"); /* - This should be eventualy based on the graceful shutdown flag. + This should be eventually based on the graceful shutdown flag. So if flag is equal to HA_PANIC_CLOSE, the deallocate the errors. */ @@ -1536,8 +1536,8 @@ int ha_commit_trans(THD *thd, bool all) THD_TRANS *trans= all ? &thd->transaction->all : &thd->transaction->stmt; /* "real" is a nick name for a transaction for which a commit will - make persistent changes. E.g. a 'stmt' transaction inside a 'all' - transation is not 'real': even though it's possible to commit it, + make persistent changes. E.g. a 'stmt' transaction inside an 'all' + transaction is not 'real': even though it's possible to commit it, the changes are not durable as they might be rolled back if the enclosing 'all' transaction is rolled back. */ @@ -2829,7 +2829,7 @@ handler *handler::clone(const char *name, MEM_ROOT *mem_root) /* TODO: Implement a more efficient way to have more than one index open for - the same table instance. The ha_open call is not cachable for clone. + the same table instance. The ha_open call is not cacheable for clone. This is not critical as the engines already have the table open and should be able to use the original instance of the table. @@ -3731,7 +3731,7 @@ int handler::update_auto_increment() index_init() or rnd_init() and in any column_bitmaps_signal() call after this. - The handler is allowd to do changes to the bitmap after a index_init or + The handler is allowed to do changes to the bitmap after a index_init or rnd_init() call is made as after this, MySQL will not use the bitmap for any program logic checking. */ @@ -3794,7 +3794,7 @@ void handler::get_auto_increment(ulonglong offset, ulonglong increment, { // Autoincrement at key-start error= ha_index_last(table->record[1]); /* - MySQL implicitely assumes such method does locking (as MySQL decides to + MySQL implicitly assumes such method does locking (as MySQL decides to use nr+increment without checking again with the handler, in handler::update_auto_increment()), so reserves to infinite. */ @@ -6812,7 +6812,7 @@ int handler::check_duplicate_long_entry_key(const uchar *new_rec, uint key_no) DBUG_ASSERT(fnc->arguments()[0]->type() == Item::FIELD_ITEM); t_field= static_cast(fnc->arguments()[0])->field; uint length= (uint)fnc->arguments()[1]->val_int(); - if (t_field->cmp_max(t_field->ptr, t_field->ptr + diff, length)) + if (t_field->cmp_prefix(t_field->ptr, t_field->ptr + diff, length)) is_same= false; } } @@ -8306,6 +8306,7 @@ bool Table_period_info::check_field(const Create_field* f, { my_error(ER_PERIOD_FIELD_WRONG_ATTRIBUTES, MYF(0), f->field_name.str, "GENERATED ALWAYS AS"); + res= true; } return res; diff --git a/sql/handler.h b/sql/handler.h index e3831eacd7a..9ab84794277 100644 --- a/sql/handler.h +++ b/sql/handler.h @@ -240,7 +240,7 @@ enum chf_create_flags { this flag must implement start_read_removal() and end_read_removal(). The handler may return "fake" rows constructed from the key of the row asked for. This is used to optimize UPDATE and DELETE by reducing the - numer of roundtrips between handler and storage engine. + number of roundtrips between handler and storage engine. Example: UPDATE a=1 WHERE pk IN () @@ -582,7 +582,7 @@ enum enum_binlog_command { /* Bits in used_fields */ #define HA_CREATE_USED_AUTO (1UL << 0) -#define HA_CREATE_USED_RAID (1UL << 1) //RAID is no longer availble +#define HA_CREATE_USED_RAID (1UL << 1) //RAID is no longer available #define HA_CREATE_USED_UNION (1UL << 2) #define HA_CREATE_USED_INSERT_METHOD (1UL << 3) #define HA_CREATE_USED_MIN_ROWS (1UL << 4) @@ -1242,7 +1242,7 @@ struct handler_iterator { /* Pointer to buffer for the iterator to use. Should be allocated by function which created the iterator and - destroied by freed by above "destroy" call + destroyed by freed by above "destroy" call */ void *buffer; }; @@ -1455,7 +1455,7 @@ struct handlerton "cookie". The flush and call of commit_checkpoint_notify_ha() need not happen - immediately - it can be scheduled and performed asynchroneously (ie. as + immediately - it can be scheduled and performed asynchronously (ie. as part of next prepare(), or sync every second, or whatever), but should not be postponed indefinitely. It is however also permissible to do it immediately, before returning from commit_checkpoint_request(). @@ -1551,7 +1551,7 @@ struct handlerton file extention. This is implied by the open_table_error() and the default discovery implementation. - Second element - data file extention. This is implied + Second element - data file extension. This is implied assumed by REPAIR TABLE ... USE_FRM implementation. */ const char **tablefile_extensions; // by default - empty list @@ -2297,7 +2297,7 @@ struct HA_CREATE_INFO: public Table_scope_and_contents_source_st, CONVERT TO CHARACTER SET DEFAULT to CONVERT TO CHARACTER SET - TODO: Should't we postpone resolution of DEFAULT until the + TODO: Shouldn't we postpone resolution of DEFAULT until the character set of the table owner database is loaded from its db.opt? */ DBUG_ASSERT(cs); @@ -3093,7 +3093,7 @@ public: ha_statistics stats; /** MultiRangeRead-related members: */ - range_seq_t mrr_iter; /* Interator to traverse the range sequence */ + range_seq_t mrr_iter; /* Iterator to traverse the range sequence */ RANGE_SEQ_IF mrr_funcs; /* Range sequence traversal functions */ HANDLER_BUFFER *multi_range_buffer; /* MRR buffer info */ uint ranges_in_seq; /* Total number of ranges in the traversed sequence */ @@ -4188,7 +4188,7 @@ public: This method offers the storage engine, the possibility to store a reference to a table name which is going to be used with query cache. The method is called each time a statement is written to the cache and can - be used to verify if a specific statement is cachable. It also offers + be used to verify if a specific statement is cacheable. It also offers the possibility to register a generic (but static) call back function which is called each time a statement is matched against the query cache. diff --git a/sql/item.cc b/sql/item.cc index 3ea1a493db2..dbf20f31d7a 100644 --- a/sql/item.cc +++ b/sql/item.cc @@ -2157,14 +2157,14 @@ public: const LEX_CSTRING &field_name_arg): Item_ref(thd, context_arg, item, table_name_arg, field_name_arg) {} - virtual inline void print (String *str, enum_query_type query_type) + void print (String *str, enum_query_type query_type) override { if (ref) (*ref)->print(str, query_type); else Item_ident::print(str, query_type); } - virtual Ref_Type ref_type() { return AGGREGATE_REF; } + Ref_Type ref_type() override final { return AGGREGATE_REF; } }; @@ -5074,7 +5074,7 @@ static bool mark_as_dependent(THD *thd, SELECT_LEX *last, SELECT_LEX *current, @note We have to mark all items between current_sel (including) and - last_select (excluding) as dependend (select before last_select should + last_select (excluding) as dependent (select before last_select should be marked with actual table mask used by resolved item, all other with OUTER_REF_TABLE_BIT) and also write dependence information to Item of resolved identifier. @@ -5448,7 +5448,7 @@ Item_field::fix_outer_field(THD *thd, Field **from_field, Item **reference) bool upward_lookup= FALSE; TABLE_LIST *table_list; - /* Calulate the TABLE_LIST for the table */ + /* Calculate the TABLE_LIST for the table */ table_list= (cached_table ? cached_table : field_found && (*from_field) != view_ref_found ? (*from_field)->table->pos_in_table_list : 0); @@ -6184,7 +6184,7 @@ Item *Item_field::propagate_equal_fields(THD *thd, but failed to create a valid DATE literal from the given string literal. Do not do constant propagation in such cases and unlink - "this" from the found Item_equal (as this equality not usefull). + "this" from the found Item_equal (as this equality not useful). */ item_equal= NULL; return this; @@ -7906,7 +7906,7 @@ bool Item_ref::fix_fields(THD *thd, Item **reference) /* Due to cache, find_field_in_tables() can return field which doesn't belong to provided outer_context. In this case we have - to find proper field context in order to fix field correcly. + to find proper field context in order to fix field correctly. */ do { @@ -8091,9 +8091,9 @@ Item* Item_ref::transform(THD *thd, Item_transformer transformer, uchar *arg) callback functions. First the function applies the analyzer to the Item_ref object. Then - if the analizer succeeeds we first applies the compile method to the + if the analyzer succeeds we first apply the compile method to the object the Item_ref object is referencing. If this returns a new - item the old item is substituted for a new one. After this the + item the old item is substituted for a new one. After this the transformer is applied to the Item_ref object itself. The compile function is not called if the analyzer returns NULL in the parameter arg_p. diff --git a/sql/item.h b/sql/item.h index 150d9cd215e..c4fbf8f9c0a 100644 --- a/sql/item.h +++ b/sql/item.h @@ -164,7 +164,7 @@ void dummy_error_processor(THD *thd, void *data); void view_error_processor(THD *thd, void *data); /* - Instances of Name_resolution_context store the information necesary for + Instances of Name_resolution_context store the information necessary for name resolution of Items and other context analysis of a query made in fix_fields(). @@ -344,7 +344,7 @@ public: Monotonicity is defined only for Item* trees that represent table partitioning expressions (i.e. have no subselects/user vars/PS parameters etc etc). An Item* tree is assumed to have the same monotonicity properties - as its correspoinding function F: + as its corresponding function F: [signed] longlong F(field1, field2, ...) { put values of field_i into table record buffer; @@ -1153,7 +1153,7 @@ public: /* real_type() is the type of base item. This is same as type() for most items, except Item_ref() and Item_cache_wrapper() where it - shows the type for the underlaying item. + shows the type for the underlying item. */ virtual enum Type real_type() const { return type(); } @@ -1299,7 +1299,7 @@ public: The caller can modify the returned String, if it's not marked "const" (with the String::mark_as_const() method). That means that if the item returns its own internal buffer (e.g. tmp_value), it - *must* be marked "const" [1]. So normally it's preferrable to + *must* be marked "const" [1]. So normally it's preferable to return the result value in the String, that was passed as an argument. But, for example, SUBSTR() returns a String that simply points into the buffer of SUBSTR()'s args[0]->val_str(). Such a @@ -1775,7 +1775,7 @@ public: @param cond_ptr[OUT] Store a replacement item here if the condition can be simplified, e.g.: WHERE part1 OR part2 OR part3 - with one of the partN evalutating to SEL_TREE::ALWAYS. + with one of the partN evaluating to SEL_TREE::ALWAYS. */ virtual SEL_TREE *get_mm_tree(RANGE_OPT_PARAM *param, Item **cond_ptr); /* @@ -2369,8 +2369,9 @@ public: virtual bool is_outer_field() const { DBUG_ASSERT(is_fixed()); return FALSE; } /** - Checks if this item or any of its decendents contains a subquery. This is a - replacement of the former Item::has_subquery() and Item::with_subselect. + Checks if this item or any of its descendents contains a subquery. + This is a replacement of the former Item::has_subquery() and + Item::with_subselect. */ virtual bool with_subquery() const { DBUG_ASSERT(is_fixed()); return false; } @@ -6061,7 +6062,7 @@ public: This is the method that updates the cached value. It must be explicitly called by the user of this class to store the value - of the orginal item in the cache. + of the original item in the cache. */ virtual void copy() = 0; diff --git a/sql/item_buff.cc b/sql/item_buff.cc index 81949bcdae0..9c96fdb1a9a 100644 --- a/sql/item_buff.cc +++ b/sql/item_buff.cc @@ -192,7 +192,7 @@ bool Cached_item_field::cmp(void) /* If value is not null and value changed (from null to not null or - becasue of value change), then copy the new value to buffer. + because of value change), then copy the new value to buffer. */ if (! null_value && (tmp || (tmp= (field->cmp(buff) != 0)))) field->get_image(buff,length,field->charset()); diff --git a/sql/item_cmpfunc.cc b/sql/item_cmpfunc.cc index 8203af5c7dc..c753b963fd4 100644 --- a/sql/item_cmpfunc.cc +++ b/sql/item_cmpfunc.cc @@ -1404,7 +1404,7 @@ bool Item_in_optimizer::fix_fields(THD *thd, Item **ref) @note Item_in_optimizer should work as pass-through for - subqueries that were processed by ALL/ANY->MIN/MAX rewrite - - subqueries taht were originally EXISTS subqueries (and were coverted by + - subqueries that were originally EXISTS subqueries (and were coinverted by the EXISTS->IN rewrite) When Item_in_optimizer is not not working as a pass-through, it @@ -1991,8 +1991,8 @@ longlong Item_func_interval::val_int() interval_range *range= intervals + mid; my_bool cmp_result; /* - The values in the range intervall may have different types, - Only do a decimal comparision of the first argument is a decimal + The values in the range interval may have different types, + Only do a decimal comparison if the first argument is a decimal and we are comparing against a decimal */ if (dec && range->type == DECIMAL_RESULT) @@ -2634,7 +2634,7 @@ Item_func_nullif::fix_length_and_dec() Some examples of what NULLIF can end up with after argument substitution (we don't mention args[1] in some cases for simplicity): - 1. l_expr is not an aggragate function: + 1. l_expr is not an aggregate function: a. No conversion happened. args[0] and args[2] were not replaced to something else @@ -2758,7 +2758,7 @@ Item_func_nullif::fix_length_and_dec() In this case we remember and reuse m_arg0 during EXECUTE time as args[2]. QQ: How to make sure that m_args0 does not point - to something temporary which will be destoyed between PREPARE and EXECUTE. + to something temporary which will be destroyed between PREPARE and EXECUTE. The condition below should probably be more strict and somehow check that: - change_item_tree() was called for the new args[0] - m_args0 is referenced from inside args[0], e.g. as a function argument, @@ -7301,7 +7301,7 @@ Item* Item_equal::get_first(JOIN_TAB *context, Item *field_item) and not ot2.col. eliminate_item_equal() also has code that deals with equality substitution - in presense of SJM nests. + in presence of SJM nests. */ TABLE_LIST *emb_nest; diff --git a/sql/item_cmpfunc.h b/sql/item_cmpfunc.h index b943bfc90da..fe6cba607a7 100644 --- a/sql/item_cmpfunc.h +++ b/sql/item_cmpfunc.h @@ -178,7 +178,7 @@ protected: /* Return the full select tree for "field_item" and "value": - a single SEL_TREE if the field is not in a multiple equality, or - - a conjuction of all SEL_TREEs for all fields from + - a conjunction of all SEL_TREEs for all fields from the same multiple equality with "field_item". */ SEL_TREE *get_full_func_mm_tree(RANGE_OPT_PARAM *param, @@ -744,7 +744,7 @@ public: { return get_item_copy(thd, this); } }; -class Item_func_equal :public Item_bool_rowready_func2 +class Item_func_equal final :public Item_bool_rowready_func2 { public: Item_func_equal(THD *thd, Item *a, Item *b): @@ -1117,9 +1117,19 @@ public: bool native_op(THD *thd, Native *to); bool fix_length_and_dec() { + /* + Set nullability from args[1] by default. + Note, some type handlers may reset maybe_null + in Item_hybrid_func_fix_attributes() if args[1] + is NOT NULL but cannot always be converted to + the data type of "this" safely. + E.g. Type_handler_inet6 does: + IFNULL(inet6_not_null_expr, 'foo') -> INET6 NULL + IFNULL(inet6_not_null_expr, '::1') -> INET6 NOT NULL + */ + maybe_null= args[1]->maybe_null; if (Item_func_case_abbreviation2::fix_length_and_dec2(args)) return TRUE; - maybe_null= args[1]->maybe_null; return FALSE; } const char *func_name() const { return "ifnull"; } @@ -3331,7 +3341,7 @@ public: }; -class Item_cond_and :public Item_cond +class Item_cond_and final :public Item_cond { public: COND_EQUAL m_cond_equal; /* contains list of Item_equal objects for @@ -3368,7 +3378,7 @@ inline bool is_cond_and(Item *item) return func_item && func_item->functype() == Item_func::COND_AND_FUNC; } -class Item_cond_or :public Item_cond +class Item_cond_or final :public Item_cond { public: Item_cond_or(THD *thd): Item_cond(thd) {} diff --git a/sql/item_func.cc b/sql/item_func.cc index 813927df32b..8a75d2c9946 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -525,7 +525,7 @@ Item *Item_func::transform(THD *thd, Item_transformer transformer, uchar *argume callback functions. First the function applies the analyzer to the root node of - the Item_func object. Then if the analizer succeeeds (returns TRUE) + the Item_func object. Then if the analyzer succeeds (returns TRUE) the function recursively applies the compile method to each argument of the Item_func node. If the call of the method for an argument item returns a new item @@ -1493,13 +1493,14 @@ double Item_func_div::real_op() my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value) { int err; + my_decimal tmp; VDec2_lazy val(args[0], args[1]); if ((null_value= val.has_null())) return 0; if ((err= check_decimal_overflow(my_decimal_div(E_DEC_FATAL_ERROR & ~E_DEC_OVERFLOW & ~E_DEC_DIV_ZERO, - decimal_value, + &tmp, val.m_a.ptr(), val.m_b.ptr(), prec_increment))) > 3) { @@ -1508,6 +1509,7 @@ my_decimal *Item_func_div::decimal_op(my_decimal *decimal_value) null_value= 1; return 0; } + tmp.round_to(decimal_value, decimals, HALF_UP); return decimal_value; } @@ -1564,7 +1566,7 @@ bool Item_func_div::fix_length_and_dec() DBUG_ENTER("Item_func_div::fix_length_and_dec"); DBUG_PRINT("info", ("name %s", func_name())); prec_increment= current_thd->variables.div_precincrement; - maybe_null= 1; // devision by zero + maybe_null= 1; // division by zero const Type_aggregator *aggregator= &type_handler_data->m_type_aggregator_for_div; DBUG_EXECUTE_IF("num_op", aggregator= &type_handler_data->m_type_aggregator_non_commutative_test;); @@ -2243,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); + } } } @@ -2516,6 +2537,20 @@ void Item_func_round::fix_arg_datetime() } +bool Item_func_round::test_if_length_can_increase() +{ + if (truncate) + return false; + if (args[1]->const_item() && !args[1]->is_expensive()) + { + // Length can increase in some cases: e.g. ROUND(9,-1) -> 10. + Longlong_hybrid val1= args[1]->to_longlong_hybrid(); + return !args[1]->null_value && val1.neg(); + } + return true; // ROUND(x,n), where n is not a constant. +} + + /** Calculate data type and attributes for INT-alike input. @@ -2534,52 +2569,41 @@ void Item_func_round::fix_arg_datetime() simple cases. */ void Item_func_round::fix_arg_int(const Type_handler *preferred, - const Type_std_attributes *preferred_attrs) + const Type_std_attributes *preferred_attrs, + bool use_decimal_on_length_increase) { DBUG_ASSERT(args[0]->decimals == 0); - if (args[1]->const_item()) + + Type_std_attributes::set(preferred_attrs); + if (!test_if_length_can_increase()) { - Longlong_hybrid val1= args[1]->to_longlong_hybrid(); - if (args[1]->null_value) - fix_length_and_dec_double(NOT_FIXED_DEC); - else if ((!val1.to_uint(DECIMAL_MAX_SCALE) && truncate) || - args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS) - { - // Here we can keep INT_RESULT - // Length can increase in some cases: ROUND(9,-1) -> 10 - int length_can_increase= MY_TEST(!truncate && val1.neg()); - if (preferred) - { - Type_std_attributes::set(preferred_attrs); - if (!length_can_increase) - { - // Preserve the exact data type and attributes - set_handler(preferred); - } - else - { - max_length++; - set_handler(type_handler_long_or_longlong()); - } - } - else - { - /* - This branch is currently used for hex hybrid only. - It's known to be unsigned. So sign length is 0. - */ - DBUG_ASSERT(args[0]->unsigned_flag); // no needs to add sign length - max_length= args[0]->decimal_precision() + length_can_increase; - unsigned_flag= true; - decimals= 0; - set_handler(type_handler_long_or_longlong()); - } - } - else - fix_length_and_dec_decimal(val1.to_uint(DECIMAL_MAX_SCALE)); + // Preserve the exact data type and attributes + set_handler(preferred); } else - fix_length_and_dec_double(args[0]->decimals); + { + max_length++; + if (use_decimal_on_length_increase) + set_handler(&type_handler_newdecimal); + else + set_handler(type_handler_long_or_longlong()); + } +} + + +void Item_func_round::fix_arg_hex_hybrid() +{ + DBUG_ASSERT(args[0]->decimals == 0); + DBUG_ASSERT(args[0]->decimal_precision() < DECIMAL_LONGLONG_DIGITS); + DBUG_ASSERT(args[0]->unsigned_flag); // no needs to add sign length + bool length_can_increase= test_if_length_can_increase(); + max_length= args[0]->decimal_precision() + MY_TEST(length_can_increase); + unsigned_flag= true; + decimals= 0; + if (length_can_increase && args[0]->max_length >= 8) + set_handler(&type_handler_newdecimal); + else + set_handler(type_handler_long_or_longlong()); } @@ -4812,7 +4836,7 @@ bool Item_func_set_user_var::register_field_in_bitmap(void *arg) @param type type of new value @param cs charset info for new value @param dv derivation for new value - @param unsigned_arg indiates if a value of type INT_RESULT is unsigned + @param unsigned_arg indicates if a value of type INT_RESULT is unsigned @note Sets error and fatal error if allocation fails. @@ -6750,7 +6774,7 @@ Item_func_sp::fix_fields(THD *thd, Item **ref) /* Here we check privileges of the stored routine only during view creation, in order to validate the view. A runtime check is - perfomed in Item_func_sp::execute(), and this method is not + performed in Item_func_sp::execute(), and this method is not called during context analysis. Notice, that during view creation we do not infer into stored routine bodies and do not check privileges of its statements, which would probably be a diff --git a/sql/item_func.h b/sql/item_func.h index 07ee913b07d..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 *); @@ -1897,6 +1900,7 @@ class Item_func_round :public Item_func_hybrid_field_type bool truncate; void fix_length_and_dec_decimal(uint decimals_to_set); void fix_length_and_dec_double(uint decimals_to_set); + bool test_if_length_can_increase(); public: Item_func_round(THD *thd, Item *a, Item *b, bool trunc_arg) :Item_func_hybrid_field_type(thd, a, b), truncate(trunc_arg) {} @@ -1918,7 +1922,9 @@ public: } void fix_arg_decimal(); void fix_arg_int(const Type_handler *preferred, - const Type_std_attributes *preferred_attributes); + const Type_std_attributes *preferred_attributes, + bool use_decimal_on_length_increase); + void fix_arg_hex_hybrid(); void fix_arg_double(); void fix_arg_time(); void fix_arg_datetime(); diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc index 7f853a73c71..58f41ecfbbc 100644 --- a/sql/item_strfunc.cc +++ b/sql/item_strfunc.cc @@ -984,7 +984,7 @@ String *Item_func_concat_ws::val_str(String *str) goto null; // Must be a blob } else if (res2 == &tmp_value) - { // This can happend only 1 time + { // This can happen only 1 time if (tmp_value.replace(0,0,*sep_str) || tmp_value.replace(0,0,*res)) goto null; res= &tmp_value; @@ -1134,7 +1134,7 @@ bool Item_func_reverse::fix_length_and_dec() } /** - Replace all occurences of string2 in string1 with string3. + Replace all occurrences of string2 in string1 with string3. Don't reallocate val_str() if not needed. @@ -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(); @@ -3979,7 +4003,7 @@ bool Item_func_export_set::fix_length_and_dec() using in a SQL statement. Adds a \\ before all characters that needs to be escaped in a SQL string. - We also escape '^Z' (END-OF-FILE in windows) to avoid probelms when + We also escape '^Z' (END-OF-FILE in windows) to avoid problems when running commands from a file in windows. This function is very useful when you want to generate SQL statements. diff --git a/sql/item_subselect.cc b/sql/item_subselect.cc index 16fa06f4cda..9525019888d 100644 --- a/sql/item_subselect.cc +++ b/sql/item_subselect.cc @@ -1171,12 +1171,12 @@ void Item_singlerow_subselect::reset() /** @todo - - We cant change name of Item_field or Item_ref, because it will - prevent it's correct resolving, but we should save name of + - We can't change name of Item_field or Item_ref, because it will + prevent its correct resolving, but we should save name of removed item => we do not make optimization if top item of list is field or reference. - switch off this optimization for prepare statement, - because we do not rollback this changes. + because we do not rollback these changes. Make rollback for it, or special name resolving mode in 5.0. @param join Join object of the subquery (i.e. 'child' join). @@ -1199,8 +1199,8 @@ Item_singlerow_subselect::select_transformer(JOIN *join) select_lex->item_list.elements == 1 && !select_lex->item_list.head()->with_sum_func() && /* - We cant change name of Item_field or Item_ref, because it will - prevent it's correct resolving, but we should save name of + We can't change name of Item_field or Item_ref, because it will + prevent its correct resolving, but we should save name of removed item => we do not make optimization if top item of list is field or reference. TODO: solve above problem @@ -1698,7 +1698,7 @@ longlong Item_exists_subselect::val_int() Return the result of EXISTS as a string value Converts the true/false result into a string value. - Note that currently this cannot be NULL, so if the query exection fails + Note that currently this cannot be NULL, so if the query execution fails it will return 0. @param decimal_value[out] buffer to hold the resulting string value @@ -1721,7 +1721,7 @@ String *Item_exists_subselect::val_str(String *str) Return the result of EXISTS as a decimal value Converts the true/false result into a decimal value. - Note that currently this cannot be NULL, so if the query exection fails + Note that currently this cannot be NULL, so if the query execution fails it will return 0. @param decimal_value[out] Buffer to hold the resulting decimal value @@ -2419,7 +2419,7 @@ Item_in_subselect::row_value_transformer(JOIN *join) is_not_null_test(v3)) where is_not_null_test registers NULLs values but reject rows. - in case when we do not need correct NULL, we have simplier construction: + in case when we do not need correct NULL, we have simpler construction: EXISTS (SELECT ... WHERE where and (l1 = v1) and (l2 = v2) and @@ -2822,6 +2822,8 @@ bool Item_exists_subselect::select_prepare_to_be_in() Check if 'func' is an equality in form "inner_table.column = outer_expr" @param func Expression to check + @param allow_subselect If true, the outer_expr part can have a subquery + If false, it cannot. @param local_field OUT Return "inner_table.column" here @param outer_expr OUT Return outer_expr here @@ -2829,6 +2831,7 @@ bool Item_exists_subselect::select_prepare_to_be_in() */ static bool check_equality_for_exist2in(Item_func *func, + bool allow_subselect, Item_ident **local_field, Item **outer_exp) { @@ -2839,7 +2842,8 @@ static bool check_equality_for_exist2in(Item_func *func, args= func->arguments(); if (args[0]->real_type() == Item::FIELD_ITEM && args[0]->all_used_tables() != OUTER_REF_TABLE_BIT && - args[1]->all_used_tables() == OUTER_REF_TABLE_BIT) + args[1]->all_used_tables() == OUTER_REF_TABLE_BIT && + (allow_subselect || !args[1]->with_subquery())) { /* It is Item_field or Item_direct_view_ref) */ DBUG_ASSERT(args[0]->type() == Item::FIELD_ITEM || @@ -2850,7 +2854,8 @@ static bool check_equality_for_exist2in(Item_func *func, } else if (args[1]->real_type() == Item::FIELD_ITEM && args[1]->all_used_tables() != OUTER_REF_TABLE_BIT && - args[0]->all_used_tables() == OUTER_REF_TABLE_BIT) + args[0]->all_used_tables() == OUTER_REF_TABLE_BIT && + (allow_subselect || !args[0]->with_subquery())) { /* It is Item_field or Item_direct_view_ref) */ DBUG_ASSERT(args[1]->type() == Item::FIELD_ITEM || @@ -2879,6 +2884,13 @@ typedef struct st_eq_field_outer outer1=inner_tbl1.col1 AND ... AND outer2=inner_tbl1.col2 AND remainder_cond + if there is just one outer_expr=inner_expr pair, then outer_expr can have a + subselect in it. If there are many such pairs, then none of outer_expr can + have a subselect in it. If we allow this, the query will fail with an error: + + This version of MariaDB doesn't yet support 'SUBQUERY in ROW in left + expression of IN/ALL/ANY' + @param conds Condition to be checked @parm result Array to collect EQ_FIELD_OUTER elements describing inner-vs-outer equalities the function has found. @@ -2896,14 +2908,17 @@ static bool find_inner_outer_equalities(Item **conds, { List_iterator li(*((Item_cond*)*conds)->argument_list()); Item *item; + bool allow_subselect= true; while ((item= li++)) { if (item->type() == Item::FUNC_ITEM && check_equality_for_exist2in((Item_func *)item, + allow_subselect, &element.local_field, &element.outer_exp)) { found= TRUE; + allow_subselect= false; element.eq_ref= li.ref(); if (result.append(element)) goto alloc_err; @@ -2912,6 +2927,7 @@ static bool find_inner_outer_equalities(Item **conds, } else if ((*conds)->type() == Item::FUNC_ITEM && check_equality_for_exist2in((Item_func *)*conds, + true, &element.local_field, &element.outer_exp)) { @@ -3278,7 +3294,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join) /* In some optimisation cases we will not need this Item_in_optimizer object, but we can't know it here, but here we need address correct - reference on left expresion. + reference on left expression. note: we won't need Item_in_optimizer when handling degenerate cases like "... IN (SELECT 1)" @@ -3310,7 +3326,7 @@ Item_in_subselect::select_in_like_transformer(JOIN *join) and all that items do not make permanent changes in current item arena which allow to us call them with changed arena (if we do not know nature of Item, we have to call fix_fields() for it only with original arena to - avoid memory leack) + avoid memory leak) */ if (left_expr->cols() == 1) trans_res= single_value_transformer(join); @@ -3473,7 +3489,7 @@ bool Item_in_subselect::setup_mat_engine() /* The select_engine (that executes transformed IN=>EXISTS subselects) is - pre-created at parse time, and is stored in statment memory (preserved + pre-created at parse time, and is stored in statement memory (preserved across PS executions). */ DBUG_ASSERT(engine->engine_type() == subselect_engine::SINGLE_SELECT_ENGINE); @@ -3941,7 +3957,7 @@ int subselect_single_select_engine::exec() For at least one of the pushed predicates the following is true: We should not apply optimizations based on the condition that was pushed down into the subquery. Those optimizations are ref[_or_null] - acceses. Change them to be full table scans. + accesses. Change them to be full table scans. */ JOIN_TAB *tab; for (tab= first_linear_tab(join, WITH_BUSH_ROOTS, WITHOUT_CONST_TABLES); @@ -6177,7 +6193,7 @@ int subselect_partial_match_engine::exec() if (has_covering_null_row) { /* - If there is a NULL-only row that coveres all columns the result of IN + If there is a NULL-only row that covers all columns the result of IN is UNKNOWN. */ item_in->value= 0; @@ -6373,7 +6389,7 @@ subselect_rowid_merge_engine::init(MY_BITMAP *non_null_key_parts, for (uint i= (non_null_key ? 1 : 0); i < merge_keys_count; i++) { /* - Check if the first and only indexed column contains NULL in the curent + Check if the first and only indexed column contains NULL in the current row, and add the row number to the corresponding key. */ if (merge_keys[i]->get_field(0)->is_null()) @@ -6585,7 +6601,7 @@ bool subselect_rowid_merge_engine::partial_match() } /* - If all nullable columns contain only NULLs, then there is a guranteed + If all nullable columns contain only NULLs, then there is a guaranteed partial match, and we don't need to search for a matching row. */ if (has_covering_null_columns) diff --git a/sql/item_subselect.h b/sql/item_subselect.h index b4b278083fc..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; @@ -571,7 +575,7 @@ public: bool jtbm_const_row_found; /* - TRUE<=>this is a flattenable semi-join, false overwise. + TRUE<=>this is a flattenable semi-join, false otherwise. */ bool is_flattenable_semijoin; @@ -1006,7 +1010,7 @@ class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine /* FALSE for 'ref', TRUE for 'ref-or-null'. */ bool check_null; /* - The "having" clause. This clause (further reffered to as "artificial + The "having" clause. This clause (further referred to as "artificial having") was inserted by subquery transformation code. It contains Item(s) that have a side-effect: they record whether the subquery has produced a row with NULL certain components. We need to use it for cases @@ -1027,7 +1031,7 @@ class subselect_indexsubquery_engine: public subselect_uniquesubquery_engine However, subqueries like the above are currently not handled by index lookup-based subquery engines, the engine applicability check misses them: it doesn't switch the engine for case of artificial having and - [eq_]ref access (only for artifical having + ref_or_null or no having). + [eq_]ref access (only for artificial having + ref_or_null or no having). The above example subquery is handled as a full-blown SELECT with eq_ref access to one table. @@ -1098,7 +1102,7 @@ public: */ JOIN *materialize_join; /* - A conjunction of all the equality condtions between all pairs of expressions + A conjunction of all the equality conditions between all pairs of expressions that are arguments of an IN predicate. We need these to post-filter some IN results because index lookups sometimes match values that are actually not equal to the search key in SQL terms. diff --git a/sql/item_sum.cc b/sql/item_sum.cc index 5573cc132f0..4a94169c6f8 100644 --- a/sql/item_sum.cc +++ b/sql/item_sum.cc @@ -705,7 +705,7 @@ int Aggregator_distinct::composite_key_cmp(void* arg, uchar* key1, uchar* key2) C_MODE_START -/* Declarations for auxilary C-callbacks */ +/* Declarations for auxiliary C-callbacks */ int simple_raw_key_cmp(void* arg, const void* key1, const void* key2) { @@ -737,7 +737,7 @@ C_MODE_END @param thd Thread descriptor @return status @retval FALSE success - @retval TRUE faliure + @retval TRUE failure Prepares Aggregator_distinct to process the incoming stream. Creates the temporary table and the Unique class if needed. @@ -1942,7 +1942,7 @@ void Item_sum_count::cleanup() /* - Avgerage + Average */ void Item_sum_avg::fix_length_and_dec_decimal() @@ -2208,7 +2208,7 @@ bool Item_sum_variance::fix_length_and_dec() /* According to the SQL2003 standard (Part 2, Foundations; sec 10.9, aggregate function; paragraph 7h of Syntax Rules), "the declared - type of the result is an implementation-defined aproximate numeric + type of the result is an implementation-defined approximate numeric type. */ if (args[0]->type_handler()->Item_sum_variance_fix_length_and_dec(this)) @@ -2283,7 +2283,7 @@ double Item_sum_variance::val_real() is one or zero. If it's zero, i.e. a population variance, then we only set nullness when the count is zero. - Another way to read it is that 'sample' is the numerical threshhold, at and + Another way to read it is that 'sample' is the numerical threshold, at and below which a 'count' number of items is called NULL. */ DBUG_ASSERT((sample == 0) || (sample == 1)); @@ -4336,7 +4336,7 @@ bool Item_func_group_concat::setup(THD *thd) { /* Force the create_tmp_table() to convert BIT columns to INT - as we cannot compare two table records containg BIT fields + as we cannot compare two table records containing BIT fields stored in the the tree used for distinct/order by. Moreover we don't even save in the tree record null bits where BIT fields store parts of their data. diff --git a/sql/item_sum.h b/sql/item_sum.h index dc520ce2578..118f78ec5c1 100644 --- a/sql/item_sum.h +++ b/sql/item_sum.h @@ -251,7 +251,7 @@ class Window_spec; The field 'aggr_level' is to contain the nest level of the subquery where the set function is aggregated. - The field 'max_arg_level' is for the maximun of the nest levels of the + The field 'max_arg_level' is for the maximum of the nest levels of the unbound column references occurred in the set function. A column reference is unbound within a set function if it is not bound by any subquery used as a subexpression in this function. A column reference is bound by @@ -1016,10 +1016,10 @@ public: -class Item_sum_variance : public Item_sum_double +class Item_sum_variance :public Item_sum_double { Stddev m_stddev; - bool fix_length_and_dec(); + bool fix_length_and_dec() override; public: uint sample; @@ -1030,26 +1030,27 @@ public: sample(sample_arg) {} Item_sum_variance(THD *thd, Item_sum_variance *item); - enum Sumfunctype sum_func () const { return VARIANCE_FUNC; } + Sumfunctype sum_func () const override { return VARIANCE_FUNC; } void fix_length_and_dec_double(); void fix_length_and_dec_decimal(); - void clear(); - bool add(); - double val_real(); - void reset_field(); - void update_field(); - Item *result_item(THD *thd, Field *field); - void no_rows_in_result() {} - const char *func_name() const + void clear() override final; + bool add() override final; + double val_real() override; + void reset_field() override final; + void update_field() override final; + Item *result_item(THD *thd, Field *field) override; + void no_rows_in_result() override final {} + const char *func_name() const override { return sample ? "var_samp(" : "variance("; } - Item *copy_or_same(THD* thd); - Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table); - void cleanup() + Item *copy_or_same(THD* thd) override; + Field *create_tmp_field(MEM_ROOT *root, bool group, TABLE *table) override + final; + void cleanup() override final { m_stddev= Stddev(); Item_sum_double::cleanup(); } - Item *get_copy(THD *thd) + Item *get_copy(THD *thd) override { return get_item_copy(thd, this); } }; @@ -1057,7 +1058,7 @@ public: standard_deviation(a) = sqrt(variance(a)) */ -class Item_sum_std :public Item_sum_variance +class Item_sum_std final :public Item_sum_variance { public: Item_sum_std(THD *thd, Item *item_par, uint sample_arg): @@ -1065,17 +1066,17 @@ class Item_sum_std :public Item_sum_variance Item_sum_std(THD *thd, Item_sum_std *item) :Item_sum_variance(thd, item) {} - enum Sumfunctype sum_func () const { return STD_FUNC; } - double val_real(); - Item *result_item(THD *thd, Field *field); - const char *func_name() const { return "std("; } - Item *copy_or_same(THD* thd); - Item *get_copy(THD *thd) + enum Sumfunctype sum_func () const override final { return STD_FUNC; } + double val_real() override final; + Item *result_item(THD *thd, Field *field) override final; + const char *func_name() const override final { return "std("; } + Item *copy_or_same(THD* thd) override final; + Item *get_copy(THD *thd) override final { return get_item_copy(thd, this); } }; -class Item_sum_hybrid: public Item_sum, +class Item_sum_hybrid : public Item_sum, public Type_handler_hybrid_field_type { public: @@ -1156,7 +1157,7 @@ public: }; -class Item_sum_min :public Item_sum_min_max +class Item_sum_min final :public Item_sum_min_max { public: Item_sum_min(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, 1) {} @@ -1171,7 +1172,7 @@ public: }; -class Item_sum_max :public Item_sum_min_max +class Item_sum_max final :public Item_sum_min_max { public: Item_sum_max(THD *thd, Item *item_par): Item_sum_min_max(thd, item_par, -1) {} @@ -1260,7 +1261,7 @@ protected: }; -class Item_sum_or :public Item_sum_bit +class Item_sum_or final :public Item_sum_bit { public: Item_sum_or(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {} @@ -1276,7 +1277,7 @@ private: }; -class Item_sum_and :public Item_sum_bit +class Item_sum_and final :public Item_sum_bit { public: Item_sum_and(THD *thd, Item *item_par): @@ -1292,7 +1293,7 @@ private: void set_bits_from_counters(); }; -class Item_sum_xor :public Item_sum_bit +class Item_sum_xor final :public Item_sum_bit { public: Item_sum_xor(THD *thd, Item *item_par): Item_sum_bit(thd, item_par, 0) {} @@ -1359,7 +1360,7 @@ struct st_sp_security_context; Example: DECLARE CONTINUE HANDLER FOR NOT FOUND RETURN ret_val; */ -class Item_sum_sp :public Item_sum, +class Item_sum_sp final :public Item_sum, public Item_sp { private: diff --git a/sql/item_timefunc.cc b/sql/item_timefunc.cc index 7bc34ee688c..6b5c6fa323c 100644 --- a/sql/item_timefunc.cc +++ b/sql/item_timefunc.cc @@ -471,10 +471,10 @@ err: /** - Create a formated date/time value in a string. + Create a formatted date/time value in a string. */ -static bool make_date_time(String *format, MYSQL_TIME *l_time, +static bool make_date_time(const String *format, const MYSQL_TIME *l_time, timestamp_type type, const MY_LOCALE *locale, String *str) { @@ -1048,7 +1048,7 @@ uint week_mode(uint mode) a date at start of january) In this case one can get 53 for the first week of next year. This flag ensures that the week is relevant for the given year. Note that this flag is only - releveant if WEEK_JANUARY is not set. + relevant if WEEK_JANUARY is not set. If set Week is in range 1-53. @@ -1350,7 +1350,7 @@ bool get_interval_value(THD *thd, Item *args, if (!(res= args->val_str_ascii(&str_value))) return (1); - /* record negative intervalls in interval->neg */ + /* record negative intervals in interval->neg */ str=res->ptr(); cs= res->charset(); const char *end=str+res->length(); @@ -1493,7 +1493,7 @@ bool Item_func_from_days::get_date(THD *thd, MYSQL_TIME *ltime, date_mode_t fuzz /** - Converts current time in my_time_t to MYSQL_TIME represenatation for local + Converts current time in my_time_t to MYSQL_TIME representation for local time zone. Defines time zone (local) used for whole CURDATE function. */ void Item_func_curdate_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) @@ -1504,7 +1504,7 @@ void Item_func_curdate_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) /** - Converts current time in my_time_t to MYSQL_TIME represenatation for UTC + Converts current time in my_time_t to MYSQL_TIME representation for UTC time zone. Defines time zone (UTC) used for whole UTC_DATE function. */ void Item_func_curdate_utc::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) @@ -1582,7 +1582,7 @@ static void set_sec_part(ulong sec_part, MYSQL_TIME *ltime, Item *item) } /** - Converts current time in my_time_t to MYSQL_TIME represenatation for local + Converts current time in my_time_t to MYSQL_TIME representation for local time zone. Defines time zone (local) used for whole CURTIME function. */ void Item_func_curtime_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) @@ -1596,7 +1596,7 @@ void Item_func_curtime_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) /** - Converts current time in my_time_t to MYSQL_TIME represenatation for UTC + Converts current time in my_time_t to MYSQL_TIME representation for UTC time zone. Defines time zone (UTC) used for whole UTC_TIME function. */ void Item_func_curtime_utc::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) @@ -1650,7 +1650,7 @@ int Item_func_now_local::save_in_field(Field *field, bool no_conversions) /** - Converts current time in my_time_t to MYSQL_TIME represenatation for local + Converts current time in my_time_t to MYSQL_TIME representation for local time zone. Defines time zone (local) used for whole NOW function. */ void Item_func_now_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) @@ -1662,7 +1662,7 @@ void Item_func_now_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) /** - Converts current time in my_time_t to MYSQL_TIME represenatation for UTC + Converts current time in my_time_t to MYSQL_TIME representation for UTC time zone. Defines time zone (UTC) used for whole UTC_TIMESTAMP function. */ void Item_func_now_utc::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) @@ -1692,7 +1692,7 @@ bool Item_func_now::get_date(THD *thd, MYSQL_TIME *res, /** - Converts current time in my_time_t to MYSQL_TIME represenatation for local + Converts current time in my_time_t to MYSQL_TIME representation for local time zone. Defines time zone (local) used for whole SYSDATE function. */ void Item_func_sysdate_local::store_now_in_TIME(THD *thd, MYSQL_TIME *now_time) @@ -1982,7 +1982,7 @@ bool Item_func_convert_tz::get_date(THD *thd, MYSQL_TIME *ltime, uint not_used; my_time_tmp= from_tz->TIME_to_gmt_sec(ltime, ¬_used); ulong sec_part= ltime->second_part; - /* my_time_tmp is guranteed to be in the allowed range */ + /* my_time_tmp is guaranteed to be in the allowed range */ if (my_time_tmp) to_tz->gmt_sec_to_TIME(ltime, my_time_tmp); /* we rely on the fact that no timezone conversion can change sec_part */ @@ -2500,7 +2500,7 @@ void Item_char_typecast::fix_length_and_dec_internal(CHARSET_INFO *from_cs) uint32 char_length; /* We always force character set conversion if cast_cs - is a multi-byte character set. It garantees that the + is a multi-byte character set. It guarantees that the result of CAST is a well-formed string. For single-byte character sets we allow just to copy from the argument. A single-byte character sets string diff --git a/sql/item_xmlfunc.cc b/sql/item_xmlfunc.cc index 4e7757f71db..6e863b1ffef 100644 --- a/sql/item_xmlfunc.cc +++ b/sql/item_xmlfunc.cc @@ -62,7 +62,7 @@ typedef struct my_xml_node_st } MY_XML_NODE; -/* Lexical analizer token */ +/* Lexical analyzer token */ typedef struct my_xpath_lex_st { int term; /* token type, see MY_XPATH_LEX_XXXXX below */ @@ -1074,7 +1074,7 @@ static Item* nametestfunc(MY_XPATH *xpath, /* - Tokens consisting of one character, for faster lexical analizer. + Tokens consisting of one character, for faster lexical analyzer. */ static char simpletok[128]= { @@ -1394,7 +1394,7 @@ my_xpath_function(const char *beg, const char *end) } -/* Initialize a lex analizer token */ +/* Initialize a lex analyzer token */ static void my_xpath_lex_init(MY_XPATH_LEX *lex, const char *str, const char *strend) @@ -1425,7 +1425,7 @@ my_xdigit(int c) SYNOPSYS Scan the next token from the input. lex->term is set to the scanned token type. - lex->beg and lex->end are set to the beginnig + lex->beg and lex->end are set to the beginning and to the end of the token. RETURN N/A @@ -1451,7 +1451,7 @@ my_xpath_lex_scan(MY_XPATH *xpath, (const uchar*) end)) > 0 && ((ctype & (_MY_L | _MY_U)) || *beg == '_')) { - // scan untill the end of the idenfitier + // scan until the end of the identifier for (beg+= length; (length= xpath->cs->ctype(&ctype, (const uchar*) beg, @@ -1580,7 +1580,7 @@ static int my_xpath_parse_AxisName(MY_XPATH *xpath) ** Grammar rules, according to http://www.w3.org/TR/xpath ** Implemented using recursive descendant method. ** All the following grammar processing functions accept -** a signle "xpath" argument and return 1 on success and 0 on error. +** a single "xpath" argument and return 1 on success and 0 on error. ** They also modify "xpath" argument by creating new items. */ @@ -2476,7 +2476,7 @@ public: as it is in conflict with abbreviated step. 1 + .123 does not work, 1 + 0.123 does. - Perhaps it is better to move this code into lex analizer. + Perhaps it is better to move this code into lex analyzer. RETURN 1 - success @@ -2831,7 +2831,7 @@ append_node(String *str, MY_XML_NODE *node) SYNOPSYS A call-back function executed when XML parser - is entering a tag or an attribue. + is entering a tag or an attribute. Appends the new node into data->pxml. Increments data->level. @@ -2867,7 +2867,7 @@ int xml_enter(MY_XML_PARSER *st,const char *attr, size_t len) SYNOPSYS A call-back function executed when XML parser - is entering into a tag or an attribue textual value. + is entering into a tag or an attribute textual value. The value is appended into data->pxml. RETURN @@ -2895,7 +2895,7 @@ int xml_value(MY_XML_PARSER *st,const char *attr, size_t len) SYNOPSYS A call-back function executed when XML parser - is leaving a tag or an attribue. + is leaving a tag or an attribute. Decrements data->level. RETURN diff --git a/sql/key.cc b/sql/key.cc index 0f2af60f9e3..8701d7b8053 100644 --- a/sql/key.cc +++ b/sql/key.cc @@ -229,7 +229,7 @@ void key_restore(uchar *to_record, const uchar *from_key, KEY *key_info, { /* This in fact never happens, as we have only partial BLOB - keys yet anyway, so it's difficult to find any sence to + keys yet anyway, so it's difficult to find any sense to restore the part of a record. Maybe this branch is to be removed, but now we have to ignore GCov compaining. @@ -611,8 +611,8 @@ int key_rec_cmp(void *key_p, uchar *first_rec, uchar *second_rec) max length. The exceptions are the BLOB and VARCHAR field types that take the max length into account. */ - if ((result= field->cmp_max(field->ptr+first_diff, field->ptr+sec_diff, - key_part->length))) + if ((result= field->cmp_prefix(field->ptr+first_diff, field->ptr+sec_diff, + key_part->length))) DBUG_RETURN(result); next_loop: key_part++; diff --git a/sql/lock.cc b/sql/lock.cc index b7bf4eb4f63..ff215795604 100644 --- a/sql/lock.cc +++ b/sql/lock.cc @@ -1166,7 +1166,7 @@ bool Global_read_lock::make_global_read_lock_block_commit(THD *thd) { DBUG_ENTER("make_global_read_lock_block_commit"); /* - If we didn't succeed lock_global_read_lock(), or if we already suceeded + If we didn't succeed lock_global_read_lock(), or if we already succeeded make_global_read_lock_block_commit(), do nothing. */ diff --git a/sql/log.cc b/sql/log.cc index 0bfe7d7ee8b..2a887a68606 100644 --- a/sql/log.cc +++ b/sql/log.cc @@ -167,7 +167,7 @@ void setup_log_handling() /** purge logs, master and slave sides both, related error code - convertor. + converter. Called from @c purge_error_message(), @c MYSQL_BIN_LOG::reset_logs() @param res an internal to purging routines error code @@ -386,7 +386,7 @@ public: never zero. This is done while calling the constructor binlog_cache_mngr. - We cannot set informaton in the constructor binlog_cache_data + We cannot set information in the constructor binlog_cache_data because the space for binlog_cache_mngr is allocated through a placement new. @@ -3161,7 +3161,7 @@ bool MYSQL_QUERY_LOG::write(THD *thd, time_t current_time, mysql_mutex_lock(&LOCK_log); if (is_open()) - { // Safety agains reopen + { // Safety against reopen char buff[80], *end; char query_time_buff[22+7], lock_time_buff[22+7]; size_t buff_len; @@ -3460,7 +3460,7 @@ void MYSQL_BIN_LOG::cleanup() /* Free data for global binlog state. - We can't do that automaticly as we need to do this before + We can't do that automatically as we need to do this before safemalloc is shut down */ if (!is_relay_log) @@ -4234,7 +4234,7 @@ err: /** - Delete all logs refered to in the index file. + Delete all logs referred to in the index file. The new index file will only contain this file. @@ -5771,7 +5771,7 @@ binlog_cache_mngr *THD::binlog_setup_trx_data() - Start a statement transaction to allow us to truncate the cache. - - Save the currrent binlog position so that we can roll back the + - Save the current binlog position so that we can roll back the statement by truncating the cache. We only update the saved position if the old one was undefined, @@ -7064,7 +7064,7 @@ static const char* get_first_binlog(char* buf_arg) } if (normalize_binlog_name(buf_arg, fname, false)) { - errmsg= "cound not normalize the first file name in the binlog index"; + errmsg= "could not normalize the first file name in the binlog index"; goto end; } end: @@ -10063,7 +10063,7 @@ TC_LOG_BINLOG::mark_xid_done(ulong binlog_id, bool write_checkpoint) than compare all found against each other to find the one pointing to the most recent binlog. - Note also that we need to first release LOCK_xid_list, then aquire + Note also that we need to first release LOCK_xid_list, then acquire LOCK_log, then re-aquire LOCK_xid_list. If we were to take LOCK_log while holding LOCK_xid_list, we might deadlock with other threads that take the locks in the opposite order. @@ -10205,7 +10205,7 @@ TC_LOG_BINLOG::commit_checkpoint_notify(void *cookie) necessary stuff. In the future, this thread could also be used to do log rotation in the - background, which could elimiate all stalls around binlog rotations. + background, which could eliminate all stalls around binlog rotations. */ pthread_handler_t binlog_background_thread(void *arg __attribute__((unused))) diff --git a/sql/log_event.cc b/sql/log_event.cc index d5ec2060c02..d66ece96eba 100644 --- a/sql/log_event.cc +++ b/sql/log_event.cc @@ -2735,7 +2735,7 @@ Intvar_log_event::Intvar_log_event(const char* buf, const Format_description_log_event* description_event) :Log_event(buf, description_event) { - /* The Post-Header is empty. The Varible Data part begins immediately. */ + /* The Post-Header is empty. The Variable Data part begins immediately. */ buf+= description_event->common_header_len + description_event->post_header_len[INTVAR_EVENT-1]; type= buf[I_TYPE_OFFSET]; @@ -3284,7 +3284,7 @@ Rows_log_event::Rows_log_event(const char *buf, uint event_len, DBUG_VOID_RETURN; } - /* if my_bitmap_init fails, catched in is_valid() */ + /* if my_bitmap_init fails, caught in is_valid() */ if (likely(!my_bitmap_init(&m_cols, m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL, m_width, diff --git a/sql/log_event.h b/sql/log_event.h index b515036c5e8..5e110dbd3fd 100644 --- a/sql/log_event.h +++ b/sql/log_event.h @@ -461,7 +461,7 @@ class String; /** @def LOG_EVENT_ARTIFICIAL_F - Artificial events are created arbitarily and not written to binary + Artificial events are created arbitrarily and not written to binary log These events should not update the master log position when slave @@ -975,13 +975,13 @@ private: }; /** - the struct aggregates two paramenters that identify an event + the struct aggregates two parameters that identify an event uniquely in scope of communication of a particular master and slave couple. I.e there can not be 2 events from the same staying connected master which have the same coordinates. @note Such identifier is not yet unique generally as the event originating master - is resetable. Also the crashed master can be replaced with some other. + is resettable. Also the crashed master can be replaced with some other. */ typedef struct event_coordinates { @@ -2798,7 +2798,7 @@ public: uint8 number_of_event_types; /* The list of post-headers' lengths followed - by the checksum alg decription byte + by the checksum alg description byte */ uint8 *post_header_len; class master_version_split: public Version { @@ -3324,7 +3324,7 @@ public: */ bool is_deferred() { return deferred; } /* - In case of the deffered applying the variable instance is flagged + In case of the deferred applying the variable instance is flagged and the parsing time query id is stored to be used at applying time. */ void set_deferred(query_id_t qid) { deferred= true; query_id= qid; } @@ -5520,7 +5520,7 @@ private: /** @class Incident_log_event - Class representing an incident, an occurance out of the ordinary, + Class representing an incident, an occurence out of the ordinary, that happened on the master. The event is used to inform the slave that something out of the @@ -5564,7 +5564,7 @@ public: m_message.str= NULL; /* Just as a precaution */ m_message.length= 0; set_direct_logging(); - /* Replicate the incident irregardless of @@skip_replication. */ + /* Replicate the incident regardless of @@skip_replication. */ flags&= ~LOG_EVENT_SKIP_REPLICATION_F; DBUG_VOID_RETURN; } @@ -5586,7 +5586,7 @@ public: strmake(m_message.str, msg->str, msg->length); m_message.length= msg->length; set_direct_logging(); - /* Replicate the incident irregardless of @@skip_replication. */ + /* Replicate the incident regardless of @@skip_replication. */ flags&= ~LOG_EVENT_SKIP_REPLICATION_F; DBUG_VOID_RETURN; } diff --git a/sql/log_event_old.cc b/sql/log_event_old.cc index c6ccfc5a2c0..f02f74ca093 100644 --- a/sql/log_event_old.cc +++ b/sql/log_event_old.cc @@ -1229,7 +1229,7 @@ Old_rows_log_event::Old_rows_log_event(const char *buf, uint event_len, DBUG_VOID_RETURN; } - /* if my_bitmap_init fails, catched in is_valid() */ + /* if my_bitmap_init fails, caught in is_valid() */ if (likely(!my_bitmap_init(&m_cols, m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL, m_width, diff --git a/sql/mysqld.cc b/sql/mysqld.cc index 991234e92c4..4d0b6af8ec9 100644 --- a/sql/mysqld.cc +++ b/sql/mysqld.cc @@ -2526,6 +2526,11 @@ static void network_init(void) #endif } #endif + +#ifdef _WIN32 + network_init_win(); +#endif + DBUG_PRINT("info",("server started")); DBUG_VOID_RETURN; } @@ -6534,11 +6539,11 @@ struct my_option my_long_options[]= {"temp-pool", 0, #if (ENABLE_TEMP_POOL) "Using this option will cause most temporary files created to use a small " - "set of names, rather than a unique name for each new file.", + "set of names, rather than a unique name for each new file. Deprecated.", #else "This option is ignored on this OS.", #endif - &use_temp_pool, &use_temp_pool, 0, GET_BOOL, NO_ARG, 1, + &use_temp_pool, &use_temp_pool, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"transaction-isolation", 0, "Default transaction isolation level", diff --git a/sql/protocol.cc b/sql/protocol.cc index ce4558a13c1..303c33b8fc1 100644 --- a/sql/protocol.cc +++ b/sql/protocol.cc @@ -1197,6 +1197,16 @@ bool Protocol::store_string_aux(const char *from, size_t length, } +bool Protocol_text::store_numeric_string_aux(const char *from, size_t length) +{ + CHARSET_INFO *tocs= thd->variables.character_set_results; + // 'tocs' is NULL when the client issues SET character_set_results=NULL + if (tocs && (tocs->state & MY_CS_NONASCII)) // Conversion needed + return net_store_data_cs((uchar*) from, length, &my_charset_latin1, tocs); + return net_store_data((uchar*) from, length); // No conversion +} + + bool Protocol::store_warning(const char *from, size_t length) { BinaryStringBuffer tmp; @@ -1232,8 +1242,8 @@ bool Protocol_text::store_tiny(longlong from) field_pos++; #endif char buff[22]; - return net_store_data((uchar*) buff, - (size_t) (int10_to_str((int) from, buff, -10) - buff)); + size_t length= (size_t) (int10_to_str((int) from, buff, -10) - buff); + return store_numeric_string_aux(buff, length); } @@ -1244,9 +1254,8 @@ bool Protocol_text::store_short(longlong from) field_pos++; #endif char buff[22]; - return net_store_data((uchar*) buff, - (size_t) (int10_to_str((int) from, buff, -10) - - buff)); + size_t length= (size_t) (int10_to_str((int) from, buff, -10) - buff); + return store_numeric_string_aux(buff, length); } @@ -1257,9 +1266,9 @@ bool Protocol_text::store_long(longlong from) field_pos++; #endif char buff[22]; - return net_store_data((uchar*) buff, - (size_t) (int10_to_str((long int)from, buff, - (from <0)?-10:10)-buff)); + size_t length= (size_t) (int10_to_str((long int)from, buff, + (from < 0) ? - 10 : 10) - buff); + return store_numeric_string_aux(buff, length); } @@ -1270,10 +1279,10 @@ bool Protocol_text::store_longlong(longlong from, bool unsigned_flag) field_pos++; #endif char buff[22]; - return net_store_data((uchar*) buff, - (size_t) (longlong10_to_str(from,buff, - unsigned_flag ? 10 : -10)- - buff)); + size_t length= (size_t) (longlong10_to_str(from, buff, + unsigned_flag ? 10 : -10) - + buff); + return store_numeric_string_aux(buff, length); } @@ -1285,7 +1294,7 @@ bool Protocol_text::store_decimal(const my_decimal *d) #endif StringBuffer str; (void) d->to_string(&str); - return net_store_data((uchar*) str.ptr(), str.length()); + return store_numeric_string_aux(str.ptr(), str.length()); } @@ -1296,7 +1305,7 @@ bool Protocol_text::store(float from, uint32 decimals, String *buffer) field_pos++; #endif Float(from).to_string(buffer, decimals); - return net_store_data((uchar*) buffer->ptr(), buffer->length()); + return store_numeric_string_aux(buffer->ptr(), buffer->length()); } @@ -1307,7 +1316,7 @@ bool Protocol_text::store(double from, uint32 decimals, String *buffer) field_pos++; #endif buffer->set_real(from, decimals, thd->charset()); - return net_store_data((uchar*) buffer->ptr(), buffer->length()); + return store_numeric_string_aux(buffer->ptr(), buffer->length()); } @@ -1347,7 +1356,7 @@ bool Protocol_text::store(MYSQL_TIME *tm, int decimals) #endif char buff[MAX_DATE_STRING_REP_LENGTH]; uint length= my_datetime_to_str(tm, buff, decimals); - return net_store_data((uchar*) buff, length); + return store_numeric_string_aux(buff, length); } @@ -1359,7 +1368,7 @@ bool Protocol_text::store_date(MYSQL_TIME *tm) #endif char buff[MAX_DATE_STRING_REP_LENGTH]; size_t length= my_date_to_str(tm, buff); - return net_store_data((uchar*) buff, length); + return store_numeric_string_aux(buff, length); } @@ -1371,7 +1380,7 @@ bool Protocol_text::store_time(MYSQL_TIME *tm, int decimals) #endif char buff[MAX_DATE_STRING_REP_LENGTH]; uint length= my_time_to_str(tm, buff, decimals); - return net_store_data((uchar*) buff, length); + return store_numeric_string_aux(buff, length); } /** diff --git a/sql/protocol.h b/sql/protocol.h index 188cea847c1..243f3ce417f 100644 --- a/sql/protocol.h +++ b/sql/protocol.h @@ -2,6 +2,7 @@ #define PROTOCOL_INCLUDED /* Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved. + Copyright (c) 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 @@ -190,7 +191,8 @@ public: Before adding a new type, please make sure there is enough storage for it in Query_cache_query_flags. */ - PROTOCOL_TEXT= 0, PROTOCOL_BINARY= 1, PROTOCOL_LOCAL= 2 + PROTOCOL_TEXT= 0, PROTOCOL_BINARY= 1, PROTOCOL_LOCAL= 2, + PROTOCOL_DISCARD= 3 /* Should be last, not used by Query_cache */ }; virtual enum enum_protocol_type type()= 0; @@ -204,8 +206,9 @@ public: /** Class used for the old (MySQL 4.0 protocol). */ -class Protocol_text :public Protocol +class Protocol_text final :public Protocol { + bool store_numeric_string_aux(const char *from, size_t length); public: Protocol_text(THD *thd_arg, ulong prealloc= 0) :Protocol(thd_arg) @@ -213,27 +216,27 @@ public: if (prealloc) packet->alloc(prealloc); } - virtual void prepare_for_resend(); - virtual bool store_null(); - virtual bool store_tiny(longlong from); - virtual bool store_short(longlong from); - virtual bool store_long(longlong from); - virtual bool store_longlong(longlong from, bool unsigned_flag); - virtual bool store_decimal(const my_decimal *); - virtual bool store_str(const char *from, size_t length, - CHARSET_INFO *fromcs, - my_repertoire_t from_repertoire, - CHARSET_INFO *tocs); - virtual bool store(MYSQL_TIME *time, int decimals); - virtual bool store_date(MYSQL_TIME *time); - virtual bool store_time(MYSQL_TIME *time, int decimals); - virtual bool store(float nr, uint32 decimals, String *buffer); - virtual bool store(double from, uint32 decimals, String *buffer); - virtual bool store(Field *field); + void prepare_for_resend() override; + bool store_null() override; + bool store_tiny(longlong from) override; + bool store_short(longlong from) override; + bool store_long(longlong from) override; + bool store_longlong(longlong from, bool unsigned_flag) override; + bool store_decimal(const my_decimal *) override; + bool store_str(const char *from, size_t length, + CHARSET_INFO *fromcs, + my_repertoire_t from_repertoire, + CHARSET_INFO *tocs) override; + bool store(MYSQL_TIME *time, int decimals) override; + bool store_date(MYSQL_TIME *time) override; + bool store_time(MYSQL_TIME *time, int decimals) override; + bool store(float nr, uint32 decimals, String *buffer) override; + bool store(double from, uint32 decimals, String *buffer) override; + bool store(Field *field) override; - virtual bool send_out_parameters(List *sp_params); + bool send_out_parameters(List *sp_params) override; #ifdef EMBEDDED_LIBRARY - void remove_last_row(); + void remove_last_row() override; #endif bool store_field_metadata(const THD *thd, const Send_field &field, CHARSET_INFO *charset_for_protocol, @@ -242,44 +245,44 @@ public: bool store_field_metadata_for_list_fields(const THD *thd, Field *field, const TABLE_LIST *table_list, uint pos); - virtual enum enum_protocol_type type() { return PROTOCOL_TEXT; }; + enum enum_protocol_type type() override { return PROTOCOL_TEXT; }; }; -class Protocol_binary :public Protocol +class Protocol_binary final :public Protocol { private: uint bit_fields; public: Protocol_binary(THD *thd_arg) :Protocol(thd_arg) {} - virtual bool prepare_for_send(uint num_columns); - virtual void prepare_for_resend(); + bool prepare_for_send(uint num_columns) override; + void prepare_for_resend() override; #ifdef EMBEDDED_LIBRARY - virtual bool write(); - bool net_store_data(const uchar *from, size_t length); + bool write() override; + bool net_store_data(const uchar *from, size_t length) override; bool net_store_data_cs(const uchar *from, size_t length, - CHARSET_INFO *fromcs, CHARSET_INFO *tocs); + CHARSET_INFO *fromcs, CHARSET_INFO *tocs) override; #endif - virtual bool store_null(); - virtual bool store_tiny(longlong from); - virtual bool store_short(longlong from); - virtual bool store_long(longlong from); - virtual bool store_longlong(longlong from, bool unsigned_flag); - virtual bool store_decimal(const my_decimal *); - virtual bool store_str(const char *from, size_t length, - CHARSET_INFO *fromcs, - my_repertoire_t from_repertoire, - CHARSET_INFO *tocs); - virtual bool store(MYSQL_TIME *time, int decimals); - virtual bool store_date(MYSQL_TIME *time); - virtual bool store_time(MYSQL_TIME *time, int decimals); - virtual bool store(float nr, uint32 decimals, String *buffer); - virtual bool store(double from, uint32 decimals, String *buffer); - virtual bool store(Field *field); + bool store_null() override; + bool store_tiny(longlong from) override; + bool store_short(longlong from) override; + bool store_long(longlong from) override; + bool store_longlong(longlong from, bool unsigned_flag) override; + bool store_decimal(const my_decimal *) override; + bool store_str(const char *from, size_t length, + CHARSET_INFO *fromcs, + my_repertoire_t from_repertoire, + CHARSET_INFO *tocs) override; + bool store(MYSQL_TIME *time, int decimals) override; + bool store_date(MYSQL_TIME *time) override; + bool store_time(MYSQL_TIME *time, int decimals) override; + bool store(float nr, uint32 decimals, String *buffer) override; + bool store(double from, uint32 decimals, String *buffer) override; + bool store(Field *field) override; - virtual bool send_out_parameters(List *sp_params); + bool send_out_parameters(List *sp_params) override; - virtual enum enum_protocol_type type() { return PROTOCOL_BINARY; }; + enum enum_protocol_type type() override { return PROTOCOL_BINARY; }; }; @@ -297,37 +300,38 @@ public: select_send::send_data() & co., and also uses Protocol_discard object. */ -class Protocol_discard : public Protocol_text +class Protocol_discard final : public Protocol { public: - Protocol_discard(THD *thd_arg) : Protocol_text(thd_arg) {} - bool write() { return 0; } - bool send_result_set_metadata(List *, uint) { return 0; } - bool send_eof(uint, uint) { return 0; } - void prepare_for_resend() { IF_DBUG(field_pos= 0,); } + Protocol_discard(THD *thd_arg) : Protocol(thd_arg) {} + bool write() override { return 0; } + bool send_result_set_metadata(List *, uint) override { return 0; } + bool send_eof(uint, uint) override { return 0; } + void prepare_for_resend() override { IF_DBUG(field_pos= 0,); } + bool send_out_parameters(List *sp_params) override { return false; } /* Provide dummy overrides for any storage methods so that we avoid allocating and copying of data */ - bool store_null() { return false; } - bool store_tiny(longlong) { return false; } - bool store_short(longlong) { return false; } - bool store_long(longlong) { return false; } - bool store_longlong(longlong, bool) { return false; } - bool store_decimal(const my_decimal *) { return false; } + bool store_null() override { return false; } + bool store_tiny(longlong) override { return false; } + bool store_short(longlong) override { return false; } + bool store_long(longlong) override { return false; } + bool store_longlong(longlong, bool) override { return false; } + bool store_decimal(const my_decimal *) override { return false; } bool store_str(const char *, size_t, CHARSET_INFO *, my_repertoire_t, - CHARSET_INFO *) + CHARSET_INFO *) override { return false; } - bool store(MYSQL_TIME *, int) { return false; } - bool store_date(MYSQL_TIME *) { return false; } - bool store_time(MYSQL_TIME *, int) { return false; } - bool store(float, uint32, String *) { return false; } - bool store(double, uint32, String *) { return false; } - bool store(Field *) { return false; } - + bool store(MYSQL_TIME *, int) override { return false; } + bool store_date(MYSQL_TIME *) override { return false; } + bool store_time(MYSQL_TIME *, int) override { return false; } + bool store(float, uint32, String *) override { return false; } + bool store(double, uint32, String *) override { return false; } + bool store(Field *) override { return false; } + enum enum_protocol_type type() override { return PROTOCOL_DISCARD; }; }; diff --git a/sql/records.cc b/sql/records.cc index e4659537199..77ee3c65321 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 852312530db..9bc1b98fde4 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/rpl_parallel.cc b/sql/rpl_parallel.cc index c12573f817f..72347d93ad1 100644 --- a/sql/rpl_parallel.cc +++ b/sql/rpl_parallel.cc @@ -396,13 +396,14 @@ do_gco_wait(rpl_group_info *rgi, group_commit_orderer *gco, } -static void +static bool do_ftwrl_wait(rpl_group_info *rgi, bool *did_enter_cond, PSI_stage_info *old_stage) { THD *thd= rgi->thd; rpl_parallel_entry *entry= rgi->parallel_entry; uint64 sub_id= rgi->gtid_sub_id; + bool aborted= false; DBUG_ENTER("do_ftwrl_wait"); mysql_mutex_assert_owner(&entry->LOCK_parallel_entry); @@ -425,7 +426,10 @@ do_ftwrl_wait(rpl_group_info *rgi, do { if (entry->force_abort || rgi->worker_error) + { + aborted= true; break; + } if (unlikely(thd->check_killed())) { slave_output_error_info(rgi, thd); @@ -444,7 +448,7 @@ do_ftwrl_wait(rpl_group_info *rgi, if (sub_id > entry->largest_started_sub_id) entry->largest_started_sub_id= sub_id; - DBUG_VOID_RETURN; + DBUG_RETURN(aborted); } @@ -530,7 +534,22 @@ rpl_unpause_after_ftwrl(THD *thd) mysql_mutex_lock(&e->LOCK_parallel_entry); rpt->pause_for_ftwrl = false; mysql_mutex_unlock(&rpt->LOCK_rpl_thread); - e->pause_sub_id= (uint64)ULONGLONG_MAX; + /* + Do not change pause_sub_id if force_abort is set. + force_abort is set in case of STOP SLAVE. + + Reason: If pause_sub_id is not changed and force_abort_is set, + any parallel slave thread waiting in do_ftwrl_wait() will + on wakeup return from do_ftwrl_wait() with 1. This will set + skip_event_group to 1 in handle_rpl_parallel_thread() and the + parallel thread will abort at once. + + If pause_sub_id is changed, the code in handle_rpl_parallel_thread() + would continue to execute the transaction in the queue, which would + cause some transactions to be lost. + */ + if (!e->force_abort) + e->pause_sub_id= (uint64)ULONGLONG_MAX; mysql_cond_broadcast(&e->COND_parallel_entry); mysql_mutex_unlock(&e->LOCK_parallel_entry); } @@ -1224,7 +1243,7 @@ handle_rpl_parallel_thread(void *arg) rgi->worker_error= 1; } if (likely(!skip_event_group)) - do_ftwrl_wait(rgi, &did_enter_cond, &old_stage); + skip_event_group= do_ftwrl_wait(rgi, &did_enter_cond, &old_stage); /* Register ourself to wait for the previous commit, if we need to do diff --git a/sql/share/errmsg-utf8.txt b/sql/share/errmsg-utf8.txt index 42b3796d03c..b2b253d0d7b 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_acl.cc b/sql/sql_acl.cc index 9cc35d0707f..161ffc66641 100644 --- a/sql/sql_acl.cc +++ b/sql/sql_acl.cc @@ -4516,7 +4516,11 @@ static int replace_user_table(THD *thd, const User_table &user_table, { if (revoke_grant) { - my_error(ER_NONEXISTING_GRANT, MYF(0), combo->user.str, combo->host.str); + if (combo->host.length) + my_error(ER_NONEXISTING_GRANT, MYF(0), combo->user.str, + combo->host.str); + else + my_error(ER_INVALID_ROLE, MYF(0), combo->user.str); goto end; } /* @@ -6044,6 +6048,8 @@ static void propagate_role_grants(ACL_ROLE *role, enum PRIVS_TO_MERGE::what what, const char *db= 0, const char *name= 0) { + if (!role) + return; mysql_mutex_assert_owner(&acl_cache->lock); PRIVS_TO_MERGE data= { what, db, name }; @@ -8229,6 +8235,21 @@ err: } +static void check_grant_column_int(GRANT_TABLE *grant_table, const char *name, + uint length, privilege_t *want_access) +{ + if (grant_table) + { + *want_access&= ~grant_table->privs; + if (*want_access & grant_table->cols) + { + GRANT_COLUMN *grant_column= column_hash_search(grant_table, name, length); + if (grant_column) + *want_access&= ~grant_column->rights; + } + } +} + /* Check column rights in given security context @@ -8251,9 +8272,6 @@ bool check_grant_column(THD *thd, GRANT_INFO *grant, const char *db_name, const char *table_name, const char *name, size_t length, Security_context *sctx) { - GRANT_TABLE *grant_table; - GRANT_TABLE *grant_table_role; - GRANT_COLUMN *grant_column; privilege_t want_access(grant->want_privilege & ~grant->privilege); DBUG_ENTER("check_grant_column"); DBUG_PRINT("enter", ("table: %s want_access: %llx", @@ -8279,45 +8297,20 @@ bool check_grant_column(THD *thd, GRANT_INFO *grant, grant->version= grant_version; /* purecov: inspected */ } - grant_table= grant->grant_table_user; - grant_table_role= grant->grant_table_role; + check_grant_column_int(grant->grant_table_user, name, (uint)length, + &want_access); + check_grant_column_int(grant->grant_table_role, name, (uint)length, + &want_access); - if (!grant_table && !grant_table_role) - goto err; - - if (grant_table) - { - grant_column= column_hash_search(grant_table, name, length); - if (grant_column) - { - want_access&= ~grant_column->rights; - } - } - if (grant_table_role) - { - grant_column= column_hash_search(grant_table_role, name, length); - if (grant_column) - { - want_access&= ~grant_column->rights; - } - } - if (!want_access) - { - mysql_rwlock_unlock(&LOCK_grant); - DBUG_RETURN(0); - } - -err: mysql_rwlock_unlock(&LOCK_grant); + if (!want_access) + DBUG_RETURN(0); + char command[128]; get_privilege_desc(command, sizeof(command), want_access); /* TODO perhaps error should print current rolename aswell */ - my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), - command, - sctx->priv_user, - sctx->host_or_ip, - name, - table_name); + my_error(ER_COLUMNACCESS_DENIED_ERROR, MYF(0), command, sctx->priv_user, + sctx->host_or_ip, name, table_name); DBUG_RETURN(1); } diff --git a/sql/sql_admin.cc b/sql/sql_admin.cc index 71939936da0..dc9b971f2ed 100644 --- a/sql/sql_admin.cc +++ b/sql/sql_admin.cc @@ -768,8 +768,18 @@ static bool mysql_admin_table(THD* thd, TABLE_LIST* tables, { compl_result_code= result_code= HA_ADMIN_INVALID; } + + /* + The check for ALTER_PARTITION_ADMIN implements this logic: + do not collect EITS STATS for this syntax: + ALTER TABLE ... ANALYZE PARTITION p + EITS statistics is global (not per-partition). Collecting global stats + is much more expensive processing just one partition, so the most + appropriate action is to just not collect EITS stats for this command. + */ collect_eis= (table->table->s->table_category == TABLE_CATEGORY_USER && + !(lex->alter_info.flags & ALTER_PARTITION_ADMIN) && (check_eits_collection_allowed(thd) || lex->with_persistent_for_clause)); } diff --git a/sql/sql_base.cc b/sql/sql_base.cc index 45ce4be3eb5..6a313616025 100644 --- a/sql/sql_base.cc +++ b/sql/sql_base.cc @@ -1316,7 +1316,7 @@ bool wait_while_table_is_used(THD *thd, TABLE *table, table->s->tdc->flush(thd, true); /* extra() call must come only after all instances above are closed */ if (function != HA_EXTRA_NOT_USED) - (void) table->file->extra(function); + DBUG_RETURN(table->file->extra(function)); DBUG_RETURN(FALSE); } @@ -7862,8 +7862,7 @@ bool setup_tables(THD *thd, Name_resolution_context *context, FALSE ok; In this case *map will include the chosen index TRUE error */ -bool setup_tables_and_check_access(THD *thd, - Name_resolution_context *context, +bool setup_tables_and_check_access(THD *thd, Name_resolution_context *context, List *from_clause, TABLE_LIST *tables, List &leaves, diff --git a/sql/sql_class.cc b/sql/sql_class.cc index c507c99ddde..a01b5e400ba 100644 --- a/sql/sql_class.cc +++ b/sql/sql_class.cc @@ -1226,10 +1226,8 @@ extern "C" my_thread_id next_thread_id_noinline() #endif -const Type_handler *THD::type_handler_for_date() const +const Type_handler *THD::type_handler_for_datetime() const { - if (!(variables.sql_mode & MODE_ORACLE)) - return &type_handler_newdate; if (opt_mysql56_temporal_format) return &type_handler_datetime2; return &type_handler_datetime; diff --git a/sql/sql_class.h b/sql/sql_class.h index fa64892d5a0..7088131f12a 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -3551,7 +3551,7 @@ public: { return !MY_TEST(variables.sql_mode & MODE_NO_BACKSLASH_ESCAPES); } - const Type_handler *type_handler_for_date() const; + const Type_handler *type_handler_for_datetime() const; bool timestamp_to_TIME(MYSQL_TIME *ltime, my_time_t ts, ulong sec_part, date_mode_t fuzzydate); inline my_time_t query_start() { return start_time; } @@ -6453,7 +6453,8 @@ struct SORT_FIELD_ATTR */ bool maybe_null; CHARSET_INFO *cs; - uint pack_sort_string(uchar *to, String *str) const; + uint pack_sort_string(uchar *to, const Binary_string *str, + CHARSET_INFO *cs) const; int compare_packed_fixed_size_vals(uchar *a, size_t *a_len, uchar *b, size_t *b_len); int compare_packed_varstrings(uchar *a, size_t *a_len, diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index baec470c471..37def6df7ed 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -769,6 +769,7 @@ void st_parsing_options::reset() { allows_variable= TRUE; + lookup_keywords_after_qualifier= false; } @@ -2144,7 +2145,10 @@ int Lex_input_stream::lex_one_token(YYSTYPE *yylval, THD *thd) yylval->lex_str.str= (char*) get_ptr(); yylval->lex_str.length= 1; c= yyGet(); // should be '.' - next_state= MY_LEX_IDENT_START; // Next is ident (not keyword) + if (lex->parsing_options.lookup_keywords_after_qualifier) + next_state= MY_LEX_IDENT_OR_KEYWORD; + else + next_state= MY_LEX_IDENT_START; // Next is ident (not keyword) if (!ident_map[(uchar) yyPeek()]) // Probably ` or " next_state= MY_LEX_START; return((int) c); @@ -2808,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) { @@ -4791,7 +4804,8 @@ bool st_select_lex::optimize_unflattened_subqueries(bool const_only) sl->options|= SELECT_DESCRIBE; inner_join->select_options|= SELECT_DESCRIBE; } - res= inner_join->optimize(); + if ((res= inner_join->optimize())) + return TRUE; if (!inner_join->cleaned) sl->update_used_tables(); sl->update_correlated_cache(); @@ -11446,3 +11460,25 @@ bool LEX::sp_create_set_password_instr(THD *thd, sphead->m_flags|= sp_head::HAS_SET_AUTOCOMMIT_STMT; return sp_create_assignment_instr(thd, no_lookahead); } + + +bool LEX::map_data_type(const Lex_ident_sys_st &schema_name, + Lex_field_type_st *type) const +{ + const Schema *schema= schema_name.str ? + Schema::find_by_name(schema_name) : + Schema::find_implied(thd); + if (!schema) + { + char buf[128]; + const Name type_name= type->type_handler()->name(); + my_snprintf(buf, sizeof(buf), "%.*s.%.*s", + (int) schema_name.length, schema_name.str, + (int) type_name.length(), type_name.ptr()); + my_error(ER_UNKNOWN_DATA_TYPE, MYF(0), buf); + return true; + } + const Type_handler *mapped= schema->map_data_type(thd, type->type_handler()); + type->set_handler(mapped); + return false; +} diff --git a/sql/sql_lex.h b/sql/sql_lex.h index 92d4ec42c8f..f516219c01a 100644 --- a/sql/sql_lex.h +++ b/sql/sql_lex.h @@ -34,6 +34,7 @@ #include "sql_tvc.h" #include "item.h" #include "sql_limit.h" // Select_limit_counters +#include "sql_schema.h" /* Used for flags of nesting constructs */ #define SELECT_NESTING_MAP_SIZE 64 @@ -2354,6 +2355,7 @@ private: struct st_parsing_options { bool allows_variable; + bool lookup_keywords_after_qualifier; st_parsing_options() { reset(); } void reset(); @@ -4671,6 +4673,9 @@ public: bool set_cast_type_udt(Lex_cast_type_st *type, const LEX_CSTRING &name); + bool map_data_type(const Lex_ident_sys_st &schema, + Lex_field_type_st *type) const; + void mark_first_table_as_inserting(); bool add_table_foreign_key(const LEX_CSTRING *name, diff --git a/sql/sql_schema.cc b/sql/sql_schema.cc new file mode 100644 index 00000000000..0bf4a63c2f8 --- /dev/null +++ b/sql/sql_schema.cc @@ -0,0 +1,80 @@ +/* + Copyright (c) 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 + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include "mariadb.h" +#include "sql_type.h" +#include "sql_schema.h" +#include "sql_class.h" + +class Schema_oracle: public Schema +{ +public: + Schema_oracle(const LEX_CSTRING &name) + :Schema(name) + { } + const Type_handler *map_data_type(THD *thd, const Type_handler *src) + const + { + if (src == &type_handler_newdate) + return thd->type_handler_for_datetime(); + return src; + } +}; + + +class Schema_maxdb: public Schema +{ +public: + Schema_maxdb(const LEX_CSTRING &name) + :Schema(name) + { } + const Type_handler *map_data_type(THD *thd, const Type_handler *src) + const + { + if (src == &type_handler_timestamp || + src == &type_handler_timestamp2) + return thd->type_handler_for_datetime(); + return src; + } +}; + + +Schema mariadb_schema(Lex_cstring(STRING_WITH_LEN("mariadb_schema"))); +Schema_oracle oracle_schema(Lex_cstring(STRING_WITH_LEN("oracle_schema"))); +Schema_maxdb maxdb_schema(Lex_cstring(STRING_WITH_LEN("maxdb_schema"))); + + +Schema *Schema::find_by_name(const LEX_CSTRING &name) +{ + DBUG_ASSERT(name.str); + if (mariadb_schema.eq_name(name)) + return &mariadb_schema; + if (oracle_schema.eq_name(name)) + return &oracle_schema; + if (maxdb_schema.eq_name(name)) + return &maxdb_schema; + return NULL; +} + + +Schema *Schema::find_implied(THD *thd) +{ + if (thd->variables.sql_mode & MODE_ORACLE) + return &oracle_schema; + if (thd->variables.sql_mode & MODE_MAXDB) + return &maxdb_schema; + return &mariadb_schema; +} diff --git a/sql/sql_schema.h b/sql/sql_schema.h new file mode 100644 index 00000000000..886a115cbc5 --- /dev/null +++ b/sql/sql_schema.h @@ -0,0 +1,60 @@ +#ifndef SQL_SCHEMA_H_INCLUDED +#define SQL_SCHEMA_H_INCLUDED +/* + Copyright (c) 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 + the Free Software Foundation; version 2 of the License. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */ + +#include "mysqld.h" +#include "lex_string.h" + +class Schema +{ + LEX_CSTRING m_name; +public: + Schema(const LEX_CSTRING &name) + :m_name(name) + { } + virtual ~Schema() { } + const LEX_CSTRING &name() const { return m_name; } + virtual const Type_handler *map_data_type(THD *thd, const Type_handler *src) + const + { + return src; + } + /* + For now we have *hard-coded* compatibility schemas: + schema_mariadb, schema_oracle, schema_maxdb. + But eventually we'll turn then into real databases on disk. + So the code below compares names according to the filesystem + case sensitivity, like it is done for regular databases. + + Note, this is different to information_schema, whose name + is always case insensitive. This is intentional! + The assymetry will be gone when we'll implement SQL standard + regular and delimited identifiers. + */ + bool eq_name(const LEX_CSTRING &name) const + { + return !table_alias_charset->strnncoll(m_name.str, m_name.length, + name.str, name.length); + } + static Schema *find_by_name(const LEX_CSTRING &name); + static Schema *find_implied(THD *thd); +}; + + +extern Schema mariadb_schema; + +#endif // SQL_SCHEMA_H_INCLUDED diff --git a/sql/sql_select.cc b/sql/sql_select.cc index 7992ced036d..22bf2eb37b5 100644 --- a/sql/sql_select.cc +++ b/sql/sql_select.cc @@ -1552,7 +1552,6 @@ err: bool JOIN::build_explain() { DBUG_ENTER("JOIN::build_explain"); - create_explain_query_if_not_exists(thd->lex, thd->mem_root); have_query_plan= QEP_AVAILABLE; /* @@ -1594,6 +1593,7 @@ bool JOIN::build_explain() int JOIN::optimize() { int res= 0; + create_explain_query_if_not_exists(thd->lex, thd->mem_root); join_optimization_state init_state= optimization_state; if (select_lex->pushdown_select) { @@ -13895,24 +13895,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(); } } } @@ -29011,6 +28994,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 3d2f6003ba1..2087438e086 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 77ebc58bc02..0d41857aaf5 100644 --- a/sql/sql_show.cc +++ b/sql/sql_show.cc @@ -2149,6 +2149,13 @@ int show_create_table_ex(THD *thd, TABLE_LIST *table_list, append_identifier(thd, packet, &field->field_name); packet->append(' '); + const Type_handler *th= field->type_handler(); + const Schema *implied_schema= Schema::find_implied(thd); + if (th != implied_schema->map_data_type(thd, th)) + { + packet->append(th->schema()->name(), system_charset_info); + packet->append(STRING_WITH_LEN("."), system_charset_info); + } type.set(tmp, sizeof(tmp), system_charset_info); field->sql_type(type); packet->append(type.ptr(), type.length(), system_charset_info); @@ -4613,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)) @@ -5925,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 274b1d9a5df..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) { @@ -882,7 +888,7 @@ public: { return Binary_string::append_hex((const char*)src, srclen); } - bool append_introducer_and_hex(String *str) + bool append_introducer_and_hex(const String *str) { return append(STRING_WITH_LEN("_")) || diff --git a/sql/sql_type.cc b/sql/sql_type.cc index bce65e494d3..9e0f9b013c0 100644 --- a/sql/sql_type.cc +++ b/sql/sql_type.cc @@ -186,6 +186,12 @@ bool Type_handler_data::init() } +Schema *Type_handler::schema() const +{ + return &mariadb_schema; +} + + const Type_handler * Type_handler::handler_by_name(THD *thd, const LEX_CSTRING &name) { @@ -4134,6 +4140,19 @@ void Type_handler_temporal_with_date::Item_update_null_value(Item *item) const (void) item->get_date(thd, <ime, Datetime::Options(thd)); } +bool +Type_handler_timestamp_common:: +Column_definition_set_attributes(THD *thd, + Column_definition *def, + const Lex_field_type_st &attr, + CHARSET_INFO *cs, + column_definition_type_t type) const +{ + Type_handler::Column_definition_set_attributes(thd, def, attr, cs, type); + if (!opt_explicit_defaults_for_timestamp) + def->flags|= NOT_NULL_FLAG; + return false; +} void Type_handler_string_result::Item_update_null_value(Item *item) const { @@ -4628,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; @@ -4682,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 @@ -4699,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 @@ -4724,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 @@ -6165,7 +6205,8 @@ bool Type_handler_row:: bool Type_handler_int_result:: Item_func_round_fix_length_and_dec(Item_func_round *item) const { - item->fix_arg_int(this, item->arguments()[0]); + item->fix_arg_int(this, item->arguments()[0], + field_type() == MYSQL_TYPE_LONGLONG); return false; } @@ -6173,7 +6214,7 @@ bool Type_handler_int_result:: bool Type_handler_year:: Item_func_round_fix_length_and_dec(Item_func_round *item) const { - item->fix_arg_int(&type_handler_ulong, item->arguments()[0]); + item->fix_arg_int(&type_handler_ulong, item->arguments()[0], false); return false; } @@ -6181,7 +6222,7 @@ bool Type_handler_year:: bool Type_handler_hex_hybrid:: Item_func_round_fix_length_and_dec(Item_func_round *item) const { - item->fix_arg_int(nullptr, nullptr); + item->fix_arg_hex_hybrid(); return false; } @@ -6224,7 +6265,7 @@ bool Type_handler_date_common:: { static const Type_std_attributes attr(Type_numeric_attributes(8, 0, true), DTCollation_numeric()); - item->fix_arg_int(&type_handler_ulong, &attr); + item->fix_arg_int(&type_handler_ulong, &attr, false); return false; } diff --git a/sql/sql_type.h b/sql/sql_type.h index ed0aaaea400..a6d85b5bb47 100644 --- a/sql/sql_type.h +++ b/sql/sql_type.h @@ -1430,6 +1430,8 @@ public: } }; +class Schema; + /** Class Time is designed to store valid TIME values. @@ -3507,6 +3509,7 @@ public: static const Type_handler *aggregate_for_result_traditional(const Type_handler *h1, const Type_handler *h2); + virtual Schema *schema() const; static void partition_field_type_not_allowed(const LEX_CSTRING &field_name); static bool partition_field_check_result_type(Item *item, Item_result expected_type); @@ -6142,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; }; @@ -6452,6 +6458,12 @@ public: bool Item_func_min_max_get_date(THD *thd, Item_func_min_max*, MYSQL_TIME *, date_mode_t fuzzydate) const override; + bool Column_definition_set_attributes(THD *thd, + Column_definition *def, + const Lex_field_type_st &attr, + CHARSET_INFO *cs, + column_definition_type_t type) + 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/sql_yacc.yy b/sql/sql_yacc.yy index b42d68c26e1..b472dfd4939 100644 --- a/sql/sql_yacc.yy +++ b/sql/sql_yacc.yy @@ -1353,6 +1353,7 @@ End SQL_MODE_ORACLE_SPECIFIC */ %type sp_handler %type type_with_opt_collate field_type + qualified_field_type field_type_numeric field_type_string field_type_lob @@ -5965,10 +5966,12 @@ field_spec: lex->init_last_field(f, &$1, NULL); $$= f; + lex->parsing_options.lookup_keywords_after_qualifier= true; } field_type_or_serial opt_check_constraint { LEX *lex=Lex; + lex->parsing_options.lookup_keywords_after_qualifier= false; $$= $2; $$->check_constraint= $4; @@ -5987,7 +5990,7 @@ field_spec: ; field_type_or_serial: - field_type + qualified_field_type { Lex->last_field->set_attributes(thd, $1, Lex->charset, COLUMN_DEFINITION_TABLE_FIELD); @@ -6164,6 +6167,18 @@ column_default_expr: } ; +qualified_field_type: + field_type + { + Lex->map_data_type(Lex_ident_sys(), &($$= $1)); + } + | sp_decl_ident '.' field_type + { + if (Lex->map_data_type($1, &($$= $3))) + MYSQL_YYABORT; + } + ; + field_type: field_type_numeric | field_type_temporal @@ -6303,7 +6318,7 @@ field_type_temporal: } $$.set(&type_handler_year, $2); } - | DATE_SYM { $$.set(thd->type_handler_for_date()); } + | DATE_SYM { $$.set(&type_handler_newdate); } | TIME_SYM opt_field_length { $$.set(opt_mysql56_temporal_format ? @@ -6313,31 +6328,14 @@ field_type_temporal: } | TIMESTAMP opt_field_length { - if (thd->variables.sql_mode & MODE_MAXDB) - $$.set(opt_mysql56_temporal_format ? - static_cast(&type_handler_datetime2) : - static_cast(&type_handler_datetime), - $2); - else - { - /* - Unlike other types TIMESTAMP fields are NOT NULL by default. - Unless --explicit-defaults-for-timestamp is given. - */ - if (!opt_explicit_defaults_for_timestamp) - Lex->last_field->flags|= NOT_NULL_FLAG; - $$.set(opt_mysql56_temporal_format ? - static_cast(&type_handler_timestamp2): - static_cast(&type_handler_timestamp), - $2); - } + $$.set(opt_mysql56_temporal_format ? + static_cast(&type_handler_timestamp2): + static_cast(&type_handler_timestamp), + $2); } | DATETIME opt_field_length { - $$.set(opt_mysql56_temporal_format ? - static_cast(&type_handler_datetime2) : - static_cast(&type_handler_datetime), - $2); + $$.set(thd->type_handler_for_datetime(), $2); } ; @@ -6642,7 +6640,7 @@ with_or_without_system: type_with_opt_collate: field_type opt_collate { - $$= $1; + Lex->map_data_type(Lex_ident_sys(), &($$= $1)); if ($2) { diff --git a/sql/structs.h b/sql/structs.h index 0993c453e16..27acb9e200e 100644 --- a/sql/structs.h +++ b/sql/structs.h @@ -629,6 +629,10 @@ public: { set(handler, 0, 0); } + void set_handler(const Type_handler *handler) + { + m_handler= handler; + } const Type_handler *type_handler() const { return m_handler; } }; diff --git a/sql/table.cc b/sql/table.cc index e4ed862f41b..6f0aa8d3418 100644 --- a/sql/table.cc +++ b/sql/table.cc @@ -8800,7 +8800,8 @@ bool TABLE::check_period_overlaps(const KEY &key, if (f->is_null_in_record(lhs) || f->is_null_in_record(rhs)) return false; uint kp_len= key.key_part[part_nr].length; - if (f->cmp_max(f->ptr_in_record(lhs), f->ptr_in_record(rhs), kp_len) != 0) + if (f->cmp_prefix(f->ptr_in_record(lhs), f->ptr_in_record(rhs), + kp_len) != 0) return false; } diff --git a/sql/table.h b/sql/table.h index efac9558450..63bcc69b6bc 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/sql/unireg.cc b/sql/unireg.cc index ae860f0143b..c299549843f 100644 --- a/sql/unireg.cc +++ b/sql/unireg.cc @@ -86,7 +86,7 @@ static uchar* extra2_write_str(uchar *pos, const LEX_CSTRING &str) return pos + str.length; } -static uchar* extra2_write_str(uchar *pos, Binary_string *str) +static uchar* extra2_write_str(uchar *pos, const Binary_string *str) { pos= extra2_write_len(pos, str->length()); memcpy(pos, str->ptr(), str->length()); @@ -185,7 +185,7 @@ class Field_data_type_info_image: public BinaryStringBuffer<512> { return net_store_length(pos, length); } - static uchar *store_string(uchar *pos, Binary_string *str) + static uchar *store_string(uchar *pos, const Binary_string *str) { pos= store_length(pos, str->length()); memcpy(pos, str->ptr(), str->length()); diff --git a/storage/archive/ha_archive.h b/storage/archive/ha_archive.h index b9fcf10f96f..c1b4f27e45e 100644 --- a/storage/archive/ha_archive.h +++ b/storage/archive/ha_archive.h @@ -73,7 +73,7 @@ public: */ #define ARCHIVE_VERSION 3 -class ha_archive: public handler +class ha_archive final : public handler { THR_LOCK_DATA lock; /* MySQL lock */ Archive_share *share; /* Shared lock info */ diff --git a/storage/blackhole/ha_blackhole.h b/storage/blackhole/ha_blackhole.h index 646fba6da9f..c2a36a68f45 100644 --- a/storage/blackhole/ha_blackhole.h +++ b/storage/blackhole/ha_blackhole.h @@ -36,7 +36,7 @@ struct st_blackhole_share { Class definition for the blackhole storage engine "Dumbest named feature ever" */ -class ha_blackhole: public handler +class ha_blackhole final : public handler { THR_LOCK_DATA lock; /* MySQL lock */ st_blackhole_share *share; diff --git a/storage/columnstore/CMakeLists.txt b/storage/columnstore/CMakeLists.txt index f71cce38bd8..63d9d3b7a6a 100644 --- a/storage/columnstore/CMakeLists.txt +++ b/storage/columnstore/CMakeLists.txt @@ -15,14 +15,14 @@ IF(CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "amd64" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i386" OR CMAKE_SYSTEM_PROCESSOR STREQUAL "i686") - SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DCOLUMNSTORE_MATURITY=MariaDB_PLUGIN_MATURITY_BETA") add_subdirectory(columnstore) IF(TARGET columnstore) # Needed to bump the component changes up to the main scope APPEND_FOR_CPACK(CPACK_COMPONENTS_ALL) IF (RPM) - APPEND_FOR_CPACK(CPACK_RPM_columnstore-engine_PACKAGE_REQUIRES " binutils jemalloc net-tools python3") + APPEND_FOR_CPACK(CPACK_RPM_columnstore-engine_PACKAGE_REQUIRES " binutils net-tools python3") + APPEND_FOR_CPACK(CPACK_RPM_columnstore-engine_PACKAGE_RECOMMENDS " jemalloc") APPEND_FOR_CPACK(CPACK_RPM_columnstore-engine_USER_FILELIST ";%ignore /var/lib;%ignore /var") APPEND_FOR_CPACK(CPACK_RPM_columnstore-engine_PACKAGE_CONFLICTS " thrift MariaDB-columnstore-platform MariaDB-columnstore-libs") # these three don't have the list semantics, so no append here diff --git a/storage/columnstore/columnstore b/storage/columnstore/columnstore index bca0d90d553..b6b02ed516f 160000 --- a/storage/columnstore/columnstore +++ b/storage/columnstore/columnstore @@ -1 +1 @@ -Subproject commit bca0d90d5537050951a6c2282411d955569a8c58 +Subproject commit b6b02ed516f92055127d416370799d91a82754ea diff --git a/storage/connect/connect.cc b/storage/connect/connect.cc index 60c10527fe9..3b58e8b5a8f 100644 --- a/storage/connect/connect.cc +++ b/storage/connect/connect.cc @@ -355,7 +355,6 @@ bool CntOpenTable(PGLOBAL g, PTDB tdbp, MODE mode, char *c1, char *c2, } // endif mode rcop = false; - } catch (int n) { if (trace(1)) htrc("Exception %d: %s\n", n, g->Message); diff --git a/storage/connect/filamdbf.cpp b/storage/connect/filamdbf.cpp index e48e40601e3..c8571cea559 100644 --- a/storage/connect/filamdbf.cpp +++ b/storage/connect/filamdbf.cpp @@ -49,6 +49,7 @@ #include "global.h" #include "plgdbsem.h" #include "filamdbf.h" +#include "filamzip.h" #include "tabdos.h" #include "valblk.h" #define NO_FUNC @@ -139,7 +140,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PCSZ fn, DBFHEADER *buf) if (fread(buf, HEADLEN, 1, file) != 1) { strcpy(g->Message, MSG(NO_READ_32)); return RC_NF; - } // endif fread + } // endif fread // Check first byte to be sure of .dbf type if ((buf->Version & 0x03) != DBFTYPE) { @@ -149,7 +150,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PCSZ fn, DBFHEADER *buf) if ((buf->Version & 0x30) == 0x30) { strcpy(g->Message, MSG(FOXPRO_FILE)); dbc = 264; // FoxPro database container - } // endif Version + } // endif Version } else strcpy(g->Message, MSG(DBASE_FILE)); @@ -158,12 +159,12 @@ static int dbfhead(PGLOBAL g, FILE *file, PCSZ fn, DBFHEADER *buf) if (fseek(file, buf->Headlen() - dbc, SEEK_SET) != 0) { sprintf(g->Message, MSG(BAD_HEADER), fn); return RC_FX; - } // endif fseek + } // endif fseek if (fread(&endmark, 2, 1, file) != 1) { strcpy(g->Message, MSG(BAD_HEAD_END)); return RC_FX; - } // endif fread + } // endif fread // Some files have just 1D others have 1D00 following fields if (endmark[0] != EOH && endmark[1] != EOH) { @@ -172,7 +173,7 @@ static int dbfhead(PGLOBAL g, FILE *file, PCSZ fn, DBFHEADER *buf) if (rc == RC_OK) return RC_FX; - } // endif endmark + } // endif endmark // Calculate here the number of fields while we have the dbc info buf->SetFields((buf->Headlen() - dbc - 1) / 32); @@ -180,13 +181,58 @@ static int dbfhead(PGLOBAL g, FILE *file, PCSZ fn, DBFHEADER *buf) return rc; } // end of dbfhead +/****************************************************************************/ +/* dbfields: Analyze a DBF header and set the table fields number. */ +/* Parameters: */ +/* PGLOBAL g -- pointer to the CONNECT Global structure */ +/* DBFHEADER *hdrp -- pointer to _dbfheader structure */ +/* Returns: */ +/* RC_OK, RC_INFO, or RC_FX if error. */ +/****************************************************************************/ +static int dbfields(PGLOBAL g, DBFHEADER* hdrp) +{ + char* endmark; + int dbc = 2, rc = RC_OK; + + *g->Message = '\0'; + + // Check first byte to be sure of .dbf type + if ((hdrp->Version & 0x03) != DBFTYPE) { + strcpy(g->Message, MSG(NOT_A_DBF_FILE)); + rc = RC_INFO; + + if ((hdrp->Version & 0x30) == 0x30) { + strcpy(g->Message, MSG(FOXPRO_FILE)); + dbc = 264; // FoxPro database container + } // endif Version + + } else + strcpy(g->Message, MSG(DBASE_FILE)); + + // Check last byte(s) of header + endmark = (char*)hdrp + hdrp->Headlen() - dbc; + + // Some headers just have 1D others have 1D00 following fields + if (endmark[0] != EOH && endmark[1] != EOH) { + sprintf(g->Message, MSG(NO_0DH_HEAD), dbc); + + if (rc == RC_OK) + return RC_FX; + + } // endif endmark + + // Calculate here the number of fields while we have the dbc info + hdrp->SetFields((hdrp->Headlen() - dbc - 1) / 32); + return rc; +} // end of dbfields + /* -------------------------- Function DBFColumns ------------------------- */ /****************************************************************************/ /* DBFColumns: constructs the result blocks containing the description */ /* of all the columns of a DBF file that will be retrieved by #GetData. */ /****************************************************************************/ -PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) +PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS topt, bool info) { int buftyp[] = {TYPE_STRING, TYPE_SHORT, TYPE_STRING, TYPE_INT, TYPE_INT, TYPE_SHORT}; @@ -196,10 +242,12 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) char buf[2], filename[_MAX_PATH]; int ncol = sizeof(buftyp) / sizeof(int); int rc, type, len, field, fields; - bool bad; - DBFHEADER mainhead; - DESCRIPTOR thisfield; - FILE *infile = NULL; + bool bad, mul; + PCSZ target, pwd; + DBFHEADER mainhead, *hp; + DESCRIPTOR thisfield, *tfp; + FILE *infile = NULL; + UNZIPUTL *zutp = NULL; PQRYRES qrp; PCOLRES crp; @@ -217,21 +265,55 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) /************************************************************************/ PlugSetPath(filename, fn, dp); - if (!(infile= global_fopen(g, MSGID_CANNOT_OPEN, filename, "rb"))) - return NULL; + if (topt->zipped) { + target = GetStringTableOption(g, topt, "Entry", NULL); + mul = (target && *target) ? strchr(target, '*') || strchr(target, '?') + : false; + mul = GetBooleanTableOption(g, topt, "Mulentries", mul); - /************************************************************************/ - /* Get the first 32 bytes of the header. */ - /************************************************************************/ - if ((rc = dbfhead(g, infile, filename, &mainhead)) == RC_FX) { - fclose(infile); - return NULL; - } // endif dbfhead + if (mul) { + strcpy(g->Message, "Cannot find column definition for multiple entries"); + return NULL; + } // endif Multiple - /************************************************************************/ - /* Allocate the structures used to refer to the result set. */ - /************************************************************************/ - fields = mainhead.Fields(); + pwd = GetStringTableOption(g, topt, "Password", NULL); + zutp = new(g) UNZIPUTL(target, pwd, mul); + + if (!zutp->OpenTable(g, MODE_READ, filename)) + hp = (DBFHEADER*)zutp->memory; + else + return NULL; + + /**********************************************************************/ + /* Set the table fields number. */ + /**********************************************************************/ + if ((rc = dbfields(g, hp)) == RC_FX) { + zutp->close(); + return NULL; + } // endif dbfields + + tfp = (DESCRIPTOR*)hp; + } else { + if (!(infile = global_fopen(g, MSGID_CANNOT_OPEN, filename, "rb"))) + return NULL; + else + hp = &mainhead; + + /**********************************************************************/ + /* Get the first 32 bytes of the header. */ + /**********************************************************************/ + if ((rc = dbfhead(g, infile, filename, hp)) == RC_FX) { + fclose(infile); + return NULL; + } // endif dbfhead + + tfp = &thisfield; + } // endif zipped + + /************************************************************************/ + /* Get the number of the table fields. */ + /************************************************************************/ + fields = hp->Fields(); } else fields = 0; @@ -241,19 +323,21 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) if (info || !qrp) { if (infile) fclose(infile); + else if (zutp) + zutp->close(); return qrp; - } // endif info + } // endif info if (trace(1)) { htrc("Structure of %s\n", filename); htrc("headlen=%hd reclen=%hd degree=%d\n", - mainhead.Headlen(), mainhead.Reclen(), fields); - htrc("flags(iem)=%d,%d,%d cp=%d\n", mainhead.Incompleteflag, - mainhead.Encryptflag, mainhead.Mdxflag, mainhead.Language); + hp->Headlen(), hp->Reclen(), fields); + htrc("flags(iem)=%d,%d,%d cp=%d\n", hp->Incompleteflag, + hp->Encryptflag, hp->Mdxflag, hp->Language); htrc("%hd records, last changed %02d/%02d/%d\n", - mainhead.Records(), mainhead.Filedate[1], mainhead.Filedate[2], - mainhead.Filedate[0] + ((mainhead.Filedate[0] <= 30) ? 2000 : 1900)); + hp->Records(), hp->Filedate[1], hp->Filedate[2], + hp->Filedate[0] + ((hp->Filedate[0] <= 30) ? 2000 : 1900)); htrc("Field Type Offset Len Dec Set Mdx\n"); } // endif trace @@ -265,21 +349,24 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) for (field = 0; field < fields; field++) { bad = FALSE; - if (fread(&thisfield, HEADLEN, 1, infile) != 1) { + if (topt->zipped) { + tfp = (DESCRIPTOR*)((char*)tfp + HEADLEN); + } else if (fread(tfp, HEADLEN, 1, infile) != 1) { sprintf(g->Message, MSG(ERR_READING_REC), field+1, fn); goto err; - } else - len = thisfield.Length; + } // endif fread + + len = tfp->Length; if (trace(1)) htrc("%-11s %c %6ld %3d %2d %3d %3d\n", - thisfield.Name, thisfield.Type, thisfield.Offset, len, - thisfield.Decimals, thisfield.Setfield, thisfield.Mdxfield); + tfp->Name, tfp->Type, tfp->Offset, len, + tfp->Decimals, tfp->Setfield, tfp->Mdxfield); /************************************************************************/ /* Now get the results into blocks. */ /************************************************************************/ - switch (thisfield.Type) { + switch (tfp->Type) { case 'C': // Characters case 'L': // Logical 'T' or 'F' or space type = TYPE_STRING; @@ -294,7 +381,7 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) // type = TYPE_INT; // break; case 'N': - type = (thisfield.Decimals) ? TYPE_DOUBLE + type = (tfp->Decimals) ? TYPE_DOUBLE : (len > 10) ? TYPE_BIGINT : TYPE_INT; break; case 'F': // Float @@ -306,8 +393,8 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) break; default: if (!info) { - sprintf(g->Message, MSG(BAD_DBF_TYPE), thisfield.Type - , thisfield.Name); + sprintf(g->Message, MSG(BAD_DBF_TYPE), tfp->Type + , tfp->Name); goto err; } // endif info @@ -316,27 +403,31 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) } // endswitch Type crp = qrp->Colresp; // Column Name - crp->Kdata->SetValue(thisfield.Name, field); + crp->Kdata->SetValue(tfp->Name, field); crp = crp->Next; // Data Type crp->Kdata->SetValue((int)type, field); crp = crp->Next; // Type Name if (bad) { - buf[0] = thisfield.Type; + buf[0] = tfp->Type; crp->Kdata->SetValue(buf, field); } else crp->Kdata->SetValue(GetTypeName(type), field); crp = crp->Next; // Precision - crp->Kdata->SetValue((int)thisfield.Length, field); + crp->Kdata->SetValue((int)tfp->Length, field); crp = crp->Next; // Length - crp->Kdata->SetValue((int)thisfield.Length, field); + crp->Kdata->SetValue((int)tfp->Length, field); crp = crp->Next; // Scale (precision) - crp->Kdata->SetValue((int)thisfield.Decimals, field); + crp->Kdata->SetValue((int)tfp->Decimals, field); } // endfor field qrp->Nblin = field; - fclose(infile); + + if (infile) + fclose(infile); + else if (zutp) + zutp->close(); #if 0 if (info) { @@ -347,9 +438,9 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) sprintf(buf, "Ver=%02x ncol=%hu nlin=%u lrecl=%hu headlen=%hu date=%02d/%02d/%02d", - mainhead.Version, fields, mainhead.Records, mainhead.Reclen, - mainhead.Headlen, mainhead.Filedate[0], mainhead.Filedate[1], - mainhead.Filedate[2]); + hp->Version, fields, hp->Records, hp->Reclen, + hp->Headlen, hp->Filedate[0], hp->Filedate[1], + hp->Filedate[2]); strcat(g->Message, buf); } // endif info @@ -360,9 +451,13 @@ PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info) /**************************************************************************/ return qrp; - err: - fclose(infile); - return NULL; +err: + if (infile) + fclose(infile); + else if (zutp) + zutp->close(); + + return NULL; } // end of DBFColumns /* ---------------------------- Class DBFBASE ----------------------------- */ diff --git a/storage/connect/filamdbf.h b/storage/connect/filamdbf.h index 640fc349b4c..dfe5cb5cfc4 100644 --- a/storage/connect/filamdbf.h +++ b/storage/connect/filamdbf.h @@ -19,7 +19,7 @@ typedef class DBMFAM *PDBMFAM; /****************************************************************************/ /* Functions used externally. */ /****************************************************************************/ -PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, bool info); +PQRYRES DBFColumns(PGLOBAL g, PCSZ dp, PCSZ fn, PTOS tiop, bool info); /****************************************************************************/ /* This is the base class for dBASE file access methods. */ diff --git a/storage/connect/filamzip.cpp b/storage/connect/filamzip.cpp index fd1cf0ceff9..eb14e846120 100644 --- a/storage/connect/filamzip.cpp +++ b/storage/connect/filamzip.cpp @@ -1,11 +1,11 @@ /*********** File AM Zip C++ Program Source Code File (.CPP) ***********/ /* PROGRAM NAME: FILAMZIP */ /* ------------- */ -/* Version 1.3 */ +/* Version 1.4 */ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */ +/* (C) Copyright to the author Olivier BERTRAND 2016-2020 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -45,6 +45,62 @@ #define WRITEBUFFERSIZE (16384) +/****************************************************************************/ +/* Definitions used for DBF tables. */ +/****************************************************************************/ +#define HEADLEN 32 /* sizeof ( mainhead or thisfield ) */ +//efine MEMOLEN 10 /* length of memo field in .dbf */ +#define DBFTYPE 3 /* value of bits 0 and 1 if .dbf */ +#define EOH 0x0D /* end-of-header marker in .dbf file */ + +/****************************************************************************/ +/* First 32 bytes of a DBF table. */ +/* Note: some reserved fields are used here to store info (Fields) */ +/****************************************************************************/ +typedef struct _dbfheader { + uchar Version; /* Version information flags */ + char Filedate[3]; /* date, YYMMDD, binary. YY=year-1900 */ +private: + /* The following four members are stored in little-endian format on disk */ + char m_RecordsBuf[4]; /* records in the file */ + char m_HeadlenBuf[2]; /* bytes in the header */ + char m_ReclenBuf[2]; /* bytes in a record */ + char m_FieldsBuf[2]; /* Reserved but used to store fields */ +public: + char Incompleteflag; /* 01 if incomplete, else 00 */ + char Encryptflag; /* 01 if encrypted, else 00 */ + char Reserved2[12]; /* for LAN use */ + char Mdxflag; /* 01 if production .mdx, else 00 */ + char Language; /* Codepage */ + char Reserved3[2]; + + uint Records(void) const { return uint4korr(m_RecordsBuf); } + ushort Headlen(void) const { return uint2korr(m_HeadlenBuf); } + ushort Reclen(void) const { return uint2korr(m_ReclenBuf); } + ushort Fields(void) const { return uint2korr(m_FieldsBuf); } + + void SetHeadlen(ushort num) { int2store(m_HeadlenBuf, num); } + void SetReclen(ushort num) { int2store(m_ReclenBuf, num); } + void SetFields(ushort num) { int2store(m_FieldsBuf, num); } +} DBFHEADER; + +/****************************************************************************/ +/* Column field descriptor of a .dbf file. */ +/****************************************************************************/ +typedef struct _descriptor { + char Name[11]; /* field name, in capitals, null filled*/ + char Type; /* field type, C, D, F, L, M or N */ + uint Offset; /* used in memvars, not in files. */ + uchar Length; /* field length */ + uchar Decimals; /* number of decimal places */ + short Reserved4; + char Workarea; /* ??? */ + char Reserved5[2]; + char Setfield; /* ??? */ + char Reserved6[7]; + char Mdxfield; /* 01 if tag field in production .mdx */ +} DESCRIPTOR; + bool ZipLoadFile(PGLOBAL g, PCSZ zfn, PCSZ fn, PCSZ entry, bool append, bool mul); /***********************************************************************/ @@ -214,10 +270,21 @@ bool ZipLoadFile(PGLOBAL g, PCSZ zfn, PCSZ fn, PCSZ entry, bool append, bool mul buf = (char*)PlugSubAlloc(g, NULL, WRITEBUFFERSIZE); - if (mul) - err = ZipFiles(g, zutp, fn, buf); - else - err = ZipFile(g, zutp, fn, entry, buf); + if (!mul) { + PCSZ entp; + + if (!entry) { // entry defaults to the file name + char* p = strrchr((char*)fn, '/'); +#if defined(__WIN__) + if (!p) p = strrchr((char*)fn, '\\'); +#endif // __WIN__ + entp = (p) ? p + 1 : entry; + } else + entp = entry; + + err = ZipFile(g, zutp, fn, entp, buf); + } else + err = ZipFiles(g, zutp, fn, buf); zutp->close(); return err; @@ -232,6 +299,7 @@ ZIPUTIL::ZIPUTIL(PCSZ tgt) { zipfile = NULL; target = tgt; + pwd = NULL; fp = NULL; entryopen = false; } // end of ZIPUTIL standard constructor @@ -241,6 +309,7 @@ ZIPUTIL::ZIPUTIL(ZIPUTIL *zutp) { zipfile = zutp->zipfile; target = zutp->target; + pwd = zutp->pwd; fp = zutp->fp; entryopen = zutp->entryopen; } // end of UNZIPUTL copy constructor @@ -385,11 +454,11 @@ void ZIPUTIL::closeEntry() /***********************************************************************/ /* Constructors. */ /***********************************************************************/ -UNZIPUTL::UNZIPUTL(PCSZ tgt, bool mul) +UNZIPUTL::UNZIPUTL(PCSZ tgt, PCSZ pw, bool mul) { zipfile = NULL; target = tgt; - pwd = NULL; + pwd = pw; fp = NULL; memory = NULL; size = 0; @@ -959,7 +1028,7 @@ int UZXFAM::Cardinality(PGLOBAL g) } // end of Cardinality /***********************************************************************/ -/* OpenTableFile: Open a DOS/UNIX table file from a ZIP file. */ +/* OpenTableFile: Open a FIX/UNIX table file from a ZIP file. */ /***********************************************************************/ bool UZXFAM::OpenTableFile(PGLOBAL g) { @@ -1015,6 +1084,197 @@ int UZXFAM::GetNext(PGLOBAL g) return RC_OK; } // end of GetNext +/* -------------------------- class UZDFAM --------------------------- */ + +/***********************************************************************/ +/* Constructors. */ +/***********************************************************************/ +UZDFAM::UZDFAM(PDOSDEF tdp) : DBMFAM(tdp) +{ + zutp = NULL; + tdfp = tdp; + //target = tdp->GetEntry(); + //mul = tdp->GetMul(); + //Lrecl = tdp->GetLrecl(); +} // end of UZXFAM standard constructor + +UZDFAM::UZDFAM(PUZDFAM txfp) : DBMFAM(txfp) +{ + zutp = txfp->zutp; + tdfp = txfp->tdfp; + //target = txfp->target; + //mul = txfp->mul; + //Lrecl = txfp->Lrecl; +} // end of UZXFAM copy constructor + +#if 0 +/****************************************************************************/ +/* dbfhead: Routine to analyze a DBF header. */ +/* Parameters: */ +/* PGLOBAL g -- pointer to the CONNECT Global structure */ +/* DBFHEADER *hdrp -- pointer to _dbfheader structure */ +/* Returns: */ +/* RC_OK, RC_NF, RC_INFO, or RC_FX if error. */ +/* Side effects: */ +/* Set the fields number in the header. */ +/****************************************************************************/ +int UZDFAM::dbfhead(PGLOBAL g, void* buf) +{ + char *endmark; + int dbc = 2, rc = RC_OK; + DBFHEADER* hdrp = (DBFHEADER*)buf; + + *g->Message = '\0'; + + // Check first byte to be sure of .dbf type + if ((hdrp->Version & 0x03) != DBFTYPE) { + strcpy(g->Message, MSG(NOT_A_DBF_FILE)); + rc = RC_INFO; + + if ((hdrp->Version & 0x30) == 0x30) { + strcpy(g->Message, MSG(FOXPRO_FILE)); + dbc = 264; // FoxPro database container + } // endif Version + + } else + strcpy(g->Message, MSG(DBASE_FILE)); + + // Check last byte(s) of header + endmark = (char*)hdrp + hdrp->Headlen() - dbc; + + // Some headers just have 1D others have 1D00 following fields + if (endmark[0] != EOH && endmark[1] != EOH) { + sprintf(g->Message, MSG(NO_0DH_HEAD), dbc); + + if (rc == RC_OK) + return RC_FX; + + } // endif endmark + + // Calculate here the number of fields while we have the dbc info + hdrp->SetFields((hdrp->Headlen() - dbc - 1) / 32); + return rc; +} // end of dbfhead + +/****************************************************************************/ +/* ScanHeader: scan the DBF file header for number of records, record size,*/ +/* and header length. Set Records, check that Reclen is equal to lrecl and */ +/* return the header length or 0 in case of error. */ +/****************************************************************************/ +int UZDFAM::ScanHeader(PGLOBAL g, int* rln) +{ + int rc; + DBFHEADER header; + + /************************************************************************/ + /* Get the first 32 bytes of the header. */ + /************************************************************************/ + rc = dbfhead(g, &header); + + if (rc == RC_FX) + return -1; + + *rln = (int)header.Reclen(); + Records = (int)header.Records(); + return (int)header.Headlen(); +} // end of ScanHeader +#endif // 0 + +/***********************************************************************/ +/* ZIP GetFileLength: returns file size in number of bytes. */ +/***********************************************************************/ +int UZDFAM::GetFileLength(PGLOBAL g) +{ + int len; + + if (!zutp && OpenTableFile(g)) + return 0; + + if (zutp->entryopen) + len = zutp->size; + else + len = 0; + + return len; +} // end of GetFileLength + +/***********************************************************************/ +/* ZIP Cardinality: return the number of rows if possible. */ +/***********************************************************************/ +int UZDFAM::Cardinality(PGLOBAL g) +{ + if (!g) + return 1; + + int card = -1; + int len = GetFileLength(g); + + card = Records; + + // Set number of blocks for later use + Block = (card > 0) ? (card + Nrec - 1) / Nrec : 0; + return card; +} // end of Cardinality + +/***********************************************************************/ +/* OpenTableFile: Open a DBF table file from a ZIP file. */ +/***********************************************************************/ +bool UZDFAM::OpenTableFile(PGLOBAL g) +{ + // May have been already opened in GetFileLength + if (!zutp || !zutp->zipfile) { + char filename[_MAX_PATH]; + MODE mode = Tdbp->GetMode(); + + /*********************************************************************/ + /* Allocate the ZIP utility class. */ + /*********************************************************************/ + if (!zutp) + zutp = new(g)UNZIPUTL(tdfp); + + // We used the file name relative to recorded datapath + PlugSetPath(filename, To_File, Tdbp->GetPath()); + + if (!zutp->OpenTable(g, mode, filename)) { + // The pseudo "buffer" is here the entire real buffer + Memory = zutp->memory; + Top = Memory + zutp->size; + To_Fb = zutp->fp; // Useful when closing + return AllocateBuffer(g); + } else + return true; + + } else + Reset(); + + return false; +} // end of OpenTableFile + +/***********************************************************************/ +/* GetNext: go to next entry. */ +/***********************************************************************/ +int UZDFAM::GetNext(PGLOBAL g) +{ + int rc = zutp->nextEntry(g); + + if (rc != RC_OK) + return rc; + + int len = zutp->size; + +#if 0 + if (len % Lrecl) { + sprintf(g->Message, MSG(NOT_FIXED_LEN), zutp->fn, len, Lrecl); + return RC_FX; + } // endif size +#endif // 0 + + Memory = zutp->memory; + Top = Memory + len; + Rewind(); + return RC_OK; +} // end of GetNext + /* -------------------------- class ZIPFAM --------------------------- */ /***********************************************************************/ @@ -1045,7 +1305,7 @@ bool ZIPFAM::OpenTableFile(PGLOBAL g) strcpy(g->Message, "No insert into existing zip file"); return true; } else if (append && len > 0) { - UNZIPUTL *zutp = new(g) UNZIPUTL(target, false); + UNZIPUTL *zutp = new(g) UNZIPUTL(target, NULL, false); if (!zutp->IsInsertOk(g, filename)) { strcpy(g->Message, "No insert into existing entry"); @@ -1129,7 +1389,7 @@ bool ZPXFAM::OpenTableFile(PGLOBAL g) strcpy(g->Message, "No insert into existing zip file"); return true; } else if (append && len > 0) { - UNZIPUTL *zutp = new(g) UNZIPUTL(target, false); + UNZIPUTL *zutp = new(g) UNZIPUTL(target, NULL, false); if (!zutp->IsInsertOk(g, filename)) { strcpy(g->Message, "No insert into existing entry"); diff --git a/storage/connect/filamzip.h b/storage/connect/filamzip.h index be17d954728..7ff1fb0a543 100644 --- a/storage/connect/filamzip.h +++ b/storage/connect/filamzip.h @@ -1,7 +1,7 @@ /************** filamzip H Declares Source Code File (.H) **************/ -/* Name: filamzip.h Version 1.2 */ +/* Name: filamzip.h Version 1.3 */ /* */ -/* (C) Copyright to the author Olivier BERTRAND 2016-2017 */ +/* (C) Copyright to the author Olivier BERTRAND 2016-2020 */ /* */ /* This file contains the ZIP file access method classes declares. */ /***********************************************************************/ @@ -11,6 +11,7 @@ #include "block.h" #include "filamap.h" #include "filamfix.h" +#include "filamdbf.h" #include "zip.h" #include "unzip.h" @@ -18,6 +19,7 @@ typedef class UNZFAM *PUNZFAM; typedef class UZXFAM *PUZXFAM; +typedef class UZDFAM* PUZDFAM; typedef class ZIPFAM *PZIPFAM; typedef class ZPXFAM *PZPXFAM; @@ -53,7 +55,7 @@ class DllExport ZIPUTIL : public BLOCK { class DllExport UNZIPUTL : public BLOCK { public: // Constructor - UNZIPUTL(PCSZ tgt, bool mul); + UNZIPUTL(PCSZ tgt, PCSZ pw, bool mul); UNZIPUTL(PDOSDEF tdp); // Implementation @@ -143,6 +145,36 @@ class DllExport UZXFAM : public MPXFAM { PDOSDEF tdfp; }; // end of UZXFAM +/***********************************************************************/ +/* This is the fixed unzip file access method. */ +/***********************************************************************/ +class DllExport UZDFAM : public DBMFAM { + //friend class UNZFAM; +public: + // Constructors + UZDFAM(PDOSDEF tdp); + UZDFAM(PUZDFAM txfp); + + // Implementation + virtual AMT GetAmType(void) { return TYPE_AM_ZIP; } + virtual PTXF Duplicate(PGLOBAL g) { return (PTXF) new(g)UZDFAM(this); } + + // Methods + virtual int GetFileLength(PGLOBAL g); + virtual int Cardinality(PGLOBAL g); + virtual bool OpenTableFile(PGLOBAL g); + virtual int GetNext(PGLOBAL g); + //virtual int ReadBuffer(PGLOBAL g); + +protected: + int dbfhead(PGLOBAL g, void* buf); + int ScanHeader(PGLOBAL g, int* rln); + + // Members + UNZIPUTL* zutp; + PDOSDEF tdfp; +}; // end of UZDFAM + /***********************************************************************/ /* This is the zip file access method. */ /***********************************************************************/ diff --git a/storage/connect/ha_connect.cc b/storage/connect/ha_connect.cc index b1b44085e53..a5d000d566d 100644 --- a/storage/connect/ha_connect.cc +++ b/storage/connect/ha_connect.cc @@ -5883,7 +5883,7 @@ static int connect_assisted_discovery(handlerton *, THD* thd, } else switch (ttp) { case TAB_DBF: - qrp= DBFColumns(g, dpath, fn, fnc == FNC_COL); + qrp= DBFColumns(g, dpath, fn, topt, fnc == FNC_COL); break; #if defined(ODBC_SUPPORT) case TAB_ODBC: @@ -6734,11 +6734,6 @@ int ha_connect::create(const char *name, TABLE *table_arg, PCSZ m= GetListOption(g, "Mulentries", options->oplist, "NO"); bool mul= *m == '1' || *m == 'Y' || *m == 'y' || !stricmp(m, "ON"); - if (!entry && !mul) { - my_message(ER_UNKNOWN_ERROR, "Missing entry name", MYF(0)); - DBUG_RETURN(HA_ERR_INTERNAL_ERROR); - } // endif entry - strcat(strcat(strcpy(dbpath, "./"), table->s->db.str), "/"); PlugSetPath(zbuf, options->filename, dbpath); PlugSetPath(buf, fn, dbpath); diff --git a/storage/connect/ha_connect.h b/storage/connect/ha_connect.h index 09e8c42b443..8be1fe262b6 100644 --- a/storage/connect/ha_connect.h +++ b/storage/connect/ha_connect.h @@ -144,7 +144,7 @@ typedef class ha_connect *PHC; /** @brief Class definition for the storage engine */ -class ha_connect: public handler +class ha_connect final : public handler { THR_LOCK_DATA lock; ///< MySQL lock CONNECT_SHARE *share; ///< Shared lock info diff --git a/storage/connect/mongo.cpp b/storage/connect/mongo.cpp index 53e2bf377c4..bd3d3b893c1 100644 --- a/storage/connect/mongo.cpp +++ b/storage/connect/mongo.cpp @@ -380,7 +380,6 @@ MGODEF::MGODEF(void) Uri = NULL; Colist = NULL; Filter = NULL; - Level = 0; Base = 0; Version = 0; Pipe = false; diff --git a/storage/connect/mongo.h b/storage/connect/mongo.h index 97c391a217f..dcefac372c0 100644 --- a/storage/connect/mongo.h +++ b/storage/connect/mongo.h @@ -82,7 +82,6 @@ protected: PSZ Wrapname; /* Java wrapper name */ PCSZ Colist; /* Options list */ PCSZ Filter; /* Filtering query */ - int Level; /* Used for catalog table */ int Base; /* The array index base */ int Version; /* The Java driver version */ bool Pipe; /* True is Colist is a pipeline */ diff --git a/storage/connect/plgxml.cpp b/storage/connect/plgxml.cpp index f3d3a010266..8c5cc261899 100644 --- a/storage/connect/plgxml.cpp +++ b/storage/connect/plgxml.cpp @@ -49,7 +49,7 @@ bool XMLDOCUMENT::InitZip(PGLOBAL g, PCSZ entry) { #if defined(ZIP_SUPPORT) bool mul = (entry) ? strchr(entry, '*') || strchr(entry, '?') : false; - zip = new(g) UNZIPUTL(entry, mul); + zip = new(g) UNZIPUTL(entry, NULL, mul); return zip == NULL; #else // !ZIP_SUPPORT sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); diff --git a/storage/connect/tabcmg.cpp b/storage/connect/tabcmg.cpp index b9b7f6e4b60..f2ff721627c 100644 --- a/storage/connect/tabcmg.cpp +++ b/storage/connect/tabcmg.cpp @@ -26,6 +26,8 @@ #include "tabmul.h" #include "filter.h" +PQRYRES MGOColumns(PGLOBAL g, PCSZ db, PCSZ uri, PTOS topt, bool info); + /* -------------------------- Class CMGDISC -------------------------- */ /***********************************************************************/ diff --git a/storage/connect/tabdos.cpp b/storage/connect/tabdos.cpp index 32f549b0f79..4f5a9661369 100644 --- a/storage/connect/tabdos.cpp +++ b/storage/connect/tabdos.cpp @@ -1,11 +1,11 @@ /************* TabDos C++ Program Source Code File (.CPP) **************/ /* PROGRAM NAME: TABDOS */ /* ------------- */ -/* Version 4.9.4 */ +/* Version 4.9.5 */ /* */ /* COPYRIGHT: */ /* ---------- */ -/* (C) Copyright to the author Olivier BERTRAND 1998-2019 */ +/* (C) Copyright to the author Olivier BERTRAND 1998-2020 */ /* */ /* WHAT THIS PROGRAM DOES: */ /* ----------------------- */ @@ -359,7 +359,26 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) /* Allocate table and file processing class of the proper type. */ /* Column blocks will be allocated only when needed. */ /*********************************************************************/ - if (Zipped) { + if (Recfm == RECFM_DBF) { + if (Catfunc == FNC_NO) { + if (Zipped) { + if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) { + txfp = new(g) UZDFAM(this); + } else { + strcpy(g->Message, "Zipped DBF tables are read only"); + return NULL; + } // endif's mode + + } else if (map) + txfp = new(g) DBMFAM(this); + else + txfp = new(g) DBFFAM(this); + + tdbp = new(g) TDBFIX(this, txfp); + } else + tdbp = new(g) TDBDCL(this); // Catfunc should be 'C' + + } else if (Zipped) { #if defined(ZIP_SUPPORT) if (Recfm == RECFM_VAR) { if (mode == MODE_READ || mode == MODE_ANY || mode == MODE_ALTER) { @@ -389,17 +408,6 @@ PTDB DOSDEF::GetTable(PGLOBAL g, MODE mode) sprintf(g->Message, MSG(NO_FEAT_SUPPORT), "ZIP"); return NULL; #endif // !ZIP_SUPPORT - } else if (Recfm == RECFM_DBF) { - if (Catfunc == FNC_NO) { - if (map) - txfp = new(g) DBMFAM(this); - else - txfp = new(g) DBFFAM(this); - - tdbp = new(g) TDBFIX(this, txfp); - } else // Catfunc should be 'C' - tdbp = new(g) TDBDCL(this); - } else if (Recfm != RECFM_VAR && Compressed < 2) { if (Huge) txfp = new(g) BGXFAM(this); diff --git a/storage/connect/tabdos.h b/storage/connect/tabdos.h index 207a1277fce..80dfe63845d 100644 --- a/storage/connect/tabdos.h +++ b/storage/connect/tabdos.h @@ -30,6 +30,7 @@ class DllExport DOSDEF : public TABDEF { /* Logical table description */ friend class DBFBASE; friend class UNZIPUTL; friend class JSONCOL; + friend class TDBDCL; public: // Constructor DOSDEF(void); diff --git a/storage/connect/tabfix.h b/storage/connect/tabfix.h index 53c0af1c422..5f859a2bffe 100644 --- a/storage/connect/tabfix.h +++ b/storage/connect/tabfix.h @@ -98,18 +98,20 @@ class DllExport BINCOL : public DOSCOL { /* This is the class declaration for the DBF columns catalog table. */ /***********************************************************************/ class TDBDCL : public TDBCAT { - public: - // Constructor - TDBDCL(PDOSDEF tdp) : TDBCAT(tdp) {Fn = tdp->GetFn();} +public: + // Constructor + TDBDCL(PDOSDEF tdp) : TDBCAT(tdp) + {Fn = tdp->GetFn(); Topt = tdp->GetTopt();} - protected: +protected: // Specific routines - virtual PQRYRES GetResult(PGLOBAL g) - {return DBFColumns(g, ((PTABDEF)To_Def)->GetPath(), Fn, false);} + virtual PQRYRES GetResult(PGLOBAL g) + {return DBFColumns(g, ((PTABDEF)To_Def)->GetPath(), Fn, Topt, false);} - // Members + // Members PCSZ Fn; // The DBF file (path) name - }; // end of class TDBOCL + PTOS Topt; +}; // end of class TDBOCL #endif // __TABFIX__ diff --git a/storage/connect/tabjson.cpp b/storage/connect/tabjson.cpp index a8e96e2fe8d..692ca9d0258 100644 --- a/storage/connect/tabjson.cpp +++ b/storage/connect/tabjson.cpp @@ -741,6 +741,7 @@ PTDB JSONDEF::GetTable(PGLOBAL g, MODE m) /***********************************************************************/ TDBJSN::TDBJSN(PJDEF tdp, PTXF txfp) : TDBDOS(tdp, txfp) { + G = NULL; Top = NULL; Row = NULL; Val = NULL; diff --git a/storage/connect/tabjson.h b/storage/connect/tabjson.h index 8721a2a5ab7..8c3f1013919 100644 --- a/storage/connect/tabjson.h +++ b/storage/connect/tabjson.h @@ -104,7 +104,6 @@ public: PCSZ Xcol; /* Name of expandable column */ int Limit; /* Limit of multiple values */ int Pretty; /* Depends on file structure */ - int Level; /* Used for catalog table */ int Base; /* The array index base */ bool Strict; /* Strict syntax checking */ char Sep; /* The Jpath separator */ diff --git a/storage/connect/tabzip.cpp b/storage/connect/tabzip.cpp index c026744dba8..d9c13e2a58a 100644 --- a/storage/connect/tabzip.cpp +++ b/storage/connect/tabzip.cpp @@ -23,6 +23,7 @@ #include "filamzip.h" #include "resource.h" // for IDS_COLUMNS #include "tabdos.h" +#include "tabmul.h" #include "tabzip.h" /* -------------------------- Class ZIPDEF --------------------------- */ @@ -41,7 +42,14 @@ bool ZIPDEF::DefineAM(PGLOBAL g, LPCSTR am, int poff) /***********************************************************************/ PTDB ZIPDEF::GetTable(PGLOBAL g, MODE m) { - return new(g) TDBZIP(this); + PTDB tdbp = NULL; + + tdbp = new(g) TDBZIP(this); + + if (Multiple) + tdbp = new(g) TDBMUL(tdbp); + + return tdbp; } // end of GetTable /* ------------------------------------------------------------------- */ @@ -108,7 +116,7 @@ int TDBZIP::Cardinality(PGLOBAL g) Cardinal = (err == UNZ_OK) ? (int)ginfo.number_entry : 0; } else - Cardinal = 0; + Cardinal = 10; // Dummy for multiple tables } // endif Cardinal @@ -187,6 +195,7 @@ int TDBZIP::DeleteDB(PGLOBAL g, int irc) void TDBZIP::CloseDB(PGLOBAL g) { close(); + nexterr = UNZ_OK; // For multiple tables Use = USE_READY; // Just to be clean } // end of CloseDB diff --git a/storage/connect/tabzip.h b/storage/connect/tabzip.h index 32b15281f81..d36e4dc01d0 100644 --- a/storage/connect/tabzip.h +++ b/storage/connect/tabzip.h @@ -48,6 +48,8 @@ public: // Implementation virtual AMT GetAmType(void) {return TYPE_AM_ZIP;} + virtual PCSZ GetFile(PGLOBAL) {return zfn;} + virtual void SetFile(PGLOBAL, PCSZ fn) {zfn = fn;} // Methods virtual PCOL MakeCol(PGLOBAL g, PCOLDEF cdp, PCOL cprec, int n); diff --git a/storage/csv/ha_tina.h b/storage/csv/ha_tina.h index aae535c271e..043183444da 100644 --- a/storage/csv/ha_tina.h +++ b/storage/csv/ha_tina.h @@ -57,7 +57,7 @@ struct tina_set { my_off_t end; }; -class ha_tina: public handler +class ha_tina final : public handler { THR_LOCK_DATA lock; /* MySQL lock */ TINA_SHARE *share; /* Shared lock info */ diff --git a/storage/federatedx/ha_federatedx.h b/storage/federatedx/ha_federatedx.h index 67fe5f8cc22..333028da587 100644 --- a/storage/federatedx/ha_federatedx.h +++ b/storage/federatedx/ha_federatedx.h @@ -260,7 +260,7 @@ public: /* Class definition for the storage engine */ -class ha_federatedx: public handler +class ha_federatedx final : public handler { friend int federatedx_db_init(void *p); diff --git a/storage/heap/ha_heap.h b/storage/heap/ha_heap.h index 50d3c0afb6c..3a41028c719 100644 --- a/storage/heap/ha_heap.h +++ b/storage/heap/ha_heap.h @@ -25,7 +25,7 @@ #include #include "sql_class.h" /* THD */ -class ha_heap: public handler +class ha_heap final : public handler { HP_INFO *file; HP_SHARE *internal_share; diff --git a/storage/innobase/buf/buf0lru.cc b/storage/innobase/buf/buf0lru.cc index 5d9a39b0c9e..26c5850d290 100644 --- a/storage/innobase/buf/buf0lru.cc +++ b/storage/innobase/buf/buf0lru.cc @@ -570,8 +570,9 @@ static bool buf_LRU_free_from_common_LRU_list(bool scan_all) ever being accessed. This gives us a measure of the effectiveness of readahead */ ++buf_pool.stat.n_ra_pages_evicted; - break; } + + break; } } @@ -673,7 +674,7 @@ static void buf_LRU_check_size_of_non_data_objects() + UT_LIST_GET_LEN(buf_pool.LRU)) < buf_pool.curr_size / 3) { - if (!buf_lru_switched_on_innodb_mon) { + if (!buf_lru_switched_on_innodb_mon && srv_monitor_timer) { /* Over 67 % of the buffer pool is occupied by lock heaps or the adaptive hash index. This may be a memory 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 -/** 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::iterator it= + space ? space : rotation_list.begin(); + const sized_ilist::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 we didn't find any space return iops */ + if (state->space) { + state->space->release(); + state->space = NULL; + } + + /* 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::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/fts/fts0fts.cc b/storage/innobase/fts/fts0fts.cc index 145f5c27e5f..b5083b51061 100644 --- a/storage/innobase/fts/fts0fts.cc +++ b/storage/innobase/fts/fts0fts.cc @@ -1092,9 +1092,6 @@ fts_cache_clear( index_cache->doc_stats = NULL; } - mem_heap_free(static_cast(cache->sync_heap->arg)); - cache->sync_heap->arg = NULL; - fts_need_sync = false; cache->total_size = 0; @@ -1102,6 +1099,9 @@ fts_cache_clear( mutex_enter((ib_mutex_t*) &cache->deleted_lock); cache->deleted_doc_ids = NULL; mutex_exit((ib_mutex_t*) &cache->deleted_lock); + + mem_heap_free(static_cast(cache->sync_heap->arg)); + cache->sync_heap->arg = NULL; } /*********************************************************************//** diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 14e551f15fa..0471923fe60 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3815,16 +3815,7 @@ innobase_commit_low( const bool is_wsrep = trx->is_wsrep(); THD* thd = trx->mysql_thd; if (is_wsrep) { -#ifdef WSREP_PROC_INFO - char info[64]; - info[sizeof(info) - 1] = '\0'; - snprintf(info, sizeof(info) - 1, - "innobase_commit_low():trx_commit_for_mysql(%lld)", - (long long) wsrep_thd_trx_seqno(thd)); - tmp = thd_proc_info(thd, info); -#else tmp = thd_proc_info(thd, "innobase_commit_low()"); -#endif /* WSREP_PROC_INFO */ } #endif /* WITH_WSREP */ if (trx_is_started(trx)) { @@ -18353,11 +18344,14 @@ static void innodb_status_output_update(THD*,st_mysql_sys_var*,void*var,const void*save) { - *static_cast(var) = *static_cast(save); - mysql_mutex_unlock(&LOCK_global_system_variables); - /* Wakeup server monitor. */ - srv_monitor_timer_schedule_now(); - mysql_mutex_lock(&LOCK_global_system_variables); + if (srv_monitor_timer) + { + *static_cast(var)= *static_cast(save); + mysql_mutex_unlock(&LOCK_global_system_variables); + /* Wakeup server monitor. */ + srv_monitor_timer_schedule_now(); + mysql_mutex_lock(&LOCK_global_system_variables); + } } /** Update the system variable innodb_encryption_threads. diff --git a/storage/innobase/handler/ha_innodb.h b/storage/innobase/handler/ha_innodb.h index 499b250d880..fc4b2cf84ac 100644 --- a/storage/innobase/handler/ha_innodb.h +++ b/storage/innobase/handler/ha_innodb.h @@ -58,7 +58,7 @@ struct st_handler_tablename const char *tablename; }; /** The class defining a handle to an Innodb table */ -class ha_innobase final: public handler +class ha_innobase final : public handler { public: ha_innobase(handlerton* hton, TABLE_SHARE* table_arg); diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 253675266c9..95f3b52d41e 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -6124,9 +6124,13 @@ prepare_inplace_alter_table_dict( user_table = ctx->new_table; - if (ha_alter_info->inplace_supported == HA_ALTER_INPLACE_INSTANT) { - /* If we promised ALGORITHM=INSTANT capability, we must - retain the original ROW_FORMAT of the table. */ + switch (ha_alter_info->inplace_supported) { + default: break; + case HA_ALTER_INPLACE_INSTANT: + case HA_ALTER_INPLACE_NOCOPY_LOCK: + case HA_ALTER_INPLACE_NOCOPY_NO_LOCK: + /* If we promised ALGORITHM=NOCOPY or ALGORITHM=INSTANT, + we must retain the original ROW_FORMAT of the table. */ flags = (user_table->flags & (DICT_TF_MASK_COMPACT | DICT_TF_MASK_ATOMIC_BLOBS)) | (flags & ~(DICT_TF_MASK_COMPACT 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/lock/lock0wait.cc b/storage/innobase/lock/lock0wait.cc index 6b6e2c04659..7278e0f353d 100644 --- a/storage/innobase/lock/lock0wait.cc +++ b/storage/innobase/lock/lock0wait.cc @@ -195,8 +195,8 @@ wsrep_is_BF_lock_timeout( const trx_t* trx, bool locked = true) { - if (trx->is_wsrep() && wsrep_thd_is_BF(trx->mysql_thd, FALSE) - && trx->error_state != DB_DEADLOCK) { + if (trx->error_state != DB_DEADLOCK && trx->is_wsrep() && + srv_monitor_timer && wsrep_thd_is_BF(trx->mysql_thd, FALSE)) { ib::info() << "WSREP: BF lock wait long for trx:" << ib::hex(trx->id) << " query: " << wsrep_thd_query(trx->mysql_thd); if (!locked) { 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/storage/maria/ha_maria.h b/storage/maria/ha_maria.h index ddf8fc6f229..b2c664a072d 100644 --- a/storage/maria/ha_maria.h +++ b/storage/maria/ha_maria.h @@ -39,6 +39,11 @@ C_MODE_END extern TYPELIB maria_recover_typelib; extern ulonglong maria_recover_options; +/* + In the ha_maria class there are a few virtual methods that are not marked as + 'final'. This is because they are re-defined by the ha_s3 engine. +*/ + class __attribute__((visibility("default"))) ha_maria :public handler { public: @@ -60,99 +65,99 @@ private: public: ha_maria(handlerton *hton, TABLE_SHARE * table_arg); ~ha_maria() {} - handler *clone(const char *name, MEM_ROOT *mem_root); - const char *index_type(uint key_number); - ulonglong table_flags() const + handler *clone(const char *name, MEM_ROOT *mem_root) override final; + const char *index_type(uint key_number) override final; + ulonglong table_flags() const override final { return int_table_flags; } - ulong index_flags(uint inx, uint part, bool all_parts) const; - uint max_supported_keys() const + ulong index_flags(uint inx, uint part, bool all_parts) const override final; + uint max_supported_keys() const override final { return MARIA_MAX_KEY; } - uint max_supported_key_length() const; - uint max_supported_key_part_length() const + uint max_supported_key_length() const override final; + uint max_supported_key_part_length() const override final { return max_supported_key_length(); } - enum row_type get_row_type() const; - void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share); - virtual double scan_time(); + enum row_type get_row_type() const override final; + void change_table_ptr(TABLE *table_arg, TABLE_SHARE *share) override final; + virtual double scan_time() override final; - int open(const char *name, int mode, uint test_if_locked); - int close(void); - int write_row(const uchar * buf); - int update_row(const uchar * old_data, const uchar * new_data); - int delete_row(const uchar * buf); + int open(const char *name, int mode, uint test_if_locked) override; + int close(void) override final; + int write_row(const uchar * buf) override; + int update_row(const uchar * old_data, const uchar * new_data) override; + int delete_row(const uchar * buf) override; int index_read_map(uchar * buf, const uchar * key, key_part_map keypart_map, - enum ha_rkey_function find_flag); + enum ha_rkey_function find_flag) override final; int index_read_idx_map(uchar * buf, uint idx, const uchar * key, key_part_map keypart_map, - enum ha_rkey_function find_flag); + enum ha_rkey_function find_flag) override final; int index_read_last_map(uchar * buf, const uchar * key, - key_part_map keypart_map); - int index_next(uchar * buf); - int index_prev(uchar * buf); - int index_first(uchar * buf); - int index_last(uchar * buf); - int index_next_same(uchar * buf, const uchar * key, uint keylen); - int ft_init() + key_part_map keypart_map) override final; + int index_next(uchar * buf) override final; + int index_prev(uchar * buf) override final; + int index_first(uchar * buf) override final; + int index_last(uchar * buf) override final; + int index_next_same(uchar * buf, const uchar * key, uint keylen) override final; + int ft_init() override final { if (!ft_handler) return 1; ft_handler->please->reinit_search(ft_handler); return 0; } - FT_INFO *ft_init_ext(uint flags, uint inx, String * key); - int ft_read(uchar * buf); - int index_init(uint idx, bool sorted); - int index_end(); - int rnd_init(bool scan); - int rnd_end(void); - int rnd_next(uchar * buf); - int rnd_pos(uchar * buf, uchar * pos); - int remember_rnd_pos(); - int restart_rnd_next(uchar * buf); - void position(const uchar * record); - int info(uint); + FT_INFO *ft_init_ext(uint flags, uint inx, String * key) override final; + int ft_read(uchar * buf) override final; + int index_init(uint idx, bool sorted) override final; + int index_end() override final; + int rnd_init(bool scan) override final; + int rnd_end(void) override final; + int rnd_next(uchar * buf) override final; + int rnd_pos(uchar * buf, uchar * pos) override final; + int remember_rnd_pos() override final; + int restart_rnd_next(uchar * buf) override final; + void position(const uchar * record) override final; + int info(uint) override final; int info(uint, my_bool); - int extra(enum ha_extra_function operation); - int extra_opt(enum ha_extra_function operation, ulong cache_size); - int reset(void); - int external_lock(THD * thd, int lock_type); - int start_stmt(THD *thd, thr_lock_type lock_type); - int delete_all_rows(void); - int disable_indexes(uint mode); - int enable_indexes(uint mode); - int indexes_are_disabled(void); - void start_bulk_insert(ha_rows rows, uint flags); - int end_bulk_insert(); + int extra(enum ha_extra_function operation) override final; + int extra_opt(enum ha_extra_function operation, ulong cache_size) override final; + int reset(void) override final; + int external_lock(THD * thd, int lock_type) override; + int start_stmt(THD *thd, thr_lock_type lock_type) override final; + int delete_all_rows(void) override final; + int disable_indexes(uint mode) override final; + int enable_indexes(uint mode) override final; + int indexes_are_disabled(void) override final; + void start_bulk_insert(ha_rows rows, uint flags) override final; + int end_bulk_insert() override final; ha_rows records_in_range(uint inx, const key_range *min_key, const key_range *max_key, - page_range *pages); - void update_create_info(HA_CREATE_INFO * create_info); - int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info); + page_range *pages) override final; + void update_create_info(HA_CREATE_INFO * create_info) override final; + int create(const char *name, TABLE * form, HA_CREATE_INFO * create_info) override; THR_LOCK_DATA **store_lock(THD * thd, THR_LOCK_DATA ** to, - enum thr_lock_type lock_type); + enum thr_lock_type lock_type) override final; virtual void get_auto_increment(ulonglong offset, ulonglong increment, ulonglong nb_desired_values, ulonglong *first_value, - ulonglong *nb_reserved_values); - int rename_table(const char *from, const char *to); - int delete_table(const char *name); - void drop_table(const char *name); - int check(THD * thd, HA_CHECK_OPT * check_opt); - int analyze(THD * thd, HA_CHECK_OPT * check_opt); - int repair(THD * thd, HA_CHECK_OPT * check_opt); - bool check_and_repair(THD * thd); - bool is_crashed() const; + ulonglong *nb_reserved_values) override final; + int rename_table(const char *from, const char *to) override; + int delete_table(const char *name) override; + void drop_table(const char *name) override; + int check(THD * thd, HA_CHECK_OPT * check_opt) override; + int analyze(THD * thd, HA_CHECK_OPT * check_opt) override; + int repair(THD * thd, HA_CHECK_OPT * check_opt) override; + bool check_and_repair(THD * thd) override final; + bool is_crashed() const override final; bool is_changed() const; - bool auto_repair(int error) const; - int optimize(THD * thd, HA_CHECK_OPT * check_opt); - int assign_to_keycache(THD * thd, HA_CHECK_OPT * check_opt); - int preload_keys(THD * thd, HA_CHECK_OPT * check_opt); - bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes); + bool auto_repair(int error) const override final; + int optimize(THD * thd, HA_CHECK_OPT * check_opt) override final; + int assign_to_keycache(THD * thd, HA_CHECK_OPT * check_opt) override final; + int preload_keys(THD * thd, HA_CHECK_OPT * check_opt) override; + bool check_if_incompatible_data(HA_CREATE_INFO * info, uint table_changes) override final; #ifdef HAVE_QUERY_CACHE my_bool register_query_cache_table(THD *thd, const char *table_key, uint key_length, qc_engine_callback *engine_callback, - ulonglong *engine_data); + ulonglong *engine_data) override final; #endif MARIA_HA *file_ptr(void) { @@ -164,21 +169,21 @@ public: * Multi Range Read interface */ int multi_range_read_init(RANGE_SEQ_IF *seq, void *seq_init_param, - uint n_ranges, uint mode, HANDLER_BUFFER *buf); - int multi_range_read_next(range_id_t *range_info); + uint n_ranges, uint mode, HANDLER_BUFFER *buf) override final; + int multi_range_read_next(range_id_t *range_info) override final; ha_rows multi_range_read_info_const(uint keyno, RANGE_SEQ_IF *seq, void *seq_init_param, uint n_ranges, uint *bufsz, - uint *flags, Cost_estimate *cost); + uint *flags, Cost_estimate *cost) override final; ha_rows multi_range_read_info(uint keyno, uint n_ranges, uint keys, uint key_parts, uint *bufsz, - uint *flags, Cost_estimate *cost); - int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size); + uint *flags, Cost_estimate *cost) override final; + int multi_range_read_explain_info(uint mrr_mode, char *str, size_t size) override final; /* Index condition pushdown implementation */ - Item *idx_cond_push(uint keyno, Item* idx_cond); + Item *idx_cond_push(uint keyno, Item* idx_cond) override final; - int find_unique_row(uchar *record, uint unique_idx); + int find_unique_row(uchar *record, uint unique_idx) override final; /* Following functions are needed by the S3 handler */ virtual S3_INFO *s3_open_args() { return 0; } diff --git a/storage/maria/ha_s3.h b/storage/maria/ha_s3.h index 0777debc8d8..0dd36609a9e 100644 --- a/storage/maria/ha_s3.h +++ b/storage/maria/ha_s3.h @@ -19,7 +19,7 @@ #include "ha_maria.h" -class ha_s3 :public ha_maria +class ha_s3 final :public ha_maria { enum alter_table_op { S3_NO_ALTER, S3_ALTER_TABLE, S3_ADD_PARTITION, S3_ADD_TMP_PARTITION }; @@ -31,52 +31,52 @@ public: ~ha_s3() {} int create(const char *name, TABLE *table_arg, - HA_CREATE_INFO *ha_create_info) final; - int open(const char *name, int mode, uint open_flags) final; - int write_row(const uchar *buf) final; - int update_row(const uchar * old_data, const uchar * new_data) final + HA_CREATE_INFO *ha_create_info); + int open(const char *name, int mode, uint open_flags); + int write_row(const uchar *buf); + int update_row(const uchar * old_data, const uchar * new_data) { DBUG_ENTER("update_row"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); } - int delete_row(const uchar * buf) final + int delete_row(const uchar * buf) { DBUG_ENTER("delete_row"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); } - int check(THD * thd, HA_CHECK_OPT * check_opt) final + int check(THD * thd, HA_CHECK_OPT * check_opt) { DBUG_ENTER("delete_row"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); } - int analyze(THD * thd, HA_CHECK_OPT * check_opt) final + int analyze(THD * thd, HA_CHECK_OPT * check_opt) { DBUG_ENTER("analyze"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); } - int repair(THD * thd, HA_CHECK_OPT * check_opt) final + int repair(THD * thd, HA_CHECK_OPT * check_opt) { DBUG_ENTER("repair"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); } - int preload_keys(THD * thd, HA_CHECK_OPT * check_opt) final + int preload_keys(THD * thd, HA_CHECK_OPT * check_opt) { DBUG_ENTER("preload_keys"); DBUG_RETURN(HA_ERR_WRONG_COMMAND); } - int external_lock(THD * thd, int lock_type) final; + int external_lock(THD * thd, int lock_type); /* drop_table() is only used for internal temporary tables, not applicable for s3 */ - void drop_table(const char *name) final + void drop_table(const char *name) { } - int delete_table(const char *name) final; - int rename_table(const char *from, const char *to) final; + int delete_table(const char *name); + int rename_table(const char *from, const char *to); int discover_check_version() override; int rebind(); - S3_INFO *s3_open_args() final { return open_args; } - void register_handler(MARIA_HA *file) final; + S3_INFO *s3_open_args() { return open_args; } + void register_handler(MARIA_HA *file); }; #endif /* HA_S3_INCLUDED */ diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index 6840dcb76cb..45865709cd3 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -3218,6 +3218,7 @@ static int write_page(MARIA_SHARE *share, File file, args.page= buff; args.pageno= (pgcache_page_no_t) (pos / share->block_size); args.data= (uchar*) share; + args.crypt_buf= NULL; (* share->kfile.pre_write_hook)(&args); res= (int)my_pwrite(file, args.page, block_size, pos, myf_rw); (* share->kfile.post_write_hook)(res, &args); diff --git a/storage/myisam/ha_myisam.h b/storage/myisam/ha_myisam.h index 7729ee2e9e7..3843004cc6e 100644 --- a/storage/myisam/ha_myisam.h +++ b/storage/myisam/ha_myisam.h @@ -41,7 +41,7 @@ C_MODE_START check_result_t index_cond_func_myisam(void *arg); C_MODE_END -class ha_myisam: public handler +class ha_myisam final : public handler { MI_INFO *file; ulonglong int_table_flags; diff --git a/storage/myisammrg/ha_myisammrg.h b/storage/myisammrg/ha_myisammrg.h index d5d62a002aa..6da327ec84b 100644 --- a/storage/myisammrg/ha_myisammrg.h +++ b/storage/myisammrg/ha_myisammrg.h @@ -68,7 +68,7 @@ public: }; -class ha_myisammrg: public handler +class ha_myisammrg final : public handler { MYRG_INFO *file; my_bool is_cloned; /* This instance has been cloned */ diff --git a/storage/myisammrg/myrg_extra.c b/storage/myisammrg/myrg_extra.c index 43dfc18c710..2b3861b9f7f 100644 --- a/storage/myisammrg/myrg_extra.c +++ b/storage/myisammrg/myrg_extra.c @@ -31,7 +31,7 @@ int myrg_extra(MYRG_INFO *info,enum ha_extra_function function, DBUG_PRINT("info",("function: %lu", (ulong) function)); if (!info->children_attached) - DBUG_RETURN(1); + DBUG_RETURN(0); if (function == HA_EXTRA_CACHE) { info->cache_in_use=1; diff --git a/storage/perfschema/ha_perfschema.cc b/storage/perfschema/ha_perfschema.cc index f54d46ce979..da0c2c0813b 100644 --- a/storage/perfschema/ha_perfschema.cc +++ b/storage/perfschema/ha_perfschema.cc @@ -229,7 +229,7 @@ maria_declare_plugin(perfschema) 0x0001, pfs_status_vars, NULL, - "5.6.40", + "5.7.31", MariaDB_PLUGIN_MATURITY_STABLE } maria_declare_plugin_end; diff --git a/storage/perfschema/ha_perfschema.h b/storage/perfschema/ha_perfschema.h index 36ea124056d..690bf8d13a6 100644 --- a/storage/perfschema/ha_perfschema.h +++ b/storage/perfschema/ha_perfschema.h @@ -41,7 +41,7 @@ class PFS_engine_table; extern const char *pfs_engine_name; /** A handler for a PERFORMANCE_SCHEMA table. */ -class ha_perfschema : public handler +class ha_perfschema final : public handler { public: /** diff --git a/storage/sequence/sequence.cc b/storage/sequence/sequence.cc index c8f3e76b873..d7f9014f691 100644 --- a/storage/sequence/sequence.cc +++ b/storage/sequence/sequence.cc @@ -53,7 +53,7 @@ public: } }; -class ha_seq: public handler +class ha_seq final : public handler { private: THR_LOCK_DATA lock; diff --git a/storage/sphinx/ha_sphinx.h b/storage/sphinx/ha_sphinx.h index cb46cb3dcbc..f03e9d8c797 100644 --- a/storage/sphinx/ha_sphinx.h +++ b/storage/sphinx/ha_sphinx.h @@ -30,7 +30,7 @@ struct CSphSEStats; struct CSphSEThreadTable; /// Sphinx SE handler class -class ha_sphinx : public handler +class ha_sphinx final : public handler { protected: THR_LOCK_DATA m_tLock; ///< MySQL lock diff --git a/storage/spider/ha_spider.h b/storage/spider/ha_spider.h index db184baf682..847f7a8e170 100644 --- a/storage/spider/ha_spider.h +++ b/storage/spider/ha_spider.h @@ -49,7 +49,7 @@ struct st_spider_ft_info String *key; }; -class ha_spider: public handler +class ha_spider final : public handler { public: SPIDER_SHARE *share; 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/support-files/mariadb.service.in b/support-files/mariadb.service.in index 07b07b40868..1f7f20fb381 100644 --- a/support-files/mariadb.service.in +++ b/support-files/mariadb.service.in @@ -143,7 +143,7 @@ TimeoutStopSec=900 ## # Number of files limit. previously [mysqld_safe] open-files-limit -LimitNOFILE=16364 +LimitNOFILE=16384 # Maximium core size. previously [mysqld_safe] core-file-size # LimitCore= diff --git a/support-files/mariadb@.service.in b/support-files/mariadb@.service.in index 371b7047eac..79f347ec271 100644 --- a/support-files/mariadb@.service.in +++ b/support-files/mariadb@.service.in @@ -268,7 +268,7 @@ Group=mysql ## # Number of files limit. previously [mysqld_safe] open-files-limit -LimitNOFILE=16364 +LimitNOFILE=16384 # Maximium core size. previously [mysqld_safe] core-file-size # LimitCore= 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);