diff --git a/.gitignore b/.gitignore index bb393224588..ec97b0c8ce5 100644 --- a/.gitignore +++ b/.gitignore @@ -182,6 +182,7 @@ storage/maria/ma_sp_test storage/maria/ma_test1 storage/maria/ma_test2 storage/maria/ma_test3 +storage/maria/test_ma_backup storage/myisam/mi_test1 storage/myisam/mi_test2 storage/myisam/mi_test3 @@ -192,7 +193,9 @@ storage/myisam/myisampack storage/myisam/rt_test storage/myisam/sp_test storage/rocksdb/ldb +storage/rocksdb/myrocks_hotbackup storage/rocksdb/mysql_ldb +storage/rocksdb/myrocks_hotbackup storage/rocksdb/sst_dump storage/rocksdb/rdb_source_revision.h storage/tokudb/PerconaFT/buildheader/db.h @@ -262,6 +265,7 @@ storage/mroonga/vendor/groonga/src/groonga-benchmark storage/mroonga/vendor/groonga/src/suggest/groonga-suggest-create-dataset storage/mroonga/mysql-test/mroonga/storage/r/information_schema_plugins.result storage/mroonga/mysql-test/mroonga/storage/r/variable_version.result +zlib/zconf.h xxx/* yyy/* zzz/* diff --git a/.gitmodules b/.gitmodules index 6419657e501..61d4c06dd4e 100644 --- a/.gitmodules +++ b/.gitmodules @@ -4,3 +4,7 @@ [submodule "storage/rocksdb/rocksdb"] path = storage/rocksdb/rocksdb url = https://github.com/facebook/rocksdb.git +[submodule "wsrep-lib"] + path = wsrep-lib + url = https://github.com/codership/wsrep-lib.git + branch = master diff --git a/.travis.compiler.sh b/.travis.compiler.sh index 7a3b0dbc371..4748c0b9729 100755 --- a/.travis.compiler.sh +++ b/.travis.compiler.sh @@ -22,15 +22,22 @@ if [[ "${TRAVIS_OS_NAME}" == 'linux' ]]; then exclude_modules; if which ccache ; then CMAKE_OPT="${CMAKE_OPT} -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache" - ccache --max-size=1200M fi if [[ "${CXX}" == 'clang++' ]]; then - export CXX CC=${CXX/++/} + if [[ "${CC_VERSION}" == '6' ]]; then + export CXX=${CXX}-${CC_VERSION}.0 + else + export CXX=${CXX}-${CC_VERSION} + fi + export CC=${CXX/++/} + # excess warnings about unused include path + export CFLAGS='-Wno-unused-command-line-argument' + export CXXFLAGS='-Wno-unused-command-line-argument' elif [[ "${CXX}" == 'g++' ]]; then export CXX=g++-${CC_VERSION} export CC=gcc-${CC_VERSION} fi - if [[ ${CC_VERSION} == 6 ]]; then + if [[ ${CC_VERSION} == 7 ]]; then wget http://mirrors.kernel.org/ubuntu/pool/universe/p/percona-xtradb-cluster-galera-2.x/percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb ; ar vx percona-xtradb-cluster-galera-2.x_165-0ubuntu1_amd64.deb tar -xJvf data.tar.xz diff --git a/.travis.yml b/.travis.yml index 95e0796099b..85d02cc4bec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ # travis-ci.org definition sudo: false -dist: trusty +dist: xenial git: depth: 2 @@ -11,13 +11,13 @@ language: cpp os: - linux - osx -osx_image: xcode9.1 +osx_image: xcode10.1 compiler: - gcc - clang cache: - timeout: 300 + timeout: 500 apt: true ccache: true directories: @@ -25,17 +25,24 @@ cache: env: matrix: - - CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main - - CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts - - CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl - - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption - - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb - - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles + - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main + - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts + - CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl + - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption + - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning + - CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles + - CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main matrix: exclude: - os: osx compiler: gcc + - os: osx + compiler: clang + env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main + - os: linux + compiler: clang + env: CC_VERSION=8 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main include: - os: linux compiler: gcc @@ -79,49 +86,51 @@ matrix: - uuid-dev - devscripts - fakeroot + - dh-systemd + - libsystemd-dev + - libzstd-dev + - unixodbc-dev script: - ${CC} --version ; ${CXX} --version - # https://github.com/travis-ci/travis-ci/issues/7062 - /run/shm isn't writable or executable - # in trusty containers - - export MTR_MEM=/tmp - env DEB_BUILD_OPTIONS="parallel=4" debian/autobake-deb.sh; - - ccache --show-stats # Until OSX becomes a bit more stable: MDEV-12435 MDEV-16213 allow_failures: - os: osx compiler: clang - env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl + env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rpl - os: osx compiler: clang - env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main + env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=main - os: osx compiler: clang - env: CC_VERSION=5 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts + env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=archive,optimizer_unfixed_bugs,parts,sys_vars,unit,vcol,innodb,innodb_gis,innodb_zip,innodb_fts - os: osx compiler: clang - env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption + env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=binlog,binlog_encryption,encryption - os: osx compiler: clang - env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb + env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=rocksdb,versioning - os: osx compiler: clang - env: CC_VERSION=6 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles + env: CC_VERSION=7 TYPE=RelWithDebInfo MYSQL_TEST_SUITES=csv,federated,funcs_1,funcs_2,gcol,handler,heap,json,maria,perfschema,plugins,multi_source,roles addons: apt: sources: - ubuntu-toolchain-r-test - - llvm-toolchain-trusty-5.0 - - llvm-toolchain-trusty-6.0 + - llvm-toolchain-xenial-6.0 + - llvm-toolchain-xenial-7 packages: # make sure these include all compilers and all build dependencies (see list above) - - gcc-5 - - g++-5 - gcc-6 - g++-6 - - clang-5.0 - - llvm-5.0-dev + - gcc-7 + - g++-7 + - gcc-8 + - g++-8 - clang-6.0 - llvm-6.0-dev + - clang-7 + - llvm-7-dev - bison - chrpath - cmake @@ -156,14 +165,16 @@ addons: before_install: - if [[ "${TRAVIS_OS_NAME}" == 'osx' ]]; then brew update; - brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre; + brew install gnutls lz4 lzo xz snappy ccache jemalloc curl ossp-uuid pcre zstd; brew link ccache; + export PATH="/usr/local/opt/ccache/libexec:$PATH"; fi before_script: - df -h - ccache --version - ccache --show-stats + - ccache --max-size=5G script: # following modules are disabled after sourcing .travis.compiler.sh: @@ -181,6 +192,8 @@ script: --suite=${MYSQL_TEST_SUITES} --skip-test-list=unstable-tests --skip-test=binlog.binlog_unsafe + +after_script: - ccache --show-stats - df -h diff --git a/BUILD/SETUP.sh b/BUILD/SETUP.sh index e9bede9c746..7e6f0831423 100755 --- a/BUILD/SETUP.sh +++ b/BUILD/SETUP.sh @@ -122,7 +122,8 @@ get_make_parallel_flag # SSL library to use.--with-ssl will select our bundled yaSSL # implementation of SSL. --with-ssl=yes will first try system library # then the boundled one --with-ssl=system will use the system library. -SSL_LIBRARY=--with-ssl=system +# We use bundled by default as this is guaranteed to work with Galera +SSL_LIBRARY=--with-ssl if [ "x$warning_mode" = "xpedantic" ]; then warnings="-W -Wall -ansi -pedantic -Wno-long-long -Wno-unused -D_POSIX_SOURCE" @@ -194,6 +195,8 @@ base_configs="$base_configs --with-extra-charsets=complex " base_configs="$base_configs --enable-thread-safe-client " base_configs="$base_configs --with-big-tables $maintainer_mode" base_configs="$base_configs --with-plugin-aria --with-aria-tmp-tables" +# Following is to get tokudb to work +base_configs="$base_configs --with-jemalloc=NO" if test -d "$path/../cmd-line-utils/readline" then diff --git a/CMakeLists.txt b/CMakeLists.txt index 93146fa94e9..b40a25e52cc 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,5 @@ # Copyright (c) 2006, 2017, Oracle and/or its affiliates. -# Copyright (c) 2008, 2017, MariaDB +# Copyright (c) 2008, 2018, 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 @@ -143,6 +143,7 @@ INCLUDE(misc) INCLUDE(mysql_version) INCLUDE(cpack_source_ignore_files) INCLUDE(install_layout) +INCLUDE(submodules) INCLUDE(wsrep) INCLUDE(cpack_rpm) INCLUDE(cpack_deb) @@ -342,6 +343,8 @@ MYSQL_CHECK_SSL() MYSQL_CHECK_READLINE() SET(MALLOC_LIBRARY "system") +SET(PYTHON_SHEBANG "/usr/bin/env python" CACHE STRING "python shebang") +MARK_AS_ADVANCED(PYTHON_SHEBANG) CHECK_PCRE() @@ -376,7 +379,6 @@ ENDIF() SET (MYSQLD_STATIC_PLUGIN_LIBS "" CACHE INTERNAL "") -INCLUDE(submodules) INCLUDE(mariadb_connector_c) # this does ADD_SUBDIRECTORY(libmariadb) # Add storage engines and plugins. @@ -404,7 +406,7 @@ IF(NOT WITHOUT_SERVER) ENDIF(WITH_EMBEDDED_SERVER) IF(WITH_WSREP) - ADD_SUBDIRECTORY(wsrep) + ADD_SUBDIRECTORY(wsrep-lib) ENDIF() ADD_SUBDIRECTORY(mysql-test) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000000..64af450d29f --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,47 @@ +# How to contribute + +MariaDB Server has a vibrant community contributing in a wide range of areas. There are many valuable ways you can contribute to MariaDB. + +### Engage online with other community members +--- +- [MariaDB on Zulip](https://mariadb.zulipchat.com/) +- [maria-developers mailing list](http://launchpad.net/~maria-developers) +- [maria-discuss mailing list](http://launchpad.net/~maria-discuss) +- [maria-docs mailing list](http://launchpad.net/~maria-docs) +- ircs://chat.freenode.net/maria ([see the IRC page on the Knowledge Base](https://mariadb.com/kb/en/meta/irc-chat-servers-and-zulip-instance/) for help with IRC). +- The MariaDB Foundation and MariaDB Corporation have a presence on Reddit, Twitter, Facebook and Google Plus. See the [social media page](https://mariadb.com/kb/en/mariadb/social-media/). + +### Help document MariaDB +---- +- Contribute towards [documenting MariaDB Server](https://mariadb.com/kb/en/meta/writing-editing-library-articles/) and its ecosystem by adding new content or improving existing content. +- [Translate](https://mariadb.com/kb/en/meta/translating-library-articles/) existing documentation. + +### Help debug and develop MariaDB +----- +- [Report bugs](https://jira.mariadb.org/) +- Test development versions +- Write code to fix bugs or develop new features (see [Getting Started for Developers](https://mariadb.org/getting-started-for-developers)).See also [list of beginner friendly tasks](https://jira.mariadb.org/browse/MDEV-15736?jql=resolution%20%3D%20Unresolved%20AND%20labels%20%3D%20beginner-friendly%20ORDER%20BY%20updated%20DESC) +- Help with code quality control +- Participate in packaging for different Linux distributions + +### Sponsor or donate +--- +You’re very welcome to support MariaDB Server as an individual, or talk your company into joining the Foundation as a sponsoring member. See the [Sponsor page](https://mariadb.org/donate/). + +### Events, meetups and conferences +--- +- Attend an event + - [Events and Conferences page](https://mariadb.org/events/) + - [mariadb.meetup.com](http://mariadb.meetup.com/) + +### Live QA for beginner contributors +---- +MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip and IRC. +From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, anyone can ask any questions they’d like, +and a live developer will be available to assist. +New contributors can ask questions any time, but we will provide immediate feedback during that interval. + +### Additional resources +---- + - [MariaDB Foundation ](https://mariadb.org/) + - [Knowledge Base](https://mariadb.com/kb/en/) diff --git a/CREDITS b/CREDITS index 1788b6304fe..9f03f7fc24e 100644 --- a/CREDITS +++ b/CREDITS @@ -10,9 +10,11 @@ Microsoft https://microsoft.com/ (2017) Tencent Cloud https://cloud.tencent.com (2017) Development Bank of Singapore https://dbs.com (2016) IBM https://www.ibm.com (2017) +Tencent Games http://game.qq.com/ (2018) Visma https://visma.com (2015) -Acronis http://acronis.com (2016) +Acronis https://acronis.com (2016) Nexedi https://www.nexedi.com (2016) +Percona https://www.percona.com (2018) Tencent Game DBA http://tencentdba.com/about (2016) Tencent TDSQL http://tdsql.org (2016) Verkkokauppa.com https://www.verkkokauppa.com (2015) diff --git a/Docs/INSTALL-BINARY b/Docs/INSTALL-BINARY index 7ff33c7051e..2bd6daaea17 100644 --- a/Docs/INSTALL-BINARY +++ b/Docs/INSTALL-BINARY @@ -1,7 +1,9 @@ MariaDB and MySQL have identical install methods. In this document we -describe how to install MariaDB; However all documentation at www.mysql.com -also applies. +describe how to install MariaDB. +The full documentation for installing MariaDB can be found at +https://mariadb.com/kb/en/library/binary-packages/ +However most documentation at www.mysql.com also applies. 2.2. Installing MariaDB from Generic Binaries on Unix/Linux @@ -33,7 +35,8 @@ also applies. If you run into problems and need to file a bug report, please report them to: http://mariadb.org/jira - See the instructions in Section 1.6, "How to Report Bugs or Problems." + See the instructions at + https://mariadb.com/kb/en/mariadb-community-bug-reporting The basic commands that you must execute to install and use a MariaDB binary distribution are: @@ -79,10 +82,9 @@ shell> useradd -g mysql mysql is protected, you must perform the installation as root.) shell> cd /usr/local - 3. Obtain a distribution file using the instructions in Section - 2.1.3, "How to Get MariaDB." For a given release, binary - distributions for all platforms are built from the same MariaDB - source distribution. + 3. Obtain a distribution file using the instructions at + https://mariadb.com/kb/en/library/where-to-download-mariadb/ + The description below describes how to install a MariaDB tar file. 4. Unpack the distribution, which creates the installation directory. Then create a symbolic link to that directory: @@ -149,8 +151,8 @@ shell> chown -R mysql data machine, you can copy support-files/mysql.server to the location where your system has its startup files. More information can be found in the support-files/mysql.server - script itself and in Section 2.13.1.2, "Starting and Stopping - MariaDB Automatically." + script itself and at + https://mariadb.com/kb/en/starting-and-stopping-mariadb-automatically. 10. You can set up new accounts using the bin/mysql_setpermission script if you install the DBI and DBD::mysql Perl modules. See Section 4.6.14, "mysql_setpermission --- Interactively Set @@ -181,8 +183,8 @@ shell> bin/mysqld_safe --user=mysql & find some information in the host_name.err file in the data directory. - More information about mysqld_safe is given in Section 4.3.2, - "mysqld_safe --- MySQL Server Startup Script." + More information about mysqld_safe can be found at + https://mariadb.com/kb/en/mysqld_safe Note diff --git a/Docs/README-wsrep b/Docs/README-wsrep index 6bb329e9396..166901e111f 100644 --- a/Docs/README-wsrep +++ b/Docs/README-wsrep @@ -60,7 +60,7 @@ CONTENTS: Wsrep API developed by Codership Oy is a modern generic (database-agnostic) replication API for transactional databases with a goal to make database replication/logging subsystem completely modular and pluggable. It is developed -with flexibility and completeness in mind to satisfy broad range of modern +with flexibility and completeness in mind to satisfy a broad range of modern replication scenarios. It is equally suitable for synchronous and asynchronous, master-slave and multi-master replication. @@ -87,7 +87,7 @@ Upgrade from mysql-server-5.0 to mysql-wsrep is not supported yet, please upgrade to mysql-server-5.1 first. If you're installing over an existing mysql installation, mysql-server-wsrep -will conflict with mysql-server-5.1 package, so remove it first: +will conflict with the mysql-server-5.1 package, so remove it first: $ sudo apt-get remove mysql-server-5.1 mysql-server-core-5.1 @@ -105,7 +105,7 @@ For example, installation of required packages on Debian Lenny: $ sudo apt-get install psmisc $ sudo apt-get -t lenny-backports install mysql-client-5.1 -Now you should be able to install mysql-wsrep package: +Now you should be able to install the mysql-wsrep package: $ sudo dpkg -i @@ -137,7 +137,7 @@ Additional packages to consider (if not yet installed): * galera (multi-master replication provider, https://launchpad.net/galera) * MySQL-client-community (for connecting to server and mysqldump-based SST) * rsync (for rsync-based SST) - * xtrabackup and nc (for xtrabackup-based SST) + * mariabackup and nc (for mariabackup-based SST) 2.2 Upgrade system tables. @@ -150,7 +150,7 @@ and can be ignored unless specific functionality is needed. 3. FIRST TIME SETUP Unless you're upgrading an already installed mysql-wsrep package, you will need -to set up a few things to prepare server for operation. +to set up a few things to prepare the server for operation. 3.1 CONFIGURATION FILES @@ -162,7 +162,7 @@ to set up a few things to prepare server for operation. * Make sure system-wide my.cnf contains "!includedir /etc/mysql/conf.d/" line. * Edit /etc/mysql/conf.d/wsrep.cnf and set wsrep_provider option by specifying - a path to provider library. If you don't have a provider, leave it as it is. + a path to the provider library. If you don't have a provider, leave it as it is. * When a new node joins the cluster it'll have to receive a state snapshot from one of the peers. This requires a privileged MySQL account with access from @@ -267,7 +267,7 @@ innodb_autoinc_lock_mode=2 This is a required parameter. Without it INSERTs into tables with AUTO_INCREMENT column may fail. autoinc lock modes 0 and 1 can cause unresolved deadlock, and make - system unresponsive. + the system unresponsive. innodb_locks_unsafe_for_binlog=1 This option is required for parallel applying. @@ -299,14 +299,14 @@ wsrep_node_address= results (multiple network interfaces, NAT, etc.) If not explicitly overridden by wsrep_sst_receive_address, the
part will be used to listen for SST (see below). And the whole
[:port] - will be passed to wsrep provider to be used as a base address in its + will be passed to the wsrep provider to be used as a base address in its communications. wsrep_node_name= Human readable node name (for easier log reading only). Defaults to hostname. wsrep_slave_threads=1 - Number of threads dedicated to processing of writesets from other nodes. + The number of threads dedicated to the processing of writesets from other nodes. For best performance should be few per CPU core. wsrep_dbug_option @@ -326,7 +326,7 @@ wsrep_convert_LOCK_to_trx=0 wsrep_retry_autocommit=1 Retry autocommit queries and single statement transactions should they fail certification test. This is analogous to rescheduling an autocommit query - should it go into deadlock with other transactions in the database lock + should it go into a deadlock with other transactions in the database lock manager. wsrep_auto_increment_control=1 @@ -357,7 +357,7 @@ wsrep_OSU_method=TOI is not replicating and may be unable to process replication events (due to table lock). Once DDL operation is complete, the node will catch up and sync with the cluster to become fully operational again. The DDL statement or - its effects are not replicated, so it is user's responsibility to manually + its effects are not replicated, so it is the user's responsibility to manually perform this operation on each of the nodes. wsrep_forced_binlog_format=none @@ -380,14 +380,14 @@ to join or start a cluster. wsrep_sst_method=rsync What method to use to copy database state to a newly joined node. Supported methods: - - mysqldump: slow (except for small datasets) but allows for upgrade - between major MySQL versions or InnoDB features. - - rsync: much faster on large datasets (default). - - rsync_wan: same as rsync but with deltaxfer to minimize network traffic. - - xtrabackup: very fast and practically non-blocking SST method based on - Percona's xtrabackup tool. + - mysqldump: slow (except for small datasets) but allows for upgrade + between major MySQL versions or InnoDB features. + - rsync: much faster on large datasets (default). + - rsync_wan: same as rsync but with deltaxfer to minimize network traffic. + - mariabackup: very fast and practically non-blocking SST method based on + mariabackup tool (enhanced version of Percona's xtrabackup). - (for xtrabackup to work the following settings must be present in my.cnf + (for mariabackup to work the following settings must be present in my.cnf on all nodes: [mysqld] wsrep_sst_auth=root: @@ -412,8 +412,8 @@ wsrep_sst_auth= wsrep_sst_donor= A name of the node which should serve as state snapshot donor. This allows - to control which node will serve state snapshot request. By default the - most suitable node is chosen by wsrep provider. This is the same as given in + controlling which node will serve the state snapshot request. By default the + most suitable node is chosen by the wsrep provider. This is the same as given in wsrep_node_name. @@ -423,7 +423,7 @@ wsrep_sst_donor= for the database. They change the database structure and are non- transactional. - Release 22.3 brings a new method for performing schema upgrades. User can + Release 22.3 brings a new method for performing schema upgrades. A user can now choose whether to use the traditional total order isolation or new rolling schema upgrade method. The OSU method choice is done by global parameter: 'wsrep_OSU_method'. @@ -439,7 +439,7 @@ wsrep_sst_donor= 6.2 Rolling Schema Upgrade (RSU) - Rolling schema upgrade is new DDL processing method, where DDL will be + Rolling schema upgrade is a new DDL processing method, where DDL will be processed locally for the node. The node is disconnected of the replication for the duration of the DDL processing, so that there is only DDL statement processing in the node and it does not block the rest of the cluster. When @@ -468,7 +468,7 @@ wsrep_sst_donor= * LOCK/UNLOCK TABLES cannot be supported in multi-master setups. * lock functions (GET_LOCK(), RELEASE_LOCK()... ) -4) Query log cannot be directed to table. If you enable query logging, +4) Query log cannot be directed to a table. If you enable query logging, you must forward the log to a file: log_output = FILE Use general_log and general_log_file to choose query logging and the @@ -480,7 +480,7 @@ wsrep_sst_donor= 6) Due to cluster level optimistic concurrency control, transaction issuing COMMIT may still be aborted at that stage. There can be two transactions. writing to same rows and committing in separate cluster nodes, and only one - of the them can successfully commit. The failing one will be aborted. + of them can successfully commit. The failing one will be aborted. For cluster level aborts, MySQL/galera cluster gives back deadlock error. code (Error: 1213 SQLSTATE: 40001 (ER_LOCK_DEADLOCK)). diff --git a/Docs/glibc-2.2.5.patch b/Docs/glibc-2.2.5.patch deleted file mode 100644 index ef5d40b6899..00000000000 --- a/Docs/glibc-2.2.5.patch +++ /dev/null @@ -1,137 +0,0 @@ -diff -r -c --exclude='*.info*' glibc-2.2.5.org/linuxthreads/internals.h glibc-2.2.5/linuxthreads/internals.h -*** glibc-2.2.5.org/linuxthreads/internals.h Thu Nov 29 08:44:16 2001 ---- glibc-2.2.5/linuxthreads/internals.h Tue May 21 10:51:53 2002 -*************** -*** 343,349 **** - THREAD_SELF implementation is used, this must be a power of two and - a multiple of PAGE_SIZE. */ - #ifndef STACK_SIZE -! #define STACK_SIZE (2 * 1024 * 1024) - #endif - - /* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */ ---- 343,349 ---- - THREAD_SELF implementation is used, this must be a power of two and - a multiple of PAGE_SIZE. */ - #ifndef STACK_SIZE -! #define STACK_SIZE (128 * 1024) - #endif - - /* The initial size of the thread stack. Must be a multiple of PAGE_SIZE. */ -diff -r -c --exclude='*.info*' glibc-2.2.5.org/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h glibc-2.2.5/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h -*** glibc-2.2.5.org/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Thu Jun 8 21:49:49 2000 ---- glibc-2.2.5/linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h Tue May 21 10:52:58 2002 -*************** -*** 64,70 **** - /* The number of threads per process. */ - #define _POSIX_THREAD_THREADS_MAX 64 - /* This is the value this implementation supports. */ -! #define PTHREAD_THREADS_MAX 1024 - - /* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ ---- 64,70 ---- - /* The number of threads per process. */ - #define _POSIX_THREAD_THREADS_MAX 64 - /* This is the value this implementation supports. */ -! #define PTHREAD_THREADS_MAX 4096 - - /* Maximum amount by which a process can descrease its asynchronous I/O - priority level. */ -diff -r -c --exclude='*.info*' glibc-2.2.5.org/nss/nsswitch.c glibc-2.2.5/nss/nsswitch.c -*** glibc-2.2.5.org/nss/nsswitch.c Tue Jul 17 10:21:36 2001 ---- glibc-2.2.5/nss/nsswitch.c Tue May 21 10:59:55 2002 -*************** -*** 496,501 **** ---- 496,502 ---- - { - service_user *new_service; - const char *name; -+ int name_alloc_len; - - while (isspace (line[0])) - ++line; -*************** -*** 510,522 **** - if (name == line) - return result; - - - new_service = (service_user *) malloc (sizeof (service_user) -! + (line - name + 1)); - if (new_service == NULL) - return result; - -! *((char *) __mempcpy (new_service->name, name, line - name)) = '\0'; - - /* Set default actions. */ - new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE; ---- 511,534 ---- - if (name == line) - return result; - -+ name_alloc_len = line - name + 1; -+ -+ #ifdef DO_STATIC_NSS -+ if (!((name_alloc_len == 6 && strncmp(name,"files",5) == 0) || -+ (name_alloc_len == 4 && strncmp(name,"dns",3) == 0))) -+ { -+ name = (char*) "files"; -+ name_alloc_len = 6; -+ } -+ #endif - - new_service = (service_user *) malloc (sizeof (service_user) -! + name_alloc_len); - if (new_service == NULL) - return result; - -! *((char *) __mempcpy (new_service->name, name, name_alloc_len-1)) = '\0'; -! - - /* Set default actions. */ - new_service->actions[2 + NSS_STATUS_TRYAGAIN] = NSS_ACTION_CONTINUE; -diff -r -c --exclude='*.info*' glibc-2.2.5.org/time/Makefile glibc-2.2.5/time/Makefile -*** glibc-2.2.5.org/time/Makefile Fri Aug 10 01:59:41 2001 ---- glibc-2.2.5/time/Makefile Tue May 21 11:01:11 2002 -*************** -*** 37,44 **** - - include ../Rules - -! tz-cflags = -DTZDIR='"$(zonedir)"' \ -! -DTZDEFAULT='"$(localtime-file)"' \ - -DTZDEFRULES='"$(posixrules-file)"' - - CFLAGS-tzfile.c = $(tz-cflags) ---- 37,44 ---- - - include ../Rules - -! tz-cflags = -DTZDIR='"/usr/share/zoneinfo/"' \ -! -DTZDEFAULT='"/etc/localtime"' \ - -DTZDEFRULES='"$(posixrules-file)"' - - CFLAGS-tzfile.c = $(tz-cflags) -diff -r -c --exclude='*.info*' glibc-2.2.5.org/timezone/Makefile glibc-2.2.5/timezone/Makefile -*** glibc-2.2.5.org/timezone/Makefile Thu Aug 30 00:45:25 2001 ---- glibc-2.2.5/timezone/Makefile Tue May 21 11:01:57 2002 -*************** -*** 159,166 **** - - $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o - -! tz-cflags = -DTZDIR='"$(zonedir)"' \ -! -DTZDEFAULT='"$(localtime-file)"' \ - -DTZDEFRULES='"$(posixrules-file)"' \ - -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone - ---- 159,166 ---- - - $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o - -! tz-cflags = -DTZDIR='"/usr/share/zoneinfo/"' \ -! -DTZDEFAULT='"/etc/localtime"' \ - -DTZDEFRULES='"$(posixrules-file)"' \ - -DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone - diff --git a/Docs/linuxthreads.txt b/Docs/linuxthreads.txt deleted file mode 100644 index 552415fe794..00000000000 --- a/Docs/linuxthreads.txt +++ /dev/null @@ -1,19 +0,0 @@ -[Note this information is obsolete] - -Notes on compiling glibc for the standard MySQL binary: - - - make sure you have gcc 2.95 and gmake 3.79 or newer - - wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-2.2.5.tar.gz - - wget ftp://ftp.gnu.org/pub/gnu/glibc/glibc-linuxthreads-2.2.5.tar.gz - - tar zxvf glibc-2.2.5.tar.gz ; cd glibc-2.2.5 ; - tar zxvf ../glibc-linuxthreads-2.2.5.tar.gz - - patch -p1 < ~/bk/mysql/Docs/glibc-2.2.5.patch - - ./configure --prefix=/usr/local/mysql-glibc --enable-static-nss \ - --disable-shared --enable-add-ons=linuxthreads --target=i386 \ - --host=i386-pc-linux-gnu - - make - - possible problems - if compiler is not properly installed, one can get - "cpp: too many input" files error - easiest way to solve - SUSE RPM for gcc - 2.95 - - surun make install - - To build the binaries, run Build-tools/Do-linux-build diff --git a/Docs/sp-imp-spec.txt b/Docs/sp-imp-spec.txt deleted file mode 100644 index 52389ea50f4..00000000000 --- a/Docs/sp-imp-spec.txt +++ /dev/null @@ -1,1100 +0,0 @@ - - Implementation specification for Stored Procedures - ================================================== - - -- How parsing and execution of queries work - - In order to execute a query, the function sql_parse.cc:mysql_parse() is - called, which in turn calls the parser (yyparse()) with an updated Lex - structure as the result. mysql_parse() then calls mysql_execute_command() - which dispatches on the command code (in Lex) to the corresponding code for - executing that particular query. - - There are three structures involved in the execution of a query which are of - interest to the stored procedure implementation: - - - Lex (mentioned above) is the "compiled" query, that is the output from - the parser and what is then interpreted to do the actual work. - It constains an enum value (sql_command) which is the query type, and - all the data collected by the parser needed for the execution (table - names, fields, values, etc). - - THD is the "run-time" state of a connection, containing all that is - needed for a particular client connection, and, among other things, the - Lex structure currently being executed. - - Item_*: During parsing, all data is translated into "items", objects of - the subclasses of "Item", such as Item_int, Item_real, Item_string, etc, - for basic datatypes, and also various more specialized Item types for - expressions to be evaluated (Item_func objects). - - -- How to fit Stored Procedure into this scheme - - - An overview of the classes and files for stored procedures - (More detailed APIs at the end of this file) - - - class sp_head (sp_head.{cc,h}) - This contains, among other things, an array of "instructions" and the - method for executing the procedure. - - - class sp_pcontext (sp_pcontext.{cc,h} - This is the parse context for the procedure. It's primarily used during - parsing to keep track of local parameters, variables and labels, but - it's also used at CALL time do find parameters mode (IN, OUT or INOUT) - and type when setting up the runtime context. - - - class sp_instr (sp_head.{cc,h}) - This is the base class for "instructions", that is, what is generated - by the parser. It turns out that we only need a minimum of 5 different - sub classes: - - sp_instr_stmt - Execute a statement. This is the "call-out" any normal SQL statement, - like a SELECT, INSERT etc. It contains the Lex structure for the - statement in question. - - sp_instr_set - Set the value of a local variable (or parameter) - - sp_instr_jump - An unconditional jump. - - sp_instr_jump_if_not - Jump if condition is not true. It turns out that the negative test is - most convenient when generating the code for the flow control - constructs. - - sp_instr_freturn - Return a value from a FUNCTION and exit. - For condition HANDLERs some special instructions are also needed, see - that section below. - - - class sp_rcontext (sp_rcontext.h) - This is the runtime context in the THD structure. - It contains an array of items, the parameters and local variables for - the currently executing stored procedure. - This means that variable value lookup is in runtime is constant time, - a simple index operation. - - - class Item_splocal (Item.{cc,h}) - This is a subclass of Item. Its sole purpose is to hide the fact that - the real Item is actually in the current frame (runtime context). - It contains the frame offset and defers all methods to the real Item - in the frame. This is what the parser generates for local variables. - - - Utility functions (sp.{cc,h}) - This contains functions for creating, dropping and finding a stored - procedure in the mysql.proc table (or the internal cache). - - - - Parsing CREATE PROCEDURE ... - - When parsing a CREATE PROCEDURE the parser first initializes the - sphead and spcont (runtime context) fields in the Lex. - The sql_command code for the result of parsing a is - SQLCOM_CREATE_PROCEDURE. - - The parsing of the parameter list and body is relatively - straight-forward: - - - Parameters: - name, type and mode (IN/OUT/INOUT) is pushed to spcont - - Declared local variables: - Same as parameters (mode is then IN) - - Local Variable references: - If an identifier is found in in spcont, an Item_splocal is created - with the variable's frame index, otherwise an Item_field or Item_ref - is created (as before). - - Statements: - The Lex in THD is replaced by a new Lex structure and the statement, - is parsed as usual. A sp_instr_stmt is created, containing the new - Lex, and added to the instructions in sphead. - Afterwards, the procedure's Lex is restored in THD. - - SET var: - Setting a local variable generates a sp_instr_set instruction, - containing the variable's frame offset, the expression (an Item), - and the type. - - Flow control: - Flow control constructs like, IF, WHILE, etc, generate a conditional - and unconditional jumps in the "obvious" way, but a few notes may - be required: - - Forward jumps: When jumping forward, the exact destination is not - known at the time of the creation of the jump instruction. The - sphead therefore contains list of instruction-label pairs for - each forward reference. When the position later is known, the - instructions in the list are updated with the correct location. - - Loop constructs have optional labels. If a loop doesn't have a - label, an anonymous label is generated to simplify the parsing. - - There are two types of CASE. The "simple" case is implemented - with an anonymous variable bound to the value to be tested. - - - - A simple example - - Parsing the procedure: - - create procedure a(s char(16)) - begin - declare x int; - set x = 3; - while x > 0 do - set x = x-1; - insert into db.tab values (x, s); - end while; - end - - would generate the following structures: - ______ - thd: | | _________ - | lex -+--->| | ___________________ - |______| | spcont -+------------------->| "s",in,char(16):0 | - | sphead -+------ |("x",in,int :1)| - |_________| | |___________________| - ____V__________________ - | m_name: "a" | - | m_defstr: "create ..."| - | m_instr: ... | - |_______________________| - - Note that the contents of the spcont is changing during the parsing, - at all times reflecting the state of the would-be runtime frame. - The m_instr is an array of instructions: - - Pos. Instruction - 0 sp_instr_set(1, '3') - 1 sp_instr_jump_if_not(5, 'x>0') - 2 sp_instr_set(1, 'x-1') - 3 sp_instr_stmt('insert into ...') - 4 sp_instr_jump(1) - 5 - - Here, '3', 'x>0', etc, represent the Items or Lex for the respective - expressions or statements. - - - - Parsing CREATE FUNCTION ... - - Creating a functions is essentially the same thing as for a PROCEDURE, - with the addition that a FUNCTION has a return type and a RETURN - statement, but no OUT or INOUT parameters. - - The main difference during parsing is that we store the result type - in the sp_head. However, there are big differences when it comes to - invoking a FUNCTION. (See below.) - - - - Storing, caching, dropping... - - As seen above, the entired definition string, including the "CREATE - PROCEDURE" (or "FUNCTION") is kept. The procedure definition string is - stored in the table mysql.proc with the name and type as the key, the - type being one of the enum ("procedure","function"). - - A PROCEDURE is just stored in the mysql.proc table. A FUNCTION has an - additional requirement. They will be called in expressions with the same - syntax as UDFs, so UDFs and stored FUNCTIONs share the namespace. Thus, - we must make sure that we do not have UDFs and FUNCTIONs with the same - name (even if they are stored in different places). - - This means that we can reparse the procedure as many time as we want. - The first time, the resulting Lex is used to store the procedure in - the database (using the function sp.c:sp_create_procedure()). - - The simplest way would be to just leave it at that, and re-read the - procedure from the database each time it is called. (And in fact, that's - the way the earliest implementation will work.) - However, this is not very efficient, and we can do better. The full - implementation should work like this: - - 1) Upon creation time, parse and store the procedure. Note that we still - need to parse it to catch syntax errors, but we can't check if called - procedures exists for instance. - 2) Upon first CALL, read from the database, parse it, and cache the - resulting Lex in memory. This time we can do more error checking. - 3) Upon subsequent CALLs, use the cached Lex. - - Note that this implies that the Lex structure with its sphead must be - reentrant, that is, reusable and shareable between different threads - and calls. The runtime state for a procedure is kept in the sp_rcontext - in THD. - - The mechanisms of storing, finding, and dropping procedures are - encapsulated in the files sp.{cc,h}. - - - - CALLing a procedure - - A CALL is parsed just like any statement. The resulting Lex has the - sql_command SQLCOM_CALL, the procedure's name and the parameters are - pushed to the Lex' value_list. - - sql_parse.cc:mysql_execute_command() then uses sp.cc:sp_find() to - get the sp_head for the procedure (which may have been read from the - database or fetched from the in-memory cache) and calls the sp_head's - method execute(). - Note: It's important that substatements called by the procedure do not - do send_ok(). Fortunately, there is a flag in THD->net to disable - this during CALLs. If a substatement fails, it will however send - an error back to the client, so the CALL mechanism must return - immediately and without sending an error. - - The sp_head::execute() method works as follows: - - 1) Keep a pointer to the old runtime context in THD (if any) - 2) Create a new runtime context. The information about the required size - is in sp_head's parse time context. - 3) Push each parameter (from the CALL's Lex->value_list) to the new - context. If it's an OUT or INOUT parameter, the parameter's offset - in the caller's frame is set in the new context as well. - 4) For each instruction, call its execute() method. - The result is a pointer to the next instruction to execute (or NULL) - if an error occurred. - 5) On success, set the new values of the OUT and INOUT parameters in - the caller's frame. - - - USE database - - Before executing the instruction we also keeps the current default - database (if any). If this was changed during execution (i.e. a "USE" - statement has been executed), we restore the current database to the - original. - - This is the most useful way to handle USE in procedures. If we didn't, - the caller would find himself in a different database after calling - a function, which can be confusing. - Restoring the database also gives full freedom to the procedure writer: - - It's possible to write "general" procedures that are independent of - the actual database name. - - It's possible to write procedures that work on a particular database - by calling USE, without having to use fully qualified table names - everywhere (which doesn't help if you want to call other, "general", - procedures anyway). - - - Evaluating Items - - There are three occasions where we need to evaluate an expression: - - - When SETing a variable - - When CALLing a procedure - - When testing an expression for a branch (in IF, WHILE, etc) - - The semantics in stored procedures is "call-by-value", so we have to - evaluate any "func" Items at the point of the CALL or SET, otherwise - we would get a kind of "lazy" evaluation with unexpected results with - respect to OUT parameters for instance. - For this the support function, sp_head.cc:eval_func_item() is needed. - - - - Calling a FUNCTION - - Functions don't have an explicit call keyword like procedures. Instead, - they appear in expressions with the conventional syntax "fun(arg, ...)". - The problem is that we already have User Defined Functions (UDFs) which - are called the same way. A UDF is detected by the lexical analyzer (not - the parser!), in the find_keyword() function, and returns a UDF_*_FUNC - or UDA_*_SUM token with the udf_func object as the yylval. - - So, stored functions must be handled in a simpilar way, and as a - consequence, UDFs and functions must not have the same name. - - - Detecting and parsing a FUNCTION invocation - - The existence of UDFs are checked during the lexical analysis (in - sql_lex.cc:find_keyword()). This has the drawback that they must - exist before they are referred to, which was ok before SPs existed, - but then it becomes a problem. The first implementation of SP FUNCTIONs - will work the same way, but this should be fixed a.s.a.p. (This will - required some reworking of the way UDFs are handled, which is why it's - not done from the start.) - For the time being, a FUNCTION is detected the same way, and returns - the token SP_FUNC. During the parsing we only check for the *existence* - of the function, we don't parse it, since wa can't call the parser - recursively. - - When encountering a SP_FUNC with parameters in the expression parser, - an instance of the new Item_func_sp class is created. Unlike UDFs, we - don't have different classes for different return types, since we at - this point don't know the type. - - - Collecting FUNCTIONs to invoke - - A FUNCTION differs from a PROCEDURE in one important aspect: Whereas a - PROCEDURE is CALLed as statement by itself, a FUNCTION is invoked - "on-the-fly" during the execution of *another* statement. - This makes things a lot more complicated compared to CALL: - - We can't read and parse the FUNCTION from the mysql.proc table at the - point of invocation; the server requires that all tables used are - opened and locked at the beginning of the query execution. - One "obvious" solution would be to simply push "mysql.proc" to the list - of tables used by the query, but this implies a "join" with this table - if the query is a select, so it doesn't work (and we can't exclude this - table easily; since a privileged used might in fact want to search - the proc table). - Another solution would of course be to allow the opening and closing - of the mysql.proc table during a query execution, but this it not - possible at the present. - - So, the solution is to collect the names of the referred FUNCTIONs during - parsing in the lex. - Then, before doing anything else in mysql_execute_command(), read all - functions from the database an keep them in the THD, where the function - sp_find_function() can find them during the execution. - Note: Even with an in-memory cache, we must still make sure that the - functions are indeed read and cached at this point. - The code that read and cache functions from the database must also be - invoked recursively for each read FUNCTION to make sure we have *all* the - functions we need. - - - - Parsing DROP PROCEDURE/FUNCTION - - The procedure name is pushed to Lex->value_list. - The sql_command code for the result of parsing a is - SQLCOM_DROP_PROCEDURE/SQLCOM_DROP_FUNCTION. - - Dropping is done by simply getting the procedure with the sp_find() - function and calling sp_drop() (both in sp.{cc,h}). - - DROP PROCEDURE/FUNCTION also supports the non-standard "IF EXISTS", - analogous to other DROP statements in MySQL. - - - - Condition and Handlers - - Condition names are lexical entities and are kept in the parser context - just like variables. But, condition are just "aliases" for SQLSTATE - strings, or mysqld error codes (which is a non-standard extension in - MySQL), and are only used during parsing. - - Handlers comes in three types, CONTINUE, EXIT and UNDO. The latter is - like an EXIT handler with an implicit rollback, and is currently not - implemented. - The EXIT handler jumps to the end of its BEGIN-END block when finished. - The CONTINUE handler returns to the statement following that which - invoked the handler. - - The handlers in effect at any point is part of each thread's runtime - state, so we need to push and pop handlers in the sp_rcontext during - execution. We use special instructions for this: - - sp_instr_hpush_jump - Push a handler. The instruction contains the necessary information, - like which conditions we handle and the location of the handler. - The jump takes us to the location after the handler code. - - sp_instr_hpop - Pop the handlers of the current frame (which we are just leaving). - - It might seems strange to jump past the handlers like that, but there's - no extra cost in doing this, and for technical reasons it's easiest for - the parser to generate the handler instructions when they occur in the - source. - - When an error occurs, one of the error routines is called and an error - message is normally sent back to the client immediately. - Catching a condition must be done in these error routines (there are - quite a few) to prevent them from doing this. We do this by calling - a method in the THD's sp_rcontext (if there is one). If a handler is - found, this is recorded in the context and the routine returns without - sending the error message. - The execution loop (sp_head::execute()) checks for this after each - statement and invokes the handler that has been found. If several - errors or warnings occurs during one statement, only the first is - caught, the rest are ignored. - - Invoking and returning from a handler is trivial in the EXIT case. - We simply jump to it, and it will have an sp_instr_jump as its last - instruction. - - Calling and returning from a CONTINUE handler poses some special - problems. Since we need to return to the point after its invocation, - we push the return location on a stack in the sp_rcontext (this is - done by the execution loop). The handler then ends with a special - instruction, sp_instr_hreturn, which returns to this location. - - CONTINUE handlers have one additional problem: They are parsed at - the lexical level where they occur, so variable offsets will assume - that it's actually called at that level. However, a handler might be - invoked from a sub-block where additional local variables have been - declared, which will then share the location of any local variables - in the handler itself. So, when calling a CONTINUE handler, we need - to save any local variables above the handler's frame offset, and - restore them upon return. (This is not a problem for EXIT handlers, - since they will leave the block anyway.) - This is taken care of by the execution loop and the sp_instr_hreturn - instruction. - - - Examples: - - - EXIT handler - begin - declare x int default 0; - - begin - declare exit handler for 'XXXXX' set x = 1; - - (statement1); - (statement2); - end; - (statement3); - end - - Pos. Instruction - 0 sp_instr_set(0, '0') - 1 sp_instr_hpush_jump(4, 1) # location and frame size - 2 sp_instr_set(0, '1') - 3 sp_instr_jump(6) - 4 sp_instr_stmt('statement1') - 5 sp_instr_stmt('statement2') - 6 sp_instr_hpop(1) - 7 sp_instr_stmt('statement3') - - - CONTINUE handler - create procedure hndlr1(val int) - begin - declare x int default 0; - declare foo condition for 1146; - declare continue handler for foo set x = 1; - - insert into t3 values ("hndlr1", val); # Non-existing table? - if x>0 then - insert into t1 values ("hndlr1", val); # This instead then - end if; - end| - - Pos. Instruction - 0 sp_instr_set(1, '0') - 1 sp_instr_hpush_jump(4, 2) - 2 sp_instr_set(1, '1') - 3 sp_instr_hreturn(2) # frame size - 4 sp_instr_stmt('insert ... t3 ...') - 5 sp_instr_jump_if_not(7, 'x>0') - 6 sp_instr_stmt('insert ... t1 ...') - 7 sp_instr_hpop(2) - - - - Cursors - - For stored procedures to be really useful, you want to have cursors. - MySQL doesn't yet have "real" cursor support (with API and ODBC support, - allowing updating, arbitrary scrolling, etc), but a simple asensitive, - non-scrolling, read-only cursor can be implemented in SPs using the - class Protocol_cursor. - This class intecepts the creation and sending of results sets and instead - stores it in-memory, as MYSQL_FIELDS and MYSQL_ROWS (as in the client API). - - To support this, we need the usual name binding support in sp_pcontext - (similar to variables and conditions) to keep track on declared cursor - names, and a corresponding run-time mechanism in sp_rcontext. - Cursors are lexically scoped like everything with a body or BEGIN/END - block, so they are pushed and poped as usual (see conditions and variables - above). - The basic operations on a cursor are OPEN, FETCH and CLOSE, which will - each have a corresponding instruction. In addition, we need instructions - to push a new cursor (this will encapsulate the LEX of the SELECT statement - of the cursor), and a pop instruction: - - sp_instr_cpush - Push a cursor to the sp_rcontext. This instruction contains the LEX - for the select statement - - sp_instr_cpop - Pop a number of cursors from the sp_rcontext. - - sp_instr_copen - Open a cursor: This will execute the select and get the result set - in a sepeate memroot. - - sp_instr_cfetch - Fetch the next row from the in-memory result set. The instruction - contains a list of the variables (frame offsets) to set. - - sp_instr_cclose - Free the result set. - - A cursor is a separate class, sp_cursor (defined in sp_rcontex.h) which - encapsulates the basic operations used by the above instructions. - This class contains the LEX, Protocol_cursor object, and its memroot, - as well as the cursor's current state. - Compiling and executing is fairly straight-forward. sp_instr_copen is - a subclass of sp_instr_stmt and uses its mechanism to execute a - substatement. - - - Example: - - begin - declare x int; - declare c cursor for select a from t1; - - open c; - fetch c into x; - close c; - end - - Pos. Instruction - 0 sp_instr_cpush('select a from ...') - 1 sp_instr_copen(0) # The 0'th cursor - 2 sp_instr_cfetch(0) # Contains the variable list - 3 sp_instr_cclose(0) - 4 sp_instr_cpop(1) - - - - - The SP cache - - There are two ways to cache SPs: - - 1) one global cache, share by all threads/connections, - 2) one cache per thread. - - There are pros and cons with both methods: - - 1) Pros: Save memory, each SP only read from table once, - Cons: Needs locking (= serialization at access), requires thread-safe - data structures, - 2) Pros: Fast, no locking required (almost), limited thread-safe - requirement, - Cons: Uses more memory, each SP read from table once per thread. - - Unfortunately, we cannot use alternative 1 for the time being, as most - of the data structures to be cached (lex and items) are not reentrant - and thread-safe. (Things are modified at execution, we have THD pointers - stored everywhere, etc.) - This leaves us with alternative 2, one cache per thread; or actually - two, since we keep FUNCTIONs and PROCEDUREs in separate caches. - This is not that terrible; the only case when it will perform - significantly worse than a global cache is when we have an application - where new threads are connecting, calling a procedure, and disconnecting, - over and over again. - - The cache implementation itself is simple and straightforward, a hashtable - wrapped in a class and a C API (see APIs below). - - There is however one issue with multiple caches: dropping and altering - procedures. Normally, this should be a very rare event in a running - system; it's typically something you do during development and testing, - so it's not unthinkable that we would simply ignore the issue and let - any threads running with a cached version of an SP keep doing so until - its disconnected. - But assuming we want to keep the caches consistent with respect to drop - and alter, it can be done: - - 1) A global counter is needed, initialized to 0 at start. - 2) At each DROP or ALTER, increase the counter by one. - 3) Each cache has its own copy of the counter, copied at the last read. - 4) When looking up a name in the cache, first check if the global counter - is larger than the local copy. - If so, clear the cache and return "not found", and update the local - counter; otherwise, lookup as usual. - - This minimizes the cost to a single brief lock for the access of an - integer when operating normally. Only in the event of an actual drop or - alter, is the cache cleared. This may seem to be drastic, but since we - assume that this is a rare event, it's not a problem. - It would of course be possible to have a much more fine-grained solution, - keeping track of each SP, but the overhead of doing so is not worth the - effort. - - - - Class and function APIs - This is an outline of the key types. Some types and other details - in the actual files have been omitted for readability. - - - The parser context: sp_pcontext.h - - typedef enum - { - sp_param_in, - sp_param_out, - sp_param_inout - } sp_param_mode_t; - - typedef struct - { - LEX_STRING name; - enum enum_field_types type; - sp_param_mode_t mode; - uint offset; // Offset in current frame - my_bool isset; - } sp_pvar_t; - - typedef struct sp_cond_type - { - enum { number, state, warning, notfound, exception } type; - char sqlstate[6]; - uint mysqlerr; - } sp_cond_type_t; - - class sp_pcontext - { - sp_pcontext(); - - // Return the maximum frame size - uint max_framesize(); - - // Return the current frame size - uint current_framesize(); - - // Return the number of parameters - uint params(); - - // Set the number of parameters to the current frame size - void set_params(); - - // Set type of the variable at offset 'i' in the frame - void set_type(uint i, enum enum_field_types type); - - // Mark the i:th variable to "set" (i.e. having a value) with - // 'val' true. - void set_isset(uint i, my_bool val); - - // Push the variable 'name' to the frame. - void push_var(LEX_STRING *name, - enum enum_field_types type, sp_param_mode_t mode); - - // Pop 'num' variables from the frame. - void pop_var(uint num = 1); - - // Find variable by name - sp_pvar_t *find_pvar(LEX_STRING *name); - - // Find variable by index - sp_pvar_t *find_pvar(uint i); - - // Push label 'name' of instruction index 'ip' to the label context - sp_label_t *push_label(char *name, uint ip); - - // Find label 'name' in the context - sp_label_t *find_label(char *name); - - // Return the last pushed label - sp_label_t *last_label(); - - // Return and remove the last pushed label. - sp_label_t *pop_label(); - - // Push a condition to the context - void push_cond(LEX_STRING *name, sp_cond_type_t *val); - - // Pop a 'num' condition from the context - void pop_cond(uint num); - - // Find a condition in the context - sp_cond_type_t *find_cond(LEX_STRING *name); - - // Increase the handler count - void add_handler(); - - // Returns the handler count - uint handlers(); - - // Push a cursor - void push_cursor(LEX_STRING *name); - - // Find a cursor - my_bool find_cursor(LEX_STRING *name, uint *poff); - - // Pop 'num' cursors - void pop_cursor(uint num); - - // Return the number of cursors - uint cursors(); - } - - - - The run-time context (call frame): sp_rcontext.h - - #define SP_HANDLER_NONE 0 - #define SP_HANDLER_EXIT 1 - #define SP_HANDLER_CONTINUE 2 - #define SP_HANDLER_UNDO 3 - - typedef struct - { - struct sp_cond_type *cond; - uint handler; // Location of handler - int type; - uint foffset; // Frame offset for the handlers declare level - } sp_handler_t; - - class sp_rcontext - { - // 'fsize' is the max size of the context, 'hmax' the number of handlers, - // 'cmax' the number of cursors - sp_rcontext(uint fsize, uint hmax, , uint cmax); - - // Push value (parameter) 'i' to the frame - void push_item(Item *i); - - // Set slot 'idx' to value 'i' - void set_item(uint idx, Item *i); - - // Return the item in slot 'idx' - Item *get_item(uint idx); - - // Set the "out" index 'oidx' for slot 'idx. If it's an IN slot, - // use 'oidx' -1. - void set_oindex(uint idx, int oidx); - - // Return the "out" index for slot 'idx' - int get_oindex(uint idx); - - // Set the FUNCTION result - void set_result(Item *i); - - // Get the FUNCTION result - Item *get_result(); - - // Push handler at location 'h' for condition 'cond'. 'f' is the - // current variable frame size. - void push_handler(sp_cond_type_t *cond, uint h, int type, uint f); - - // Pop 'count' handlers - void pop_handlers(uint count); - - // Find a handler for this error. This sets the state for a found - // handler in the context. If called repeatedly without clearing, - // only the first call's state is kept. - int find_handler(uint sql_errno); - - // Returns 1 if a handler has been found, with '*ip' and '*fp' set - // to the handler location and frame size respectively. - int found_handler(uint *ip, uint *fp); - - // Clear the found handler state. - void clear_handler(); - - // Push a return address for a CONTINUE handler - void push_hstack(uint ip); - - // Pop the CONTINUE handler return stack - uint pop_hstack(); - - // Save variables from frame index 'fp' and up. - void save_variables(uint fp); - - // Restore saved variables from to frame index 'fp' and up. - void restore_variables(uint fp); - - // Push a cursor for the statement (lex) - void push_cursor(LEX *lex); - - // Pop 'count' cursors - void pop_cursors(uint count); - - // Pop all cursors - void pop_all_cursors(); - - // Get the 'i'th cursor - sp_cursor *get_cursor(uint i); - - } - - - - The procedure: sp_head.h - - #define TYPE_ENUM_FUNCTION 1 - #define TYPE_ENUM_PROCEDURE 2 - - class sp_head - { - int m_type; // TYPE_ENUM_FUNCTION or TYPE_ENUM_PROCEDURE - - sp_head(); - - void init(LEX_STRING *name, LEX *lex, LEX_STRING *comment, char suid); - - // Store this procedure in the database. This is a wrapper around - // the function sp_create_procedure(). - int create(THD *); - - // Invoke a FUNCTION - int - execute_function(THD *thd, Item **args, uint argcount, Item **resp); - - // CALL a PROCEDURE - int - execute_procedure(THD *thd, List *args); - - // Add the instruction to this procedure. - void add_instr(sp_instr *); - - // Returns the number of instructions. - uint instructions(); - - // Returns the last instruction - sp_instr *last_instruction(); - - // Resets lex in 'thd' and keeps a copy of the old one. - void reset_lex(THD *); - - // Restores lex in 'thd' from our copy, but keeps some status from the - // one in 'thd', like ptr, tables, fields, etc. - void restore_lex(THD *); - - // Put the instruction on the backpatch list, associated with - // the label. - void push_backpatch(sp_instr *, struct sp_label *); - - // Update all instruction with this label in the backpatch list to - // the current position. - void backpatch(struct sp_label *); - - // Returns the SP name (with optional length in '*lenp'). - char *name(uint *lenp = 0); - - // Returns the result type for a function - Item_result result(); - - // Sets various attributes - void sp_set_info(char *creator, uint creatorlen, - longlong created, longlong modified, - bool suid, char *comment, uint commentlen); - } - - - - Instructions - - - The base class: - class sp_instr - { - // 'ip' is the index of this instruction - sp_instr(uint ip); - - // Execute this instrution. - // '*nextp' will be set to the index of the next instruction - // to execute. (For most instruction this will be the - // instruction following this one.) - // Returns 0 on success, non-zero if some error occurred. - virtual int execute(THD *, uint *nextp) - } - - - Statement instruction: - class sp_instr_stmt : public sp_instr - { - sp_instr_stmt(uint ip); - - int execute(THD *, uint *nextp); - - // Set the statement's Lex - void set_lex(LEX *); - - // Return the statement's Lex - LEX *get_lex(); - } - - - SET instruction: - class sp_instr_set : public sp_instr - { - // 'offset' is the variable's frame offset, 'val' the value, - // and 'type' the variable type. - sp_instr_set(uint ip, - uint offset, Item *val, enum enum_field_types type); - - int execute(THD *, uint *nextp); - } - - - Unconditional jump - class sp_instr_jump : public sp_instr - { - // No destination, must be set. - sp_instr_jump(uint ip); - - // 'dest' is the destination instruction index. - sp_instr_jump(uint ip, uint dest); - - int execute(THD *, uint *nextp); - - // Set the destination instruction 'dest'. - void set_destination(uint dest); - } - - - Conditional jump - class sp_instr_jump_if_not : public sp_instr_jump - { - // Jump if 'i' evaluates to false. Destination not set yet. - sp_instr_jump_if_not(uint ip, Item *i); - - // Jump to 'dest' if 'i' evaluates to false. - sp_instr_jump_if_not(uint ip, Item *i, uint dest) - - int execute(THD *, uint *nextp); - } - - - Return a function value - class sp_instr_freturn : public sp_instr - { - // Return the value 'val' - sp_instr_freturn(uint ip, Item *val, enum enum_field_types type); - - int execute(THD *thd, uint *nextp); - } - - - Push a handler and jump - class sp_instr_hpush_jump : public sp_instr_jump - { - // Push handler of type 'htype', with current frame size 'fp' - sp_instr_hpush_jump(uint ip, int htype, uint fp); - - int execute(THD *thd, uint *nextp); - - // Add condition for this handler - void add_condition(struct sp_cond_type *cond); - } - - - Pops handlers - class sp_instr_hpop : public sp_instr - { - // Pop 'count' handlers - sp_instr_hpop(uint ip, uint count); - - int execute(THD *thd, uint *nextp); - } - - - Return from a CONTINUE handler - class sp_instr_hreturn : public sp_instr - { - // Return from handler, and restore variables to 'fp'. - sp_instr_hreturn(uint ip, uint fp); - - int execute(THD *thd, uint *nextp); - } - - - Push a CURSOR - class sp_instr_cpush : public sp_instr_stmt - { - // Push a cursor for statement 'lex' - sp_instr_cpush(uint ip, LEX *lex) - - int execute(THD *thd, uint *nextp); - } - - - Pop CURSORs - class sp_instr_cpop : public sp_instr_stmt - { - // Pop 'count' cursors - sp_instr_cpop(uint ip, uint count) - - int execute(THD *thd, uint *nextp); - } - - - Open a CURSOR - class sp_instr_copen : public sp_instr_stmt - { - // Open the 'c'th cursor - sp_instr_copen(uint ip, uint c); - - int execute(THD *thd, uint *nextp); - } - - - Close a CURSOR - class sp_instr_cclose : public sp_instr - { - // Close the 'c'th cursor - sp_instr_cclose(uint ip, uint c); - - int execute(THD *thd, uint *nextp); - } - - - Fetch a row with CURSOR - class sp_instr_cfetch : public sp_instr - { - // Fetch next with the 'c'th cursor - sp_instr_cfetch(uint ip, uint c); - - int execute(THD *thd, uint *nextp); - - // Add a target variable for the fetch - void add_to_varlist(struct sp_pvar *var); - } - - - - Utility functions: sp.h - - #define SP_OK 0 - #define SP_KEY_NOT_FOUND -1 - #define SP_OPEN_TABLE_FAILED -2 - #define SP_WRITE_ROW_FAILED -3 - #define SP_DELETE_ROW_FAILED -4 - #define SP_GET_FIELD_FAILED -5 - #define SP_PARSE_ERROR -6 - - // Finds a stored procedure given its name. Returns NULL if not found. - sp_head *sp_find_procedure(THD *, LEX_STRING *name); - - // Store the procedure 'name' in the database. 'def' is the complete - // definition string ("create procedure ..."). - int sp_create_procedure(THD *, - char *name, uint namelen, - char *def, uint deflen, - char *comment, uint commentlen, bool suid); - - // Drop the procedure 'name' from the database. - int sp_drop_procedure(THD *, char *name, uint namelen); - - // Finds a stored function given its name. Returns NULL if not found. - sp_head *sp_find_function(THD *, LEX_STRING *name); - - // Store the function 'name' in the database. 'def' is the complete - // definition string ("create function ..."). - int sp_create_function(THD *, - char *name, uint namelen, - char *def, uint deflen, - char *comment, uint commentlen, bool suid); - - // Drop the function 'name' from the database. - int sp_drop_function(THD *, char *name, uint namelen); - - - - The cache: sp_cache.h - - /* Initialize the SP caching once at startup */ - void sp_cache_init(); - - /* Clear the cache *cp and set *cp to NULL */ - void sp_cache_clear(sp_cache **cp); - - /* Insert an SP to cache. If **cp points to NULL, it's set to a - new cache */ - void sp_cache_insert(sp_cache **cp, sp_head *sp); - - /* Lookup an SP in cache */ - sp_head *sp_cache_lookup(sp_cache **cp, char *name, uint namelen); - - /* Remove an SP from cache */ - void sp_cache_remove(sp_cache **cp, sp_head *sp); - - - - The mysql.proc schema: - - CREATE TABLE proc ( - db char(64) binary DEFAULT '' NOT NULL, - name char(64) DEFAULT '' NOT NULL, - type enum('FUNCTION','PROCEDURE') NOT NULL, - specific_name char(64) DEFAULT '' NOT NULL, - language enum('SQL') DEFAULT 'SQL' NOT NULL, - sql_data_access enum('CONTAINS_SQL') DEFAULT 'CONTAINS_SQL' NOT NULL, - is_deterministic enum('YES','NO') DEFAULT 'NO' NOT NULL, - security_type enum('INVOKER','DEFINER') DEFAULT 'DEFINER' NOT NULL, - param_list blob DEFAULT '' NOT NULL, - returns char(64) DEFAULT '' NOT NULL, - body blob DEFAULT '' NOT NULL, - definer char(77) binary DEFAULT '' NOT NULL, - created timestamp, - modified timestamp, - sql_mode set( - 'REAL_AS_FLOAT', - 'PIPES_AS_CONCAT', - 'ANSI_QUOTES', - 'IGNORE_SPACE', - 'IGNORE_BAD_TABLE_OPTIONS', - 'ONLY_FULL_GROUP_BY', - 'NO_UNSIGNED_SUBTRACTION', - 'NO_DIR_IN_CREATE', - 'POSTGRESQL', - 'ORACLE', - 'MSSQL', - 'DB2', - 'MAXDB', - 'NO_KEY_OPTIONS', - 'NO_TABLE_OPTIONS', - 'NO_FIELD_OPTIONS', - 'MYSQL323', - 'MYSQL40', - 'ANSI', - 'NO_AUTO_VALUE_ON_ZERO' - ) DEFAULT 0 NOT NULL, - comment char(64) binary DEFAULT '' NOT NULL, - PRIMARY KEY (db,name,type) - ) comment='Stored Procedures'; - - -- - diff --git a/KNOWN_BUGS.txt b/KNOWN_BUGS.txt index 56c9102b0cd..af65c98590d 100644 --- a/KNOWN_BUGS.txt +++ b/KNOWN_BUGS.txt @@ -1,35 +1,15 @@ -This file should contain all known fatal bugs in Mariadb and the Aria -storage engine for the last source or binary release. Minor bugs, -extensions and feature requests, and bugs found since this release can -be found in the MariaDB bugs database at: http://mariadb.org/jira and -in the MySQL bugs databases at: http://bugs.mysql.com/ (category -"Maria storage engine"). +This file should contain all known fatal bugs in MariaDB for the last +source or binary release. Minor bugs, extensions and feature requests, +and bugs found since this release can be found in the MariaDB bugs +database at: https://jira.mariadb.org There should not normally be any bugs which affect normal operations in any MariaDB release. Still, there are always exceptions and edge cases and that is what this file is for. -If you have found a bug that is not listed here, please add it to -http://mariadb.org/jira so we can either fix it for next release or in -the worst case add it here for others to know! +If you have find bug please add it to https://jira.mariadb.org so +that we are can try to fix it for the next release. You can also add +feature request to the JIRA. - -IMPORTANT: - -If you have been using the Maria (now Aria) storage engine with the -MySQL-5.1-Maria-alpha build and are upgrading to a newer MariaDB you -MUST run [m]aria_chk --recover on all your Aria tables. This is because -we made an incompatible change with how the transaction id is stored -and old transaction id's must be reset! - -cd mysql-data-directory -aria_chk --recover */*.MAI - -Going forward, we will do our best to not introduce any incompatible -changes in the data format for Aria tables. If this would be ever be -needed, we will, if possible, support both the old and the new version -to make upgrades as easy as possible. - -Note that for the MariaDB 5.1 release the Aria storage engine is -classified as 'beta'; It should work, but use it with caution. Please -report all bugs to http://mariadb.org/jira so we can fix them! +The latest documentation for the MariaDB server can be found at: +https://mariadb.com/kb diff --git a/README.md b/README.md index d6228b6c646..8d4a6e7cfab 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,21 @@ Code status: ------------ -* [![tests status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.4)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.4 branch) +* [![Travis CI status](https://secure.travis-ci.org/MariaDB/server.png?branch=10.4)](https://travis-ci.org/MariaDB/server) travis-ci.org (10.4 branch) +* [![Appveyor CI status](https://ci.appveyor.com/api/projects/status/4u6pexmtpuf8jq66?svg=true)](https://ci.appveyor.com/project/rasmushoj/server) ci.appveyor.com ## MariaDB: drop-in replacement for MySQL MariaDB is designed as a drop-in replacement of MySQL(R) with more features, new storage engines, fewer bugs, and better performance. -MariaDB is brought to you by the MariaDB Foundation. +MariaDB is brought to you by the MariaDB Foundation and the MariaDB corporation. Please read the CREDITS file for details about the MariaDB Foundation, and who is developing MariaDB. MariaDB is developed by many of the original developers of MySQL who -now work for the MariaDB Foundation and the MariaDB Corporation, -and by many people in the community. +now work for the MariaDB Corporation, the MariaDB Foundation and by +many people in the community. MySQL, which is the base of MariaDB, is a product and trademark of Oracle Corporation, Inc. For a list of developers and other contributors, @@ -23,28 +24,35 @@ list of active contributors. A description of the MariaDB project and a manual can be found at: -https://mariadb.org/ - https://mariadb.com/kb/en/ https://mariadb.com/kb/en/mariadb-vs-mysql-features/ -https://mariadb.com/kb/en/mariadb-versus-mysql-features/ - https://mariadb.com/kb/en/mariadb-versus-mysql-compatibility/ +https://mariadb.com/kb/en/library/new-and-old-releases/ + +https://mariadb.org/ + As MariaDB is a full replacement of MySQL, the MySQL manual at http://dev.mysql.com/doc is generally applicable. -Help: +Help ----- More help is available from the Maria Discuss mailing list https://launchpad.net/~maria-discuss and the #maria IRC channel on Freenode. +Live QA for beginner contributors +---- +MariaDB has a dedicated time each week when we answer new contributor questions live on Zulip and IRC. +From 8:00 to 10:00 UTC on Mondays, and 10:00 to 12:00 UTC on Thursdays, +anyone can ask any questions they’d like, and a live developer will be available to assist. -License: +New contributors can ask questions any time, but we will provide immediate feedback during that interval. + +License -------- *************************************************************************** @@ -61,13 +69,17 @@ and COPYING.thirdparty files. *************************************************************************** -Bug Reports: +Bug Reports ------------ -Bug and/or error reports regarding MariaDB should be submitted at -https://mariadb.org/jira +Bug and/or error reports regarding MariaDB should be submitted at: +https://jira.mariadb.org -Bugs in the MySQL code can also be submitted at https://bugs.mysql.com +For reporting security vulnerabilities see: +https://mariadb.org/about/security-policy/ + +Bugs in the MySQL code can also be submitted at: +https://bugs.mysql.com The code for MariaDB, including all revision history, can be found at: https://github.com/MariaDB/server diff --git a/VERSION b/VERSION index dfdc7839a5c..87c93d24617 100644 --- a/VERSION +++ b/VERSION @@ -1,4 +1,4 @@ MYSQL_VERSION_MAJOR=10 MYSQL_VERSION_MINOR=4 -MYSQL_VERSION_PATCH=0 -SERVER_MATURITY=alpha +MYSQL_VERSION_PATCH=3 +SERVER_MATURITY=beta diff --git a/appveyor.yml b/appveyor.yml index 22939d496c9..4a6a49fd8b5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,7 +3,7 @@ version: build-{build}~branch-{branch} before_build: - md %APPVEYOR_BUILD_FOLDER%\win_build - cd %APPVEYOR_BUILD_FOLDER%\win_build - - cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0 + - cmake .. -G "Visual Studio 15 2017 Win64" -DWITH_UNIT_TESTS=0 -DWITH_MARIABACKUP=0 -DMYSQL_MAINTAINER_MODE=ERR -DPLUGIN_ROCKSDB=NO -DPLUGIN_CONNECT=NO -DBISON_EXECUTABLE=C:\cygwin64\bin\bison build: project: win_build\MySQL.sln @@ -16,6 +16,6 @@ platform: x64 test_script: - set PATH=%PATH%;C:\Program Files (x86)\Windows Kits\10\Debuggers\x64 - cd %APPVEYOR_BUILD_FOLDER%\win_build\mysql-test - - perl mysql-test-run.pl --force --max-test-fail=10 --parallel=auto --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main,innodb,plugins,mariabackup + - perl mysql-test-run.pl --force --max-test-fail=10 --parallel=4 --testcase-timeout=10 --skip-test-list=unstable-tests --suite=main image: Visual Studio 2017 diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index e0d34b9f5ed..ff6422d15da 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -1,4 +1,5 @@ # Copyright (c) 2006, 2015, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2008, 2018, 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 @@ -45,7 +46,7 @@ ENDIF(UNIX) MYSQL_ADD_EXECUTABLE(mysqltest mysqltest.cc COMPONENT Test) SET_SOURCE_FILES_PROPERTIES(mysqltest.cc PROPERTIES COMPILE_FLAGS "-DTHREADS") -TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcre pcreposix) +TARGET_LINK_LIBRARIES(mysqltest ${CLIENT_LIB} pcreposix pcre) SET_TARGET_PROPERTIES(mysqltest PROPERTIES ENABLE_EXPORTS TRUE) diff --git a/client/mysql.cc b/client/mysql.cc index f6a4569fce9..a20a1665071 100644 --- a/client/mysql.cc +++ b/client/mysql.cc @@ -1,6 +1,6 @@ /* - Copyright (c) 2000, 2014, Oracle and/or its affiliates. - Copyright (c) 2009, 2017, MariaDB + Copyright (c) 2000, 2018, Oracle and/or its affiliates. + Copyright (c) 2009, 2018, 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,9 +278,9 @@ static COMMANDS commands[] = { { "edit", 'e', com_edit, 0, "Edit command with $EDITOR."}, #endif { "ego", 'G', com_ego, 0, - "Send command to mysql server, display result vertically."}, + "Send command to MariaDB server, display result vertically."}, { "exit", 'q', com_quit, 0, "Exit mysql. Same as quit."}, - { "go", 'g', com_go, 0, "Send command to mysql server." }, + { "go", 'g', com_go, 0, "Send command to MariaDB server." }, { "help", 'h', com_help, 1, "Display this help." }, #ifdef USE_POPEN { "nopager",'n', com_nopager,0, "Disable pager, print to stdout." }, @@ -1483,7 +1483,7 @@ static struct my_option my_long_options[] = {"batch", 'B', "Don't use history file. Disable interactive behavior. (Enables --silent.)", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, - {"binary-as-hex", 'b', "Print binary data as hex", &opt_binhex, &opt_binhex, + {"binary-as-hex", 0, "Print binary data as hex", &opt_binhex, &opt_binhex, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"character-sets-dir", OPT_CHARSETS_DIR, "Directory for character set files.", &charsets_dir, @@ -1537,7 +1537,7 @@ static struct my_option my_long_options[] = &ignore_spaces, &ignore_spaces, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"init-command", OPT_INIT_COMMAND, - "SQL Command to execute when connecting to MySQL server. Will " + "SQL Command to execute when connecting to MariaDB server. Will " "automatically be re-executed when reconnecting.", &opt_init_command, &opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -1599,7 +1599,7 @@ static struct my_option my_long_options[] = "Get progress reports for long running commands (like ALTER TABLE)", &opt_progress_reports, &opt_progress_reports, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, - {"prompt", OPT_PROMPT, "Set the mysql prompt to this value.", + {"prompt", OPT_PROMPT, "Set the command line prompt to this value.", ¤t_prompt, ¤t_prompt, 0, GET_STR_ALLOC, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).", @@ -3127,7 +3127,7 @@ com_help(String *buffer __attribute__((unused)), put_info("\nGeneral information about MariaDB can be found at\n" "http://mariadb.org\n", INFO_INFO); - put_info("List of all MySQL commands:", INFO_INFO); + put_info("List of all client commands:", INFO_INFO); if (!named_cmds) put_info("Note that all text commands must be first on line and end with ';'",INFO_INFO); for (i = 0; commands[i].name; i++) diff --git a/client/mysql_upgrade.c b/client/mysql_upgrade.c index c5a79e24c03..ee10996d678 100644 --- a/client/mysql_upgrade.c +++ b/client/mysql_upgrade.c @@ -111,7 +111,7 @@ static struct my_option my_long_options[]= &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"force", 'f', "Force execution of mysqlcheck even if mysql_upgrade " - "has already been executed for the current version of MySQL.", + "has already been executed for the current version of MariaDB.", &opt_force, &opt_force, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"host", 'h', "Connect to host.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -808,7 +808,7 @@ static my_bool is_mysql() strstr(ds_events_struct.str, "IGNORE_BAD_TABLE_OPTIONS") != NULL) ret= FALSE; else - verbose("MySQL upgrade detected"); + verbose("MariaDB upgrade detected"); dynstr_free(&ds_events_struct); return(ret); @@ -878,10 +878,14 @@ static int run_mysqlcheck_fixnames(void) static const char *expected_errors[]= { + "ERROR 1051", /* Unknown table */ "ERROR 1060", /* Duplicate column name */ "ERROR 1061", /* Duplicate key name */ "ERROR 1054", /* Unknown column */ + "ERROR 1146", /* Table does not exist */ "ERROR 1290", /* RR_OPTION_PREVENTS_STATEMENT */ + "ERROR 1347", /* 'mysql.user' is not of type 'BASE TABLE' */ + "ERROR 1348", /* Column 'Show_db_priv' is not updatable */ 0 }; @@ -1192,7 +1196,7 @@ int main(int argc, char **argv) */ if (!opt_force && upgrade_already_done(0)) { - printf("This installation of MySQL is already upgraded to %s, " + printf("This installation of MariaDB is already upgraded to %s, " "use --force if you still need to run mysql_upgrade\n", MYSQL_SERVER_VERSION); goto end; diff --git a/client/mysqladmin.cc b/client/mysqladmin.cc index be81deb2780..35afe06eade 100644 --- a/client/mysqladmin.cc +++ b/client/mysqladmin.cc @@ -573,7 +573,7 @@ static my_bool sql_connect(MYSQL *mysql, uint wait) if (!info) { info=1; - fputs("Waiting for MySQL server to answer",stderr); + fputs("Waiting for MariaDB server to answer",stderr); (void) fflush(stderr); } else diff --git a/client/mysqlbinlog.cc b/client/mysqlbinlog.cc index 1b6c94aaf6d..a5995e103ef 100644 --- a/client/mysqlbinlog.cc +++ b/client/mysqlbinlog.cc @@ -1598,7 +1598,7 @@ static struct my_option my_options[] = &opt_default_auth, &opt_default_auth, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"disable-log-bin", 'D', "Disable binary log. This is useful, if you " - "enabled --to-last-log and are sending the output to the same MySQL server. " + "enabled --to-last-log and are sending the output to the same MariaDB server. " "This way you could avoid an endless loop. You would also like to use it " "when restoring after a crash to avoid duplication of the statements you " "already have. NOTE: you will need a SUPER privilege to use this option.", @@ -1643,7 +1643,7 @@ static struct my_option my_options[] = {"protocol", OPT_MYSQL_PROTOCOL, "The protocol to use for connection (tcp, socket, pipe).", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"read-from-remote-server", 'R', "Read binary logs from a MySQL server.", + {"read-from-remote-server", 'R', "Read binary logs from a MariaDB server.", &remote_opt, &remote_opt, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"raw", 0, "Requires -R. Output raw binlog data instead of SQL " @@ -1696,7 +1696,7 @@ static struct my_option my_options[] = {"start-datetime", OPT_START_DATETIME, "Start reading the binlog at first event having a datetime equal or " "posterior to the argument; the argument must be a date and time " - "in the local time zone, in any format accepted by the MySQL server " + "in the local time zone, in any format accepted by the MariaDB server " "for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 " "(you should probably use quotes for your shell to set it properly).", &start_datetime_str, &start_datetime_str, @@ -1714,7 +1714,7 @@ static struct my_option my_options[] = {"stop-datetime", OPT_STOP_DATETIME, "Stop reading the binlog at first event having a datetime equal or " "posterior to the argument; the argument must be a date and time " - "in the local time zone, in any format accepted by the MySQL server " + "in the local time zone, in any format accepted by the MariaDB server " "for DATETIME and TIMESTAMP types, for example: 2004-12-25 11:25:56 " "(you should probably use quotes for your shell to set it properly).", &stop_datetime_str, &stop_datetime_str, @@ -1738,7 +1738,7 @@ static struct my_option my_options[] = 0, 0, 0, 0, 0, 0}, {"to-last-log", 't', "Requires -R. Will not stop at the end of the \ requested binlog but rather continue printing until the end of the last \ -binlog of the MySQL server. If you send the output to the same MySQL server, \ +binlog of the MariaDB server. If you send the output to the same MariaDB server, \ that may lead to an endless loop.", &to_last_remote_log, &to_last_remote_log, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -1875,7 +1875,7 @@ static void usage() print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("\ -Dumps a MySQL binary log in a format usable for viewing or for piping to\n\ +Dumps a MariaDB binary log in a format usable for viewing or for piping to\n\ the mysql command line client.\n\n"); printf("Usage: %s [options] log-files\n", my_progname); print_defaults("my",load_groups); @@ -1893,7 +1893,7 @@ static my_time_t convert_str_to_timestamp(const char* str) uint dummy_in_dst_time_gap; /* We require a total specification (date AND time) */ - if (str_to_datetime(str, (uint) strlen(str), &l_time, 0, &status) || + if (str_to_datetime_or_date(str, (uint) strlen(str), &l_time, 0, &status) || l_time.time_type != MYSQL_TIMESTAMP_DATETIME || status.warnings) { error("Incorrect date and time argument: %s", str); @@ -2281,7 +2281,7 @@ static Exit_status check_master_version() break; default: error("Could not find server version: " - "Master reported unrecognized MySQL version '%s'.", row[0]); + "Master reported unrecognized MariaDB version '%s'.", row[0]); goto err; } if (!glob_description_event || !glob_description_event->is_valid()) diff --git a/client/mysqldump.c b/client/mysqldump.c index ae92adbc8ba..48eb2dfdb5e 100644 --- a/client/mysqldump.c +++ b/client/mysqldump.c @@ -39,7 +39,7 @@ ** 10 Jun 2003: SET NAMES and --no-set-names by Alexander Barkov */ -#define DUMP_VERSION "10.16" +#define DUMP_VERSION "10.17" #include #include @@ -254,10 +254,10 @@ static struct my_option my_long_options[] = 1, 0, 0, 0, 0, 0}, {"compatible", OPT_COMPATIBLE, "Change the dump to be compatible with a given mode. By default tables " - "are dumped in a format optimized for MySQL. Legal modes are: ansi, " + "are dumped in a format optimized for MariaDB. Legal modes are: ansi, " "mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, " "no_table_options, no_field_options. One can use several modes separated " - "by commas. Note: Requires MySQL server version 4.1.0 or higher. " + "by commas. Note: Requires MariaDB server version 4.1.0 or higher. " "This option is ignored with earlier server versions.", &opt_compatible_mode_str, &opt_compatible_mode_str, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -274,7 +274,7 @@ static struct my_option my_long_options[] = &opt_compress, &opt_compress, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"create-options", 'a', - "Include all MySQL specific create options.", + "Include all MariaDB specific create options.", &create_options, &create_options, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0}, {"databases", 'B', @@ -642,7 +642,7 @@ static void usage(void) { print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); - puts("Dumping structure and contents of MySQL databases and tables."); + puts("Dumping structure and contents of MariaDB databases and tables."); short_usage_sub(stdout); print_defaults("my",load_default_groups); puts(""); @@ -700,7 +700,7 @@ static void write_header(FILE *sql_file, char *db_name) else if (!opt_compact) { print_comment(sql_file, 0, - "-- MySQL dump %s Distrib %s, for %s (%s)\n--\n", + "-- MariaDB dump %s Distrib %s, for %s (%s)\n--\n", DUMP_VERSION, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); print_comment(sql_file, 0, "-- Host: %s ", @@ -5515,7 +5515,7 @@ static int start_transaction(MYSQL *mysql_con) if ((mysql_get_server_version(mysql_con) < 40100) && opt_master_data) { fprintf(stderr, "-- %s: the combination of --single-transaction and " - "--master-data requires a MySQL server version of at least 4.1 " + "--master-data requires a MariaDB server version of at least 4.1 " "(current server's version is %s). %s\n", ignore_errors ? "Warning" : "Error", mysql_con->server_version ? mysql_con->server_version : "unknown", diff --git a/client/mysqlimport.c b/client/mysqlimport.c index 2e4e8550fe3..977e0e6ca1e 100644 --- a/client/mysqlimport.c +++ b/client/mysqlimport.c @@ -195,13 +195,14 @@ static void usage(void) { puts("Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc."); puts("Copyright 2008-2011 Oracle and Monty Program Ab."); + puts("Copyright 2012-2019 MariaDB Corporation Ab."); print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); printf("\ Loads tables from text files in various formats. The base name of the\n\ text file must be the name of the table that should be used.\n\ -If one uses sockets to connect to the MySQL server, the server will open and\n\ -read the text file directly. In other cases the client will open the text\n\ +If one uses sockets to connect to the MariaDB server, the server will open\n\ +and read the text file directly. In other cases the client will open the text\n\ file. The SQL command 'LOAD DATA INFILE' is used to import the rows.\n"); printf("\nUsage: %s [OPTIONS] database textfile...\n",my_progname); diff --git a/client/mysqlshow.c b/client/mysqlshow.c index d7c4dbec27e..a6108ef4fc1 100644 --- a/client/mysqlshow.c +++ b/client/mysqlshow.c @@ -268,7 +268,7 @@ static void usage(void) { print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); - puts("Shows the structure of a MySQL database (databases, tables, and columns).\n"); + puts("Shows the structure of a MariaDB database (databases, tables, and columns).\n"); printf("Usage: %s [OPTIONS] [database [table [column]]]\n",my_progname); puts("\n\ If last argument contains a shell or SQL wildcard (*,?,% or _) then only\n\ @@ -658,7 +658,7 @@ list_table_status(MYSQL *mysql,const char *db,const char *wild) fprintf(stderr,"%s: Cannot get status for db: %s, table: %s: %s\n", my_progname,db,wild ? wild : "",mysql_error(mysql)); if (mysql_errno(mysql) == ER_PARSE_ERROR) - fprintf(stderr,"This error probably means that your MySQL server doesn't support the\n\'show table status' command.\n"); + fprintf(stderr,"This error probably means that your MariaDB server doesn't support the\n\'show table status' command.\n"); return 1; } diff --git a/client/mysqlslap.c b/client/mysqlslap.c index 3b9703fe6d4..8c79da88e41 100644 --- a/client/mysqlslap.c +++ b/client/mysqlslap.c @@ -623,7 +623,7 @@ static struct my_option my_long_options[] = {"host", 'h', "Connect to host.", &host, &host, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"init-command", OPT_INIT_COMMAND, - "SQL Command to execute when connecting to MySQL server. Will " + "SQL Command to execute when connecting to MariaDB server. Will " "automatically be re-executed when reconnecting.", &opt_init_command, &opt_init_command, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, diff --git a/client/mysqltest.cc b/client/mysqltest.cc index 38e89236896..184121e12c0 100644 --- a/client/mysqltest.cc +++ b/client/mysqltest.cc @@ -20,7 +20,7 @@ Tool used for executing a .test file See the "MySQL Test framework manual" for more information - http://dev.mysql.com/doc/mysqltest/en/index.html + https://mariadb.com/kb/en/library/mysqltest/ Please keep the test framework tools identical in all versions! @@ -5963,6 +5963,7 @@ void do_connect(struct st_command *command) int read_timeout= 0; int write_timeout= 0; int connect_timeout= 0; + char *csname=0; struct st_connection* con_slot; static DYNAMIC_STRING ds_connection_name; @@ -6065,6 +6066,11 @@ void do_connect(struct st_command *command) { connect_timeout= atoi(con_options + sizeof("connect_timeout=")-1); } + else if (strncasecmp(con_options, "CHARSET=", + sizeof("CHARSET=") - 1) == 0) + { + csname= strdup(con_options + sizeof("CHARSET=") - 1); + } else die("Illegal option to connect: %.*s", (int) (end - con_options), con_options); @@ -6102,7 +6108,7 @@ void do_connect(struct st_command *command) mysql_options(con_slot->mysql, MYSQL_OPT_COMPRESS, NullS); mysql_options(con_slot->mysql, MYSQL_OPT_LOCAL_INFILE, 0); mysql_options(con_slot->mysql, MYSQL_SET_CHARSET_NAME, - charset_info->csname); + csname?csname: charset_info->csname); if (opt_charsets_dir) mysql_options(con_slot->mysql, MYSQL_SET_CHARSET_DIR, opt_charsets_dir); @@ -6194,6 +6200,7 @@ void do_connect(struct st_command *command) dynstr_free(&ds_sock); dynstr_free(&ds_options); dynstr_free(&ds_default_auth); + free(csname); DBUG_VOID_RETURN; } @@ -6581,8 +6588,6 @@ static inline bool is_escape_char(char c, char in_string) SYNOPSIS read_line - buf buffer for the read line - size size of the buffer i.e max size to read DESCRIPTION This function actually reads several lines and adds them to the @@ -6600,10 +6605,15 @@ static inline bool is_escape_char(char c, char in_string) */ -int read_line(char *buf, int size) +static char *read_command_buf= NULL; +static size_t read_command_buflen= 0; +static const size_t max_multibyte_length= 6; + +int read_line() { char c, last_quote=0, last_char= 0; - char *p= buf, *buf_end= buf + size - 1; + char *p= read_command_buf; + char *buf_end= read_command_buf + read_command_buflen - max_multibyte_length; int skip_char= 0; my_bool have_slash= FALSE; @@ -6611,10 +6621,21 @@ int read_line(char *buf, int size) R_COMMENT, R_LINE_START} state= R_LINE_START; DBUG_ENTER("read_line"); + *p= 0; start_lineno= cur_file->lineno; DBUG_PRINT("info", ("Starting to read at lineno: %d", start_lineno)); - for (; p < buf_end ;) + while (1) { + if (p >= buf_end) + { + my_ptrdiff_t off= p - read_command_buf; + read_command_buf= (char*)my_realloc(read_command_buf, + read_command_buflen*2, MYF(MY_FAE)); + p= read_command_buf + off; + read_command_buflen*= 2; + buf_end= read_command_buf + read_command_buflen - max_multibyte_length; + } + skip_char= 0; c= my_getc(cur_file->file); if (feof(cur_file->file)) @@ -6650,7 +6671,7 @@ int read_line(char *buf, int size) cur_file->lineno++; /* Convert cr/lf to lf */ - if (p != buf && *(p-1) == '\r') + if (p != read_command_buf && *(p-1) == '\r') p--; } @@ -6665,9 +6686,9 @@ int read_line(char *buf, int size) } else if ((c == '{' && (!my_strnncoll_simple(charset_info, (const uchar*) "while", 5, - (uchar*) buf, MY_MIN(5, p - buf), 0) || + (uchar*) read_command_buf, MY_MIN(5, p - read_command_buf), 0) || !my_strnncoll_simple(charset_info, (const uchar*) "if", 2, - (uchar*) buf, MY_MIN(2, p - buf), 0)))) + (uchar*) read_command_buf, MY_MIN(2, p - read_command_buf), 0)))) { /* Only if and while commands can be terminated by { */ *p++= c; @@ -6799,8 +6820,6 @@ int read_line(char *buf, int size) } } } - die("The input buffer is too small for this query.\n" - "check your query or increase MAX_QUERY and recompile"); DBUG_RETURN(0); } @@ -6945,12 +6964,8 @@ bool is_delimiter(const char* p) terminated by new line '\n' regardless how many "delimiter" it contain. */ -#define MAX_QUERY (256*1024*2) /* 256K -- a test in sp-big is >128K */ -static char read_command_buf[MAX_QUERY]; - int read_command(struct st_command** command_ptr) { - char *p= read_command_buf; struct st_command* command; DBUG_ENTER("read_command"); @@ -6967,8 +6982,7 @@ int read_command(struct st_command** command_ptr) die("Out of memory"); command->type= Q_UNKNOWN; - read_command_buf[0]= 0; - if (read_line(read_command_buf, sizeof(read_command_buf))) + if (read_line()) { check_eol_junk(read_command_buf); DBUG_RETURN(1); @@ -6977,6 +6991,7 @@ int read_command(struct st_command** command_ptr) if (opt_result_format_version == 1) convert_to_format_v1(read_command_buf); + char *p= read_command_buf; DBUG_PRINT("info", ("query: '%s'", read_command_buf)); if (*p == '#') { @@ -7170,7 +7185,7 @@ void usage() { print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); - printf("Runs a test against the mysql server and compares output with a results file.\n\n"); + printf("Runs a test against the MariaDB server and compares output with a results file.\n\n"); printf("Usage: %s [OPTIONS] [database] < test_file\n", my_progname); print_defaults("my",load_default_groups); puts(""); @@ -7928,7 +7943,7 @@ int append_warnings(DYNAMIC_STRING *ds, MYSQL* mysql) static void handle_no_active_connection(struct st_command *command, struct st_connection *cn, DYNAMIC_STRING *ds) { - handle_error(command, 2006, "MySQL server has gone away", "000000", ds); + handle_error(command, 2006, "MariaDB server has gone away", "000000", ds); cn->pending= FALSE; var_set_errno(2006); } @@ -9204,6 +9219,8 @@ int main(int argc, char **argv) init_win_path_patterns(); #endif + read_command_buf= (char*)my_malloc(read_command_buflen= 65536, MYF(MY_FAE)); + init_dynamic_string(&ds_res, "", 2048, 2048); init_alloc_root(&require_file_root, "require_file", 1024, 1024, MYF(0)); @@ -9245,7 +9262,7 @@ int main(int argc, char **argv) if (mysql_server_init(embedded_server_arg_count, embedded_server_args, (char**) embedded_server_groups)) - die("Can't initialize MySQL server"); + die("Can't initialize MariaDB server"); server_initialized= 1; if (cur_file == file_stack && cur_file->file == 0) { @@ -9972,7 +9989,7 @@ void do_get_replace(struct st_command *command) char *buff, *start; char word_end_chars[256], *pos; POINTER_ARRAY to_array, from_array; - DBUG_ENTER("get_replace"); + DBUG_ENTER("do_get_replace"); free_replace(); diff --git a/cmake/CPackRPM.cmake b/cmake/CPackRPM.cmake index 3b57decc5bb..326013f06b3 100644 --- a/cmake/CPackRPM.cmake +++ b/cmake/CPackRPM.cmake @@ -2,6 +2,11 @@ # Wrapper for CPackRPM.cmake # +# +# Support for per-component LICENSE and VENDOR +# +# per component values, if present, are copied into global CPACK_RPM_PACKAGE_xxx +# macro(set_from_component WHAT) set(orig_CPACK_RPM_PACKAGE_${WHAT} ${CPACK_RPM_PACKAGE_${WHAT}}) if(CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_${WHAT}) @@ -15,6 +20,33 @@ endmacro() set_from_component(LICENSE) set_from_component(VENDOR) +# +# Support for the %posttrans scriptlet +# +# the scriptlet, if present, is appended (together with the %posttrans tag) +# to the pre-uninstall scriptlet +# +set(base_time "PRE") +set(base_type "UNINSTALL") +set(base_var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}_SCRIPT_FILE) +set(acc) + +macro(read_one_file time_ type_ tag_) + set(var CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_${time_}_${type_}_SCRIPT_FILE) + if (${var}) + file(READ ${${var}} content) + set(acc "${tag_}\n${content}\n\n${acc}") + endif() +endmacro() + +read_one_file("POST" "TRANS" "%posttrans") +if (acc) + set(orig_${base_var} ${${base_var}}) + read_one_file(${base_time} ${base_type} "") + set(${base_var} ${CPACK_TOPLEVEL_DIRECTORY}/SPECS/${CPACK_RPM_PACKAGE_COMPONENT}_${base_time}_${base_type}.scriptlet) + file(WRITE ${${base_var}} "${acc}") +endif() + # load the original CPackRPM.cmake set(orig_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}) unset(CMAKE_MODULE_PATH) @@ -23,10 +55,10 @@ set(CMAKE_MODULE_PATH ${orig_CMAKE_MODULE_PATH}) restore(LICENSE) restore(VENDOR) +set(${base_var} ${orig_${base_var}}) # per-component cleanup foreach(_RPM_SPEC_HEADER URL REQUIRES SUGGESTS PROVIDES OBSOLETES PREFIX CONFLICTS AUTOPROV AUTOREQ AUTOREQPROV) unset(TMP_RPM_${_RPM_SPEC_HEADER}) unset(CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP) endforeach() - diff --git a/cmake/configure.pl b/cmake/configure.pl index c502a172a22..dfd961ee085 100644 --- a/cmake/configure.pl +++ b/cmake/configure.pl @@ -145,6 +145,11 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DPLUGIN_".uc($1)."=".uc($2); next; } + if($option =~ /without-wsrep/) + { + $cmakeargs = $cmakeargs." -DWITH_WSREP=OFF"; + next; + } if($option =~ /with-zlib-dir=bundled/) { $cmakeargs = $cmakeargs." -DWITH_ZLIB=bundled"; @@ -185,6 +190,16 @@ foreach my $option (@ARGV) $cmakeargs = $cmakeargs." -DCMAKE_BUILD_TYPE=Debug -DSECURITY_HARDENED=OFF"; next; } + if($option =~ /with-(.*)=(.*)/) + { + $cmakeargs = $cmakeargs. " -DWITH_" . uc($1) . "=" . uc($2); + next; + } + if($option =~ /without-(.*)=(.*)/) + { + $cmakeargs = $cmakeargs. " -DWITHOUT_" . uc($1) . "=" . uc($2); + next; + } if($option =~ /prefix=/) { $cmake_install_prefix= substr($option, 7); diff --git a/cmake/cpack_rpm.cmake b/cmake/cpack_rpm.cmake index e27206fc3b4..19293e9a176 100644 --- a/cmake/cpack_rpm.cmake +++ b/cmake/cpack_rpm.cmake @@ -81,6 +81,8 @@ SET(CPACK_RPM_SPEC_MORE_DEFINE " %define _bindir ${INSTALL_BINDIRABS} %define _sbindir ${INSTALL_SBINDIRABS} %define _sysconfdir ${INSTALL_SYSCONFDIR} +%define restart_flag_dir %{_localstatedir}/lib/rpm-state/mariadb +%define restart_flag %{restart_flag_dir}/need-restart ") # this creative hack is described here: http://www.cmake.org/pipermail/cmake/2012-January/048416.html @@ -97,12 +99,15 @@ SET(ignored "%ignore /etc" "%ignore /etc/init.d" "%ignore /etc/logrotate.d" + "%ignore /etc/systemd" + "%ignore /etc/systemd/system" "%ignore ${CMAKE_INSTALL_PREFIX}" "%ignore ${CMAKE_INSTALL_PREFIX}/bin" "%ignore ${CMAKE_INSTALL_PREFIX}/include" "%ignore ${CMAKE_INSTALL_PREFIX}/lib" "%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd" "%ignore ${CMAKE_INSTALL_PREFIX}/lib/systemd/system" + "%ignore ${CMAKE_INSTALL_PREFIX}/lib/tmpfiles.d" "%ignore ${CMAKE_INSTALL_PREFIX}/lib64" "%ignore ${CMAKE_INSTALL_PREFIX}/sbin" "%ignore ${CMAKE_INSTALL_PREFIX}/share" @@ -166,7 +171,7 @@ SETA(CPACK_RPM_server_PACKAGE_REQUIRES IF(WITH_WSREP) SETA(CPACK_RPM_server_PACKAGE_REQUIRES - "galera" "rsync" "lsof" "grep" "gawk" "iproute" + "galera-4" "rsync" "lsof" "grep" "gawk" "iproute" "coreutils" "findutils" "tar") ENDIF() @@ -174,6 +179,7 @@ SET(CPACK_RPM_server_PRE_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/r SET(CPACK_RPM_server_PRE_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-preun.sh) SET(CPACK_RPM_server_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postin.sh) SET(CPACK_RPM_server_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-postun.sh) +SET(CPACK_RPM_server_POST_TRANS_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-posttrans.sh) SET(CPACK_RPM_shared_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) SET(CPACK_RPM_shared_POST_UNINSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) SET(CPACK_RPM_compat_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/shared-post.sh) @@ -208,6 +214,8 @@ ELSEIF(RPM MATCHES "fedora" OR RPM MATCHES "(rhel|centos)7") ALTERNATIVE_NAME("server" "mariadb-server") ALTERNATIVE_NAME("server" "mysql-compat-server") ALTERNATIVE_NAME("test" "mariadb-test") +ELSEIF(RPM MATCHES "(rhel|centos)8") + SET(PYTHON_SHEBANG "/usr/bin/python3") ENDIF() # workaround for lots of perl dependencies added by rpmbuild diff --git a/cmake/install_macros.cmake b/cmake/install_macros.cmake index 71657e32308..da57078cfbf 100644 --- a/cmake/install_macros.cmake +++ b/cmake/install_macros.cmake @@ -33,26 +33,17 @@ FUNCTION (INSTALL_DEBUG_SYMBOLS) SET(targets ${ARG_UNPARSED_ARGUMENTS}) FOREACH(target ${targets}) GET_TARGET_PROPERTY(target_type ${target} TYPE) - + IF(target_type MATCHES "STATIC") + RETURN() + ENDIF() set(comp "") - - IF(target MATCHES "mysqld" OR type MATCHES "MODULE") - #MESSAGE("PDB: ${targets}") + + IF((target STREQUAL "mysqld")) SET(comp Server) ENDIF() - - IF(NOT comp MATCHES Server) - IF(ARG_COMPONENT MATCHES Development - OR ARG_COMPONENT MATCHES SharedLibraries - OR ARG_COMPONENT MATCHES Embedded) - SET(comp Debuginfo) - ENDIF() - ENDIF() - IF(NOT comp) - SET(comp Debuginfo_archive_only) # not in MSI - ENDIF() - IF(NOT target_type MATCHES "STATIC") + INSTALL(FILES $ DESTINATION symbols COMPONENT Debuginfo) + IF(comp) INSTALL(FILES $ DESTINATION ${ARG_INSTALL_LOCATION} COMPONENT ${comp}) ENDIF() ENDFOREACH() diff --git a/cmake/libutils.cmake b/cmake/libutils.cmake index cdc7af5d228..b5220ddd546 100644 --- a/cmake/libutils.cmake +++ b/cmake/libutils.cmake @@ -136,6 +136,10 @@ MACRO(MERGE_STATIC_LIBS TARGET OUTPUT_NAME LIBS_TO_MERGE) SET(SOURCE_FILE ${CMAKE_CURRENT_BINARY_DIR}/${TARGET}_depends.c) ADD_LIBRARY(${TARGET} STATIC ${SOURCE_FILE}) SET_TARGET_PROPERTIES(${TARGET} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME}) + IF(NOT _SKIP_PIC) + SET_TARGET_PROPERTIES(${TARGET} PROPERTIES COMPILE_FLAGS + "${CMAKE_SHARED_LIBRARY_C_FLAGS}") + ENDIF() SET(OSLIBS) FOREACH(LIB ${LIBS_TO_MERGE}) @@ -239,11 +243,11 @@ MACRO(MERGE_LIBRARIES) # check for non-PIC libraries IF(NOT _SKIP_PIC) FOREACH(LIB ${LIBS}) - GET_TARGET_PROPERTY(${LIB} TYPE LIBTYPE) - IF(LIBTYPE STREQUAL "STATIC_LIBRARY") - GET_TARGET_PROPERTY(LIB COMPILE_FLAGS LIB_COMPILE_FLAGS) + GET_TARGET_PROPERTY(LTYPE ${LIB} TYPE) + IF(LTYPE STREQUAL "STATIC_LIBRARY") + GET_TARGET_PROPERTY(LIB_COMPILE_FLAGS ${LIB} COMPILE_FLAGS) STRING(REPLACE "${CMAKE_SHARED_LIBRARY_C_FLAGS}" - "" LIB_COMPILE_FLAGS ${LIB_COMPILE_FLAG}) + "" LIB_COMPILE_FLAGS "${LIB_COMPILE_FLAGS}") IF(NOT LIB_COMPILE_FLAGS MATCHES "") MESSAGE(FATAL_ERROR "Attempted to link non-PIC static library ${LIB} to shared library ${TARGET}\n" diff --git a/cmake/make_dist.cmake.in b/cmake/make_dist.cmake.in index 6fad17137fd..8e77b700eb7 100644 --- a/cmake/make_dist.cmake.in +++ b/cmake/make_dist.cmake.in @@ -50,6 +50,14 @@ IF(GIT_EXECUTABLE) IF(NOT RESULT EQUAL 0) SET(GIT_EXECUTABLE) ENDIF() + EXECUTE_PROCESS( + COMMAND "${GIT_EXECUTABLE}" submodule foreach "${GIT_EXECUTABLE} checkout-index --all --prefix=${PACKAGE_DIR}/wsrep-lib/$path/" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/wsrep-lib + RESULT_VARIABLE RESULT + ) + IF(NOT RESULT EQUAL 0) + SET(GIT_EXECUTABLE) + ENDIF() ENDIF() CONFIGURE_FILE(${CMAKE_BINARY_DIR}/include/source_revision.h diff --git a/cmake/mariadb_connector_c.cmake b/cmake/mariadb_connector_c.cmake index c36087cb862..368a6cc8da5 100644 --- a/cmake/mariadb_connector_c.cmake +++ b/cmake/mariadb_connector_c.cmake @@ -6,10 +6,7 @@ ENDIF() SET(CONC_WITH_SIGNCODE ${SIGNCODE}) SET(SIGN_OPTIONS ${SIGNTOOL_PARAMETERS}) - -IF(NOT TARGET zlib) - SET(CONC_WITH_EXTERNAL_ZLIB ON) -ENDIF() +SET(CONC_WITH_EXTERNAL_ZLIB ON) IF(SSL_DEFINES MATCHES "YASSL") IF(WIN32) diff --git a/cmake/os/Windows.cmake b/cmake/os/Windows.cmake index 0caa67b20ab..44a9c2e823c 100644 --- a/cmake/os/Windows.cmake +++ b/cmake/os/Windows.cmake @@ -96,7 +96,8 @@ IF(MSVC) # Disable mingw based pkg-config found in Strawberry perl SET(PKG_CONFIG_EXECUTABLE 0 CACHE INTERNAL "") - SET(MSVC_CRT_TYPE /MT CACHE STRING + + SET(MSVC_CRT_TYPE /MD CACHE STRING "Runtime library - specify runtime library for linking (/MT,/MTd,/MD,/MDd)" ) SET(VALID_CRT_TYPES /MTd /MDd /MD /MT) @@ -106,9 +107,7 @@ IF(MSVC) IF(MSVC_CRT_TYPE MATCHES "/MD") # Dynamic runtime (DLLs), need to install CRT libraries. - SET(CMAKE_INSTALL_MFC_LIBRARIES TRUE)# upgrade wizard SET(CMAKE_INSTALL_SYSTEM_RUNTIME_COMPONENT VCCRT) - SET(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_NO_WARNINGS TRUE) SET(CMAKE_INSTALL_UCRT_LIBRARIES TRUE) IF(MSVC_CRT_TYPE STREQUAL "/MDd") SET (CMAKE_INSTALL_DEBUG_LIBRARIES_ONLY TRUE) @@ -205,9 +204,8 @@ IF(MSVC) ENDIF() # Always link with socket library -LINK_LIBRARIES(ws2_32) -# ..also for tests -SET(CMAKE_REQUIRED_LIBRARIES ws2_32) +STRING(APPEND CMAKE_C_STANDARD_LIBRARIES " ws2_32.lib") +STRING(APPEND CMAKE_CXX_STANDARD_LIBRARIES " ws2_32.lib") # System checks SET(SIGNAL_WITH_VIO_CLOSE 1) # Something that runtime team needs @@ -278,3 +276,17 @@ ENDIF() SET(FN_NO_CASE_SENSE 1) SET(USE_SYMDIR 1) + +# Force static C runtime for targets in current directory +# (useful to get rid of MFC dll's dependency, or in installer) +MACRO(FORCE_STATIC_CRT) + FOREACH(flag + CMAKE_C_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO + CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_DEBUG_INIT + CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO + CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG_INIT + CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL + ) + STRING(REGEX REPLACE "/MD[d]?" "/MT" "${flag}" "${${flag}}" ) + ENDFOREACH() +ENDMACRO() diff --git a/cmake/os/WindowsCache.cmake b/cmake/os/WindowsCache.cmake index 2ba3aec16b4..f51015e436c 100644 --- a/cmake/os/WindowsCache.cmake +++ b/cmake/os/WindowsCache.cmake @@ -153,6 +153,7 @@ SET(HAVE_SIGSET CACHE INTERNAL "") SET(HAVE_SIGTERM 1 CACHE INTERNAL "") SET(HAVE_SIGTHREADMASK CACHE INTERNAL "") SET(HAVE_SIGWAIT CACHE INTERNAL "") +SET(HAVE_SIGWAITINFO CACHE INTERNAL "") SET(HAVE_SIZEOF_CHARP TRUE CACHE INTERNAL "") SET(SIZEOF_CHARP ${CMAKE_SIZEOF_VOID_P} CACHE INTERNAL "") SET(HAVE_SIZEOF_IN6_ADDR TRUE CACHE INTERNAL "") diff --git a/cmake/plugin.cmake b/cmake/plugin.cmake index 31291d263f9..5b3bac773e1 100644 --- a/cmake/plugin.cmake +++ b/cmake/plugin.cmake @@ -1,4 +1,5 @@ -# Copyright (c) 2009, 2012, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2018, Oracle and/or its affiliates. +# Copyright (c) 2011, 2018, 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 @@ -238,11 +239,13 @@ MACRO(MYSQL_ADD_PLUGIN) SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} PARENT_SCOPE) IF(NOT ARG_CLIENT AND UNIX) IF (NOT ARG_CONFIG) - SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/${target}.cnf") + SET(ARG_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${target}.cnf") FILE(WRITE ${ARG_CONFIG} "[mariadb]\nplugin-load-add=${ARG_MODULE_OUTPUT_NAME}.so\n") ENDIF() INSTALL(FILES ${ARG_CONFIG} COMPONENT ${ARG_COMPONENT} DESTINATION ${INSTALL_SYSCONF2DIR}) SET(CPACK_RPM_${ARG_COMPONENT}_USER_FILELIST ${ignored} "%config(noreplace) ${INSTALL_SYSCONF2DIR}/*" PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_POST_INSTALL_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/plugin-postin.sh PARENT_SCOPE) + SET(CPACK_RPM_${ARG_COMPONENT}_POST_TRANS_SCRIPT_FILE ${CMAKE_SOURCE_DIR}/support-files/rpm/server-posttrans.sh PARENT_SCOPE) ENDIF() ENDIF() ELSE() diff --git a/cmake/ssl.cmake b/cmake/ssl.cmake index 634ea03c3c2..aa42333a5c8 100644 --- a/cmake/ssl.cmake +++ b/cmake/ssl.cmake @@ -159,12 +159,12 @@ MACRO (MYSQL_CHECK_SSL) SET(CMAKE_REQUIRED_LIBRARIES) ELSE() IF(WITH_SSL STREQUAL "system") - MESSAGE(SEND_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support") + MESSAGE(FATAL_ERROR "Cannot find appropriate system libraries for SSL. Use WITH_SSL=bundled to enable SSL support") ENDIF() MYSQL_USE_BUNDLED_SSL() ENDIF() ELSE() - MESSAGE(SEND_ERROR + MESSAGE(FATAL_ERROR "Wrong option for WITH_SSL. Valid values are: ${WITH_SSL_DOC}") ENDIF() ENDMACRO() diff --git a/cmake/submodules.cmake b/cmake/submodules.cmake index 672a3affc1d..c2a415c6063 100644 --- a/cmake/submodules.cmake +++ b/cmake/submodules.cmake @@ -1,4 +1,10 @@ # update submodules automatically + +OPTION(UPDATE_SUBMODULES "Update submodules automatically" ON) +IF(NOT UPDATE_SUBMODULES) + RETURN() +ENDIF() + IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git") EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" config --get cmake.update-submodules WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" @@ -8,16 +14,16 @@ IF(GIT_EXECUTABLE AND EXISTS "${CMAKE_SOURCE_DIR}/.git") SET(update_result 0) ELSEIF (cmake_update_submodules MATCHES force) MESSAGE(STATUS "Updating submodules (forced)") - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --force --recursive WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE update_result) ELSEIF (cmake_update_submodules MATCHES yes) - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE update_result) ELSE() MESSAGE(STATUS "Updating submodules") - EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init + EXECUTE_PROCESS(COMMAND "${GIT_EXECUTABLE}" submodule update --init --recursive WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" RESULT_VARIABLE update_result) ENDIF() diff --git a/cmake/wsrep.cmake b/cmake/wsrep.cmake index 9fa127380a4..44e00649993 100644 --- a/cmake/wsrep.cmake +++ b/cmake/wsrep.cmake @@ -24,12 +24,15 @@ ELSE() ENDIF() OPTION(WITH_WSREP "WSREP replication API (to use, e.g. Galera Replication library)" ${with_wsrep_default}) +OPTION(WITH_WSREP_ALL + "Build all components of WSREP (unit tests, sample programs)" + OFF) # Set the patch version -SET(WSREP_PATCH_VERSION "23") +SET(WSREP_PATCH_VERSION "22") # Obtain wsrep API version -FILE(STRINGS "${MySQL_SOURCE_DIR}/wsrep/wsrep_api.h" WSREP_API_VERSION +FILE(STRINGS "${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26/wsrep_api.h" WSREP_API_VERSION LIMIT_COUNT 1 REGEX "WSREP_INTERFACE_VERSION") STRING(REGEX MATCH "([0-9]+)" WSREP_API_VERSION "${WSREP_API_VERSION}") @@ -40,4 +43,12 @@ SET(WSREP_PROC_INFO ${WITH_WSREP}) IF(WITH_WSREP) SET(WSREP_PATCH_VERSION "wsrep_${WSREP_VERSION}") + if (NOT WITH_WSREP_ALL) + SET(WSREP_LIB_WITH_UNIT_TESTS OFF CACHE BOOL + "Disable unit tests for wsrep-lib") + SET(WSREP_LIB_WITH_DBSIM OFF CACHE BOOL + "Disable building dbsim for wsrep-lib") + endif() + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/include) + INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep-lib/wsrep-API/v26) ENDIF() diff --git a/cmake/zlib.cmake b/cmake/zlib.cmake index 03d2c542ba4..e269c473f36 100644 --- a/cmake/zlib.cmake +++ b/cmake/zlib.cmake @@ -1,4 +1,4 @@ -# Copyright (c) 2009, 2013, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2009, 2018, Oracle and/or its affiliates. All rights reserved. # # 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 @@ -14,15 +14,12 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA MACRO (MYSQL_USE_BUNDLED_ZLIB) - SET(ZLIB_LIBRARY zlib) - SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib) + SET(ZLIB_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/zlib ${CMAKE_BINARY_DIR}/zlib) + SET(BUILD_BUNDLED_ZLIB 1) + SET(ZLIB_LIBRARY zlib CACHE INTERNAL "Bundled zlib library") SET(ZLIB_FOUND TRUE) SET(WITH_ZLIB "bundled" CACHE STRING "Use bundled zlib") ADD_SUBDIRECTORY(zlib) - GET_TARGET_PROPERTY(src zlib SOURCES) - FOREACH(file ${src}) - SET(ZLIB_SOURCES ${ZLIB_SOURCES} ${CMAKE_SOURCE_DIR}/zlib/${file}) - ENDFOREACH() ENDMACRO() # MYSQL_CHECK_ZLIB_WITH_COMPRESS @@ -37,16 +34,6 @@ ENDMACRO() MACRO (MYSQL_CHECK_ZLIB_WITH_COMPRESS) - IF(CMAKE_SYSTEM_NAME STREQUAL "OS400" OR - CMAKE_SYSTEM_NAME STREQUAL "AIX" OR - CMAKE_SYSTEM_NAME STREQUAL "Windows") - # Use bundled zlib on some platforms by default (system one is too - # old or not existent) - IF (NOT WITH_ZLIB) - SET(WITH_ZLIB "bundled" CACHE STRING "By default use bundled zlib on this platform") - ENDIF() - ENDIF() - IF(WITH_ZLIB STREQUAL "bundled") MYSQL_USE_BUNDLED_ZLIB() ELSE() diff --git a/config.h.cmake b/config.h.cmake index cdf3fd1a726..247d983c501 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -219,6 +219,7 @@ #cmakedefine HAVE_SIGACTION 1 #cmakedefine HAVE_SIGTHREADMASK 1 #cmakedefine HAVE_SIGWAIT 1 +#cmakedefine HAVE_SIGWAITINFO 1 #cmakedefine HAVE_SLEEP 1 #cmakedefine HAVE_SNPRINTF 1 #cmakedefine HAVE_STPCPY 1 @@ -559,12 +560,8 @@ #cmakedefine WSREP_PROC_INFO 1 #endif -#ifdef _AIX -/* - AIX includes inttypes.h from sys/types.h - Explicitly request format macros before the first inclusion of inttypes.h -*/ +#if !defined(__STDC_FORMAT_MACROS) #define __STDC_FORMAT_MACROS -#endif +#endif // !defined(__STDC_FORMAT_MACROS) #endif diff --git a/configure.cmake b/configure.cmake index d840dd4e565..08eac106e6a 100644 --- a/configure.cmake +++ b/configure.cmake @@ -400,6 +400,7 @@ CHECK_FUNCTION_EXISTS (setlocale HAVE_SETLOCALE) CHECK_FUNCTION_EXISTS (sigaction HAVE_SIGACTION) CHECK_FUNCTION_EXISTS (sigthreadmask HAVE_SIGTHREADMASK) CHECK_FUNCTION_EXISTS (sigwait HAVE_SIGWAIT) +CHECK_FUNCTION_EXISTS (sigwaitinfo HAVE_SIGWAITINFO) CHECK_FUNCTION_EXISTS (sigset HAVE_SIGSET) CHECK_FUNCTION_EXISTS (sleep HAVE_SLEEP) CHECK_FUNCTION_EXISTS (snprintf HAVE_SNPRINTF) @@ -986,11 +987,14 @@ CHECK_STRUCT_HAS_MEMBER("struct sockaddr_in6" sin6_len SET(CMAKE_EXTRA_INCLUDE_FILES) -CHECK_INCLUDE_FILE(ucontext.h HAVE_UCONTEXT_H) -IF(NOT HAVE_UCONTEXT_H) - CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_UCONTEXT_H) +CHECK_STRUCT_HAS_MEMBER("struct dirent" d_ino "dirent.h" STRUCT_DIRENT_HAS_D_INO) +CHECK_STRUCT_HAS_MEMBER("struct dirent" d_namlen "dirent.h" STRUCT_DIRENT_HAS_D_NAMLEN) +SET(SPRINTF_RETURNS_INT 1) +CHECK_INCLUDE_FILE(ucontext.h HAVE_FILE_UCONTEXT_H) +IF(NOT HAVE_FILE_UCONTEXT_H) + CHECK_INCLUDE_FILE(sys/ucontext.h HAVE_FILE_UCONTEXT_H) ENDIF() -IF(HAVE_UCONTEXT_H) +IF(HAVE_FILE_UCONTEXT_H) CHECK_FUNCTION_EXISTS(makecontext HAVE_UCONTEXT_H) ENDIF() diff --git a/debian/additions/debian-start b/debian/additions/debian-start index 40c248fd81f..7940bbe68a5 100755 --- a/debian/additions/debian-start +++ b/debian/additions/debian-start @@ -15,7 +15,7 @@ fi MYSQL="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf" MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf" -MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf" +MYUPGRADE="/usr/bin/mysql_upgrade --defaults-extra-file=/etc/mysql/debian.cnf --version-check" MYCHECK="/usr/bin/mysqlcheck --defaults-file=/etc/mysql/debian.cnf" MYCHECK_SUBJECT="WARNING: mysqlcheck has found corrupt tables" MYCHECK_PARAMS="--all-databases --fast --silent" diff --git a/debian/additions/debian-start.inc.sh b/debian/additions/debian-start.inc.sh index 0640bf9c2a6..fa5b1299bdc 100755 --- a/debian/additions/debian-start.inc.sh +++ b/debian/additions/debian-start.inc.sh @@ -60,7 +60,7 @@ function upgrade_system_tables_if_necessary() { # errors as the script is designed to be idempotent. LC_ALL=C $MYUPGRADE \ 2>&1 \ - | egrep -v '^(1|@had|ERROR (1054|1060|1061))' \ + | egrep -v '^(1|@had|ERROR (1051|1054|1060|1061|1146|1347|1348))' \ | logger -p daemon.warn -i -t$0 } diff --git a/debian/autobake-deb.sh b/debian/autobake-deb.sh index acf0e4244da..3442afbf376 100755 --- a/debian/autobake-deb.sh +++ b/debian/autobake-deb.sh @@ -102,7 +102,7 @@ fi # AWS SDK also requires the build machine to have network access and git, so # it cannot be part of the base version included in Linux distros, but a pure # custom built plugin. -if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && ping -c 1 github.com +if [[ $GCCVERSION -gt 40800 ]] && [[ ! $TRAVIS ]] && [[ -x "$(command -v git)" ]] && timeout 3s bash -c 'sed -n q > debian/control @@ -124,6 +124,12 @@ EOF sed -i -e "/-DPLUGIN_AWS_KEY_MANAGEMENT=NO/d" debian/rules fi +# Don't build cassandra package if thrift is not installed +if [[ ! -f /usr/local/include/thrift/Thrift.h && ! -f /usr/include/thrift/Thrift.h ]] +then + sed '/Package: mariadb-plugin-cassandra/,/^$/d' -i debian/control +fi + # Mroonga, TokuDB never built on Travis CI anyway, see build flags above if [[ $TRAVIS ]] then diff --git a/debian/control b/debian/control index c990f4cfe5a..2366cbc9fc2 100644 --- a/debian/control +++ b/debian/control @@ -53,6 +53,8 @@ Conflicts: libmariadbclient18 (<< 10.2.0), mariadb-server-5.2, mariadb-server-5.3, mariadb-server-5.5 (<< 5.5.33) +Breaks: libmariadbclient18 (<< ${source:Version}) +Replaces: libmariadbclient18 (<< ${source:Version}) Description: MariaDB database client library MariaDB is a fast, stable and true multi-user, multi-threaded SQL database server. SQL (Structured Query Language) is the most popular database query @@ -430,7 +432,7 @@ Recommends: libhtml-template-perl Pre-Depends: adduser (>= 3.40), debconf, mariadb-common (>= ${source:Version}) -Depends: galera-3 (>=25.3), +Depends: galera-4 (>=26.4), gawk, iproute | iproute2, libdbi-perl, @@ -594,7 +596,7 @@ Description: OQGraph storage engine for MariaDB Package: mariadb-plugin-tokudb Architecture: amd64 -Depends: libjemalloc1 (>= 3.0.0~), +Depends: libjemalloc1 (>= 3.0.0~) | libjemalloc2, mariadb-server-10.4 (= ${binary:Version}), ${misc:Depends}, ${shlibs:Depends} diff --git a/debian/mariadb-server-10.4.install b/debian/mariadb-server-10.4.install index f115b212c98..292c2c2a521 100644 --- a/debian/mariadb-server-10.4.install +++ b/debian/mariadb-server-10.4.install @@ -36,8 +36,6 @@ usr/bin/wsrep_sst_common usr/bin/wsrep_sst_mariabackup usr/bin/wsrep_sst_mysqldump usr/bin/wsrep_sst_rsync -usr/bin/wsrep_sst_xtrabackup -usr/bin/wsrep_sst_xtrabackup-v2 usr/lib/mysql/plugin/auth_ed25519.so usr/lib/mysql/plugin/auth_pam.so usr/lib/mysql/plugin/auth_pam_tool_dir/auth_pam_tool @@ -92,8 +90,7 @@ usr/share/man/man1/resolveip.1 usr/share/man/man1/wsrep_sst_common.1 usr/share/man/man1/wsrep_sst_mysqldump.1 usr/share/man/man1/wsrep_sst_rsync.1 -usr/share/man/man1/wsrep_sst_xtrabackup-v2.1 -usr/share/man/man1/wsrep_sst_xtrabackup.1 +usr/share/man/man1/wsrep_sst_mariabackup.1 usr/share/mysql/errmsg-utf8.txt usr/share/mysql/fill_help_tables.sql usr/share/mysql/maria_add_gis_sp_bootstrap.sql diff --git a/debian/mariadb-server-10.4.postinst b/debian/mariadb-server-10.4.postinst index 3d9ece55b24..c813c9bd8b3 100644 --- a/debian/mariadb-server-10.4.postinst +++ b/debian/mariadb-server-10.4.postinst @@ -2,13 +2,16 @@ . /usr/share/debconf/confmodule +# assume the filename is /path/to/mariadb-server-##.#.postinst +VER=${0: -13:4} + if [ -n "$DEBIAN_SCRIPT_DEBUG" ]; then set -v -x; DEBIAN_SCRIPT_TRACE=1; fi ${DEBIAN_SCRIPT_TRACE:+ echo "#42#DEBUG# RUNNING $0 $*" 1>&2 } export PATH=$PATH:/sbin:/usr/sbin:/bin:/usr/bin # This command can be used as pipe to syslog. With "-s" it also logs to stderr. -ERR_LOGGER="logger -p daemon.err -t mysqld_safe -i" +ERR_LOGGER="logger -p daemon.err -t mariadb-server-$VER.postinst -i" # This will make an error in a logged command immediately apparent by aborting # the install, rather than failing silently and leaving a broken install. set -o pipefail @@ -23,6 +26,8 @@ invoke() { MYSQL_BOOTSTRAP="/usr/sbin/mysqld --bootstrap --user=mysql --disable-log-bin --skip-grant-tables --default-storage-engine=myisam" +have_global_priv_table= + set_mysql_rootpw() { # forget we ever saw the password. don't use reset to keep the seen status db_set mysql-server/root_password "" @@ -33,13 +38,23 @@ set_mysql_rootpw() { return 1 fi - # this avoids us having to call "test" or "[" on $rootpw cat << EOF > $tfile USE mysql; SET sql_log_bin=0; +EOF + if test -n "$have_global_priv_table"; then + cat << EOF >> $tfile +UPDATE global_priv SET priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', PASSWORD("$rootpw")) WHERE user='root'; +EOF + else + cat << EOF >> $tfile UPDATE user SET password=PASSWORD("$rootpw") WHERE user='root'; +EOF + fi + cat << EOF >> $tfile FLUSH PRIVILEGES; EOF + # this avoids us having to call "test" or "[" on $rootpw if grep -q 'PASSWORD("")' $tfile; then retval=0 else @@ -146,7 +161,13 @@ EOF $ERR_LOGGER set -e + if test -f $mysql_datadir/mysql/global_priv.frm; then + have_global_priv_table=yes + fi + # To avoid downgrades. + touch $mysql_statedir/debian-$VER.flag + ## On every reconfiguration the maintenance user is recreated. # # - It is easier to regenerate the password every time but as people @@ -191,20 +212,29 @@ EOF chown 0:0 $dc chmod 0600 $dc - replace_query=`/bin/echo -e \ + if test -n "$have_global_priv_table"; then + replace_query=`/bin/echo -e \ "USE mysql;\n" \ - "SET sql_mode='';\n" \ - "REPLACE INTO user SET " \ - " host='localhost', user='debian-sys-maint', password=password('$pass'), " \ - " Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \ - " Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \ - " Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', " \ - " Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\ - " Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\ - " Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\ - " Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\ - " Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y',"\ - " ssl_cipher='', x509_issuer='', x509_subject='';"`; + "SELECT json_object('access',cast(-1 as unsigned), " \ + "'plugin', 'mysql_native_password', " \ + "'authentication_string', password('$pass')) INTO @all_privileges;\n"\ + "REPLACE global_priv VALUES ('localhost', 'debian-sys-maint', @all_privileges);"` + else + replace_query=`/bin/echo -e \ + "USE mysql;\n" \ + "SET sql_mode='';\n" \ + "REPLACE INTO user SET " \ + " host='localhost', user='debian-sys-maint', password=password('$pass'), " \ + " Select_priv='Y', Insert_priv='Y', Update_priv='Y', Delete_priv='Y', " \ + " Create_priv='Y', Drop_priv='Y', Reload_priv='Y', Shutdown_priv='Y', " \ + " Process_priv='Y', File_priv='Y', Grant_priv='Y', References_priv='Y', " \ + " Index_priv='Y', Alter_priv='Y', Super_priv='Y', Show_db_priv='Y', "\ + " Create_tmp_table_priv='Y', Lock_tables_priv='Y', Execute_priv='Y', "\ + " Repl_slave_priv='Y', Repl_client_priv='Y', Create_view_priv='Y', "\ + " Show_view_priv='Y', Create_routine_priv='Y', Alter_routine_priv='Y', "\ + " Create_user_priv='Y', Event_priv='Y', Trigger_priv='Y',"\ + " ssl_cipher='', x509_issuer='', x509_subject='';"`; + fi db_get mysql-server/root_password && rootpw="$RET" if ! set_mysql_rootpw; then diff --git a/debian/rules b/debian/rules index 7f0a19a512c..13d1343671a 100755 --- a/debian/rules +++ b/debian/rules @@ -1,6 +1,7 @@ #!/usr/bin/make -f export DH_VERBOSE=1 +export DEB_BUILD_HARDENING=1 # enable Debian Hardening # see: https://wiki.debian.org/Hardening @@ -113,11 +114,6 @@ override_dh_auto_install: dh_testdir dh_testroot - # If libthrift-dev was available (manually installed, as it is - # not in Debian) and ha_cassandra.so was thus built, create package, - # otherwise skip it. - [ -f $(BUILDDIR)/storage/cassandra/ha_cassandra.so ] || sed -i -e "/Package: mariadb-plugin-cassandra/,+20d" debian/control - ifneq (,$(filter linux,$(DEB_HOST_ARCH_OS))) # Copy systemd files to a location available for dh_installinit cp $(BUILDDIR)/support-files/mariadb.service debian/mariadb-server-10.4.mariadb.service diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index a4d6c361809..de640a17765 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2014, 2017, MariaDB Corporation. + Copyright (c) 2014, 2018, 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 @@ -42,43 +42,18 @@ /* Only parts of these files are included from the InnoDB codebase. The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */ -typedef void fil_space_t; - -#include "univ.i" /* include all of this */ -#include "page0size.h" - -#define FLST_BASE_NODE_SIZE (4 + 2 * FIL_ADDR_SIZE) -#define FLST_NODE_SIZE (2 * FIL_ADDR_SIZE) -#define FSEG_PAGE_DATA FIL_PAGE_DATA -#define FSEG_HEADER_SIZE 10 -#define UT_BITS_IN_BYTES(b) (((b) + 7) / 8) - -#include "ut0ut.h" -#include "ut0byte.h" -#include "mtr0types.h" #include "mach0data.h" -#include "fsp0types.h" -#include "rem0rec.h" +#include "page0page.h" #include "buf0checksum.h" /* buf_calc_page_*() */ #include "buf0buf.h" /* buf_page_is_corrupted */ -#include "fil0fil.h" /* FIL_* */ -#include "page0page.h" /* PAGE_* */ #include "page0zip.h" /* page_zip_*() */ #include "trx0undo.h" /* TRX_* */ -#include "fsp0fsp.h" /* fsp_flags_get_page_size() & - fsp_flags_get_zip_size() */ #include "ut0crc32.h" /* ut_crc32_init() */ #include "fsp0pagecompress.h" /* fil_get_compression_alg_name */ #include "fil0crypt.h" /* fil_space_verify_crypt_checksum */ #include -#ifdef UNIV_NONINL -# include "fsp0fsp.ic" -# include "mach0data.ic" -# include "ut0rnd.ic" -#endif - #ifndef PRIuMAX #define PRIuMAX "llu" #endif @@ -525,7 +500,16 @@ is_page_corrupted( normal method. */ if (is_encrypted && key_version != 0) { is_corrupted = !fil_space_verify_crypt_checksum(buf, - page_size, space_id, (ulint)cur_page_num); + page_size); + if (is_corrupted && log_file) { + fprintf(log_file, + "Page " ULINTPF ":%llu may be corrupted;" + " key_version=%u\n", + space_id, cur_page_num, + mach_read_from_4( + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION + + buf)); + } } else { is_corrupted = true; } diff --git a/extra/mariabackup/CMakeLists.txt b/extra/mariabackup/CMakeLists.txt index 7df5fa17903..623e7460ee4 100644 --- a/extra/mariabackup/CMakeLists.txt +++ b/extra/mariabackup/CMakeLists.txt @@ -40,9 +40,6 @@ IF(NOT HAVE_SYSTEM_REGEX) INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/pcre) ENDIF() -IF(WITH_WSREP) - INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/wsrep) -ENDIF() ADD_DEFINITIONS(-UMYSQL_SERVER) ######################################################################## @@ -61,19 +58,19 @@ MYSQL_ADD_EXECUTABLE(mariabackup xtrabackup.cc innobackupex.cc changed_page_bitmap.cc - datasink.c - ds_buffer.c - ds_compress.c + datasink.cc + ds_buffer.cc + ds_compress.cc ds_local.cc - ds_stdout.c - ds_tmpfile.c - ds_xbstream.c + ds_stdout.cc + ds_tmpfile.cc + ds_xbstream.cc fil_cur.cc quicklz/quicklz.c read_filt.cc write_filt.cc wsrep.cc - xbstream_write.c + xbstream_write.cc backup_mysql.cc backup_copy.cc encryption_plugin.cc @@ -100,13 +97,13 @@ ENDIF() # xbstream binary ######################################################################## MYSQL_ADD_EXECUTABLE(mbstream - ds_buffer.c + ds_buffer.cc ds_local.cc - ds_stdout.c - datasink.c - xbstream.c - xbstream_read.c - xbstream_write.c + ds_stdout.cc + datasink.cc + xbstream.cc + xbstream_read.cc + xbstream_write.cc COMPONENT backup ) diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc index 252ceb967fa..fcbecd6dfe8 100644 --- a/extra/mariabackup/backup_copy.cc +++ b/extra/mariabackup/backup_copy.cc @@ -35,8 +35,8 @@ 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., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA *******************************************************/ @@ -123,7 +123,7 @@ struct datadir_thread_ctxt_t { datadir_iter_t *it; uint n_thread; uint *count; - pthread_mutex_t count_mutex; + pthread_mutex_t* count_mutex; os_thread_id_t id; bool ret; }; @@ -236,7 +236,7 @@ datadir_iter_next_database(datadir_iter_t *it) if (os_file_closedir(it->dbdir) != 0) { msg("Warning: could not" - " close database directory %s\n", it->dbpath); + " close database directory %s", it->dbpath); it->err = DB_ERROR; @@ -277,7 +277,7 @@ datadir_iter_next_database(datadir_iter_t *it) } if (check_if_skip_database_by_path(it->dbpath)) { - msg("Skipping db: %s\n", it->dbpath); + msg("Skipping db: %s", it->dbpath); continue; } @@ -521,19 +521,15 @@ datafile_open(const char *file, datafile_cur_t *cursor, uint thread_n) /* The following call prints an error message */ os_file_get_last_error(TRUE); - msg("[%02u] error: cannot open " - "file %s\n", - thread_n, cursor->abs_path); + msg(thread_n,"error: cannot open " + "file %s", cursor->abs_path); return(false); } if (!my_stat(cursor->abs_path, &cursor->statinfo, 0)) { - msg("[%02u] error: cannot stat %s\n", - thread_n, cursor->abs_path); - + msg(thread_n, "error: cannot stat %s", cursor->abs_path); datafile_close(cursor); - return(false); } @@ -724,9 +720,8 @@ directory_exists(const char *dir, bool create) if (mkdirp(dir, 0777, MYF(0)) < 0) { my_strerror(errbuf, sizeof(errbuf), my_errno); - msg("Can not create directory %s: %s\n", dir, errbuf); + msg("Can not create directory %s: %s", dir, errbuf); return(false); - } } @@ -735,7 +730,7 @@ directory_exists(const char *dir, bool create) if (os_dir == NULL) { my_strerror(errbuf, sizeof(errbuf), my_errno); - msg("Can not open directory %s: %s\n", dir, + msg("Can not open directory %s: %s", dir, errbuf); return(false); @@ -764,7 +759,7 @@ directory_exists_and_empty(const char *dir, const char *comment) os_dir = os_file_opendir(dir, FALSE); if (os_dir == NULL) { - msg("%s can not open directory %s\n", comment, dir); + msg("%s can not open directory %s", comment, dir); return(false); } @@ -773,7 +768,7 @@ directory_exists_and_empty(const char *dir, const char *comment) os_file_closedir(os_dir); if (!empty) { - msg("%s directory %s is not empty!\n", comment, dir); + msg("%s directory %s is not empty!", comment, dir); } return(empty); @@ -822,7 +817,7 @@ datafile_copy_backup(const char *filepath, uint thread_n) of the filters value. */ if (check_if_skip_table(filepath)) { - msg_ts("[%02u] Skipping %s.\n", thread_n, filepath); + msg(thread_n,"Skipping %s.", filepath); return(true); } @@ -888,14 +883,13 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap) dstfile = ds_open(ds_data, filename, &stat); if (dstfile == NULL) { - msg("[%02u] error: " - "cannot open the destination stream for %s\n", - 0, filename); + msg("error: Can't open the destination stream for %s", + filename); goto error; } action = xb_get_copy_action("Writing"); - msg_ts("[%02u] %s %s\n", 0, action, filename); + msg("%s %s", action, filename); if (buf_len == -1) { goto error; @@ -906,7 +900,7 @@ backup_file_vprintf(const char *filename, const char *fmt, va_list ap) } /* close */ - msg_ts("[%02u] ...done\n", 0); + msg(" ...done"); free(buf); if (ds_close(dstfile)) { @@ -922,7 +916,7 @@ error: } error_close: - msg("[%02u] Error: backup file failed.\n", 0); + msg("Error: backup file failed."); return(false); /*ERROR*/ } @@ -961,7 +955,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n) data_threads[i].it = it; data_threads[i].n_thread = i + 1; data_threads[i].count = &count; - data_threads[i].count_mutex = count_mutex; + data_threads[i].count_mutex = &count_mutex; os_thread_create(func, data_threads + i, &data_threads[i].id); } @@ -982,7 +976,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n) for (i = 0; i < n; i++) { ret = data_threads[i].ret && ret; if (!data_threads[i].ret) { - msg("Error: thread %u failed.\n", i); + msg("Error: thread %u failed.", i); } } @@ -1017,14 +1011,12 @@ copy_file(ds_ctxt_t *datasink, dstfile = ds_open(datasink, dst_path, &cursor.statinfo); if (dstfile == NULL) { - msg("[%02u] error: " - "cannot open the destination stream for %s\n", - thread_n, dst_name); + msg(thread_n,"error: " + "cannot open the destination stream for %s", dst_name); goto error; } - msg_ts("[%02u] %s %s to %s\n", - thread_n, xb_get_copy_action(), src_file_path, dstfile->path); + msg(thread_n, "%s %s to %s", xb_get_copy_action(), src_file_path, dstfile->path); /* The main copy loop */ while ((res = datafile_read(&cursor)) == XB_FIL_CUR_SUCCESS) { @@ -1039,7 +1031,7 @@ copy_file(ds_ctxt_t *datasink, } /* close */ - msg_ts("[%02u] ...done\n", thread_n); + msg(thread_n," ...done"); datafile_close(&cursor); if (ds_close(dstfile)) { goto error_close; @@ -1053,7 +1045,7 @@ error: } error_close: - msg("[%02u] Error: copy_file() failed.\n", thread_n); + msg(thread_n,"Error: copy_file() failed."); return(false); /*ERROR*/ } @@ -1085,36 +1077,34 @@ move_file(ds_ctxt_t *datasink, if (file_exists(dst_file_path_abs)) { msg("Error: Move file %s to %s failed: Destination " - "file exists\n", - src_file_path, dst_file_path_abs); + "file exists", src_file_path, dst_file_path_abs); return(false); } - msg_ts("[%02u] Moving %s to %s\n", - thread_n, src_file_path, dst_file_path_abs); + msg(thread_n,"Moving %s to %s", src_file_path, dst_file_path_abs); if (my_rename(src_file_path, dst_file_path_abs, MYF(0)) != 0) { if (my_errno == EXDEV) { bool ret; ret = copy_file(datasink, src_file_path, dst_file_path, thread_n); - msg_ts("[%02u] Removing %s\n", thread_n, src_file_path); + msg(thread_n,"Removing %s", src_file_path); if (unlink(src_file_path) != 0) { my_strerror(errbuf, sizeof(errbuf), errno); - msg("Error: unlink %s failed: %s\n", + msg("Error: unlink %s failed: %s", src_file_path, errbuf); } return(ret); } my_strerror(errbuf, sizeof(errbuf), my_errno); - msg("Can not move file %s to %s: %s\n", + msg("Can not move file %s to %s: %s", src_file_path, dst_file_path_abs, errbuf); return(false); } - msg_ts("[%02u] ...done\n", thread_n); + msg(thread_n," ...done"); return(true); } @@ -1266,13 +1256,13 @@ backup_files(const char *from, bool prep_mode) prep_mode ? 1 : 2); rsync_tmpfile = fopen(rsync_tmpfile_name, "w"); if (rsync_tmpfile == NULL) { - msg("Error: can't create file %s\n", + msg("Error: can't create file %s", rsync_tmpfile_name); return(false); } } - msg_ts("Starting %s non-InnoDB tables and files\n", + msg("Starting %s non-InnoDB tables and files", prep_mode ? "prep copy of" : "to backup"); datadir_node_init(&node); @@ -1288,7 +1278,7 @@ backup_files(const char *from, bool prep_mode) ret = datafile_copy_backup(node.filepath, 1); } if (!ret) { - msg("Failed to copy file %s\n", node.filepath); + msg("Failed to copy file %s", node.filepath); goto out; } } else if (!prep_mode) { @@ -1298,7 +1288,7 @@ backup_files(const char *from, bool prep_mode) "%s/db.opt", node.filepath); if (!(ret = backup_file_printf( trim_dotslash(path), "%s", ""))) { - msg("Failed to create file %s\n", path); + msg("Failed to create file %s", path); goto out; } } @@ -1323,13 +1313,13 @@ backup_files(const char *from, bool prep_mode) cmd << "rsync -t . --files-from=" << rsync_tmpfile_name << " " << xtrabackup_target_dir; - msg_ts("Starting rsync as: %s\n", cmd.str().c_str()); + msg("Starting rsync as: %s", cmd.str().c_str()); if ((err = system(cmd.str().c_str()) && !prep_mode) != 0) { - msg_ts("Error: rsync failed with error code %d\n", err); + msg("Error: rsync failed with error code %d", err); ret = false; goto out; } - msg_ts("rsync finished successfully.\n"); + msg("rsync finished successfully."); if (!prep_mode && !opt_no_lock) { char path[FN_REFLEN]; @@ -1345,9 +1335,10 @@ backup_files(const char *from, bool prep_mode) rsync_tmpfile = fopen(rsync_tmpfile_name, "r"); if (rsync_tmpfile == NULL) { - msg("Error: can't open file %s\n", + msg("Error: can't open file %s", rsync_tmpfile_name); - return(false); + ret = false; + goto out; } while (fgets(path, sizeof(path), rsync_tmpfile)) { @@ -1360,7 +1351,7 @@ backup_files(const char *from, bool prep_mode) snprintf(dst_path, sizeof(dst_path), "%s/%s", xtrabackup_target_dir, path); - msg_ts("Removing %s\n", dst_path); + msg("Removing %s", dst_path); unlink(dst_path); } } @@ -1370,7 +1361,7 @@ backup_files(const char *from, bool prep_mode) } } - msg_ts("Finished %s non-InnoDB tables and files\n", + msg("Finished %s non-InnoDB tables and files", prep_mode ? "a prep copy of" : "backing up"); out: @@ -1386,24 +1377,24 @@ out: void backup_fix_ddl(void); -#define LSN_PREFIX_IN_SHOW_STATUS "\nLog sequence number " -static lsn_t get_current_lsn(MYSQL *connection) { - MYSQL_RES *res = xb_mysql_query(connection, "SHOW ENGINE INNODB STATUS", true, false); - if (!res) - return 0; - MYSQL_ROW row = mysql_fetch_row(res); - DBUG_ASSERT(row); - if (row) { - const char *p = strstr(row[2],LSN_PREFIX_IN_SHOW_STATUS); - DBUG_ASSERT(p); - if (p) - { - p += sizeof(LSN_PREFIX_IN_SHOW_STATUS) - 1; - return (lsn_t)strtoll(p, NULL, 10); +static lsn_t get_current_lsn(MYSQL *connection) +{ + static const char lsn_prefix[] = "\nLog sequence number "; + lsn_t lsn = 0; + if (MYSQL_RES *res = xb_mysql_query(connection, + "SHOW ENGINE INNODB STATUS", + true, false)) { + if (MYSQL_ROW row = mysql_fetch_row(res)) { + const char *p= strstr(row[2], lsn_prefix); + DBUG_ASSERT(p); + if (p) { + p += sizeof lsn_prefix - 1; + lsn = lsn_t(strtoll(p, NULL, 10)); + } } + mysql_free_result(res); } - mysql_free_result(res); - return 0; + return lsn; } lsn_t server_lsn_after_lock; @@ -1442,7 +1433,7 @@ bool backup_start() rocksdb_create_checkpoint(); } - msg_ts("Waiting for log copy thread to read lsn %llu\n", (ulonglong)server_lsn_after_lock); + msg("Waiting for log copy thread to read lsn %llu", (ulonglong)server_lsn_after_lock); backup_wait_for_lsn(server_lsn_after_lock); backup_fix_ddl(); @@ -1484,8 +1475,8 @@ bool backup_start() write_binlog_info(mysql_connection); } - if (have_flush_engine_logs) { - msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS...\n"); + if (have_flush_engine_logs && !opt_no_lock) { + msg("Executing FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS..."); xb_mysql_query(mysql_connection, "FLUSH NO_WRITE_TO_BINLOG ENGINE LOGS", false); } @@ -1509,7 +1500,7 @@ void backup_release() } if (opt_safe_slave_backup && sql_thread_started) { - msg("Starting slave SQL thread\n"); + msg("Starting slave SQL thread"); xb_mysql_query(mysql_connection, "START SLAVE SQL_THREAD", false); } @@ -1535,12 +1526,12 @@ bool backup_finish() rocksdb_backup_checkpoint(); } - msg_ts("Backup created in directory '%s'\n", xtrabackup_target_dir); + msg("Backup created in directory '%s'", xtrabackup_target_dir); if (mysql_binlog_position != NULL) { - msg("MySQL binlog position: %s\n", mysql_binlog_position); + msg("MySQL binlog position: %s", mysql_binlog_position); } if (mysql_slave_position && opt_slave_info) { - msg("MySQL slave binlog position: %s\n", + msg("MySQL slave binlog position: %s", mysql_slave_position); } @@ -1600,7 +1591,7 @@ ibx_copy_incremental_over_full() if (!(ret = copy_file(ds_data, node.filepath, node.filepath_rel, 1))) { - msg("Failed to copy file %s\n", + msg("Failed to copy file %s", node.filepath); goto cleanup; } @@ -1740,7 +1731,7 @@ copy_back() /* cd to backup directory */ if (my_setwd(xtrabackup_target_dir, MYF(MY_WME))) { - msg("cannot my_setwd %s\n", xtrabackup_target_dir); + msg("Can't my_setwd %s", xtrabackup_target_dir); return(false); } @@ -1753,7 +1744,7 @@ copy_back() srv_sys_space.set_path("."); if (!srv_sys_space.parse_params(innobase_data_file_path, true)) { - msg("syntax error in innodb_data_file_path\n"); + msg("syntax error in innodb_data_file_path"); return(false); } @@ -1867,12 +1858,12 @@ copy_back() snprintf(path, sizeof(path), "%s/%s", mysql_data_home, node.filepath_rel); - msg_ts("[%02u] Creating directory %s\n", 1, path); + msg("Creating directory %s", path); if (mkdirp(path, 0777, MYF(0)) < 0) { char errbuf[MYSYS_STRERROR_SIZE]; my_strerror(errbuf, sizeof(errbuf), my_errno); - msg("Can not create directory %s: %s\n", + msg("Can not create directory %s: %s", path, errbuf); ret = false; @@ -1880,7 +1871,7 @@ copy_back() } - msg_ts("[%02u] ...done.", 1); + msg(" ...done."); continue; } @@ -1990,14 +1981,14 @@ decrypt_decompress_file(const char *filepath, uint thread_n) if (needs_action) { - msg_ts("[%02u] %s\n", thread_n, message.str().c_str()); + msg(thread_n,"%s\n", message.str().c_str()); if (system(cmd.str().c_str()) != 0) { return(false); } if (opt_remove_original) { - msg_ts("[%02u] removing %s\n", thread_n, filepath); + msg(thread_n, "Removing %s", filepath); if (my_delete(filepath, MYF(MY_WME)) != 0) { return(false); } @@ -2038,9 +2029,9 @@ cleanup: datadir_node_free(&node); - pthread_mutex_lock(&ctxt->count_mutex); + pthread_mutex_lock(ctxt->count_mutex); --(*ctxt->count); - pthread_mutex_unlock(&ctxt->count_mutex); + pthread_mutex_unlock(ctxt->count_mutex); ctxt->ret = ret; @@ -2060,7 +2051,7 @@ decrypt_decompress() /* cd to backup directory */ if (my_setwd(xtrabackup_target_dir, MYF(MY_WME))) { - msg("cannot my_setwd %s\n", xtrabackup_target_dir); + msg("Can't my_setwd %s", xtrabackup_target_dir); return(false); } @@ -2210,8 +2201,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo rc = make_hardlink(from_path, to_path); if (rc) { - msg_ts("[%02u] Creating hardlink from %s to %s\n", - 1, from_path, to_path); + msg("Creating hardlink from %s to %s",from_path, to_path); } else { @@ -2227,7 +2217,7 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo to, 1)); } if (!rc) - exit(EXIT_FAILURE); + die("copy or move file failed"); } datadir_iter_free(it); datadir_node_free(&node); @@ -2245,14 +2235,14 @@ static void copy_or_move_dir(const char *from, const char *to, bool do_copy, boo */ static void rocksdb_lock_checkpoint() { - msg_ts("Obtaining rocksdb checkpoint lock.\n"); + msg("Obtaining rocksdb checkpoint lock."); MYSQL_RES *res = xb_mysql_query(mysql_connection, "SELECT GET_LOCK('mariabackup_rocksdb_checkpoint',3600)", true, true); MYSQL_ROW r = mysql_fetch_row(res); if (r && r[0] && strcmp(r[0], "1")) { - msg_ts("Could not obtain rocksdb checkpont lock\n"); + msg("Could not obtain rocksdb checkpont lock."); exit(EXIT_FAILURE); } mysql_free_result(res); @@ -2306,7 +2296,7 @@ static void rocksdb_create_checkpoint() if (!access(rocksdb_checkpoint_dir, 0)) { - msg_ts("Removing rocksdb checkpoint from previous backup attempt.\n"); + msg("Removing rocksdb checkpoint from previous backup attempt."); rocksdb_remove_checkpoint_directory(); } @@ -2322,15 +2312,14 @@ static void rocksdb_create_checkpoint() */ static void rocksdb_backup_checkpoint() { - msg_ts("Backing up rocksdb files.\n"); + msg("Backing up rocksdb files."); char rocksdb_backup_dir[FN_REFLEN]; snprintf(rocksdb_backup_dir, sizeof(rocksdb_backup_dir), "%s/" ROCKSDB_BACKUP_DIR , xtrabackup_target_dir); bool backup_to_directory = xtrabackup_backup && xtrabackup_stream_fmt == XB_STREAM_FMT_NONE; if (backup_to_directory) { if (my_mkdir(rocksdb_backup_dir, 0777, MYF(0))){ - msg_ts("Can't create rocksdb backup directory %s\n", rocksdb_backup_dir); - exit(EXIT_FAILURE); + die("Can't create rocksdb backup directory %s", rocksdb_backup_dir); } } copy_or_move_dir(rocksdb_checkpoint_dir, ROCKSDB_BACKUP_DIR, true, backup_to_directory); diff --git a/extra/mariabackup/backup_mysql.cc b/extra/mariabackup/backup_mysql.cc index c0b509abdbf..a9eef808008 100644 --- a/extra/mariabackup/backup_mysql.cc +++ b/extra/mariabackup/backup_mysql.cc @@ -34,8 +34,8 @@ 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., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA *******************************************************/ #define MYSQL_CLIENT @@ -105,7 +105,7 @@ xb_mysql_connect() sprintf(mysql_port_str, "%d", opt_port); if (connection == NULL) { - msg("Failed to init MySQL struct: %s.\n", + msg("Failed to init MySQL struct: %s.", mysql_error(connection)); return(NULL); } @@ -121,8 +121,8 @@ xb_mysql_connect() mysql_options(connection, MYSQL_OPT_PROTOCOL, &opt_protocol); mysql_options(connection,MYSQL_SET_CHARSET_NAME, "utf8"); - msg_ts("Connecting to MySQL server host: %s, user: %s, password: %s, " - "port: %s, socket: %s\n", opt_host ? opt_host : "localhost", + msg("Connecting to MySQL server host: %s, user: %s, password: %s, " + "port: %s, socket: %s", opt_host ? opt_host : "localhost", opt_user ? opt_user : "not set", opt_password ? "set" : "not set", opt_port != 0 ? mysql_port_str : "not set", @@ -148,13 +148,12 @@ xb_mysql_connect() opt_password, "" /*database*/, opt_port, opt_socket, 0)) { - msg("Failed to connect to MySQL server: %s.\n", - mysql_error(connection)); + msg("Failed to connect to MySQL server: %s.", mysql_error(connection)); mysql_close(connection); return(NULL); } - xb_mysql_query(connection, "SET SESSION wait_timeout=2147483", + xb_mysql_query(connection, "SET SESSION wait_timeout=2147483, max_statement_time=0", false, true); return(connection); @@ -169,10 +168,10 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result, MYSQL_RES *mysql_result = NULL; if (mysql_query(connection, query)) { - msg("Error: failed to execute query %s: %s\n", query, - mysql_error(connection)); if (die_on_error) { - exit(EXIT_FAILURE); + die("failed to execute query %s: %s", query, mysql_error(connection)); + } else { + msg("Error: failed to execute query %s: %s", query, mysql_error(connection)); } return(NULL); } @@ -180,9 +179,8 @@ xb_mysql_query(MYSQL *connection, const char *query, bool use_result, /* store result set on client if there is a result */ if (mysql_field_count(connection) > 0) { if ((mysql_result = mysql_store_result(connection)) == NULL) { - msg("Error: failed to fetch query result %s: %s\n", + die("failed to fetch query result %s: %s", query, mysql_error(connection)); - exit(EXIT_FAILURE); } if (!use_result) { @@ -317,11 +315,11 @@ check_server_version(unsigned long version_number, msg("Error: Built-in InnoDB in MySQL 5.1 is not " "supported in this release. You can either use " "Percona XtraBackup 2.0, or upgrade to InnoDB " - "plugin.\n"); + "plugin."); } else if (!version_supported) { msg("Error: Unsupported server version: '%s'. Please " "report a bug at " - "https://bugs.launchpad.net/percona-xtrabackup\n", + "https://bugs.launchpad.net/percona-xtrabackup", version_string); } @@ -408,7 +406,7 @@ get_mysql_vars(MYSQL *connection) opt_binlog_info == BINLOG_INFO_LOCKLESS) { msg("Error: --binlog-info=LOCKLESS is not supported by the " - "server\n"); + "server"); return(false); } @@ -446,7 +444,7 @@ get_mysql_vars(MYSQL *connection) have_gtid_slave = true; } - msg("Using server version %s\n", version_var); + msg("Using server version %s", version_var); if (!(ret = detect_mysql_capabilities_for_backup())) { goto out; @@ -456,17 +454,17 @@ get_mysql_vars(MYSQL *connection) if (check_if_param_set("datadir")) { if (!directory_exists(mysql_data_home, false)) { msg("Warning: option 'datadir' points to " - "nonexistent directory '%s'\n", mysql_data_home); + "nonexistent directory '%s'", mysql_data_home); } if (!directory_exists(datadir_var, false)) { msg("Warning: MySQL variable 'datadir' points to " - "nonexistent directory '%s'\n", datadir_var); + "nonexistent directory '%s'", datadir_var); } if (!equal_paths(mysql_data_home, datadir_var)) { msg("Warning: option 'datadir' has different " "values:\n" " '%s' in defaults file\n" - " '%s' in SHOW VARIABLES\n", + " '%s' in SHOW VARIABLES", mysql_data_home, datadir_var); } } @@ -565,14 +563,14 @@ detect_mysql_capabilities_for_backup() if (opt_galera_info && !have_galera_enabled) { msg("--galera-info is specified on the command " "line, but the server does not support Galera " - "replication. Ignoring the option.\n"); + "replication. Ignoring the option."); opt_galera_info = false; } if (opt_slave_info && have_multi_threaded_slave && !have_gtid_slave) { msg("The --slave-info option requires GTID enabled for a " - "multi-threaded slave.\n"); + "multi-threaded slave."); return(false); } @@ -619,7 +617,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn) const MYSQL_ROW row = mysql_fetch_row(mysql_result); if (row) { *incremental_lsn = strtoull(row[0], NULL, 10); - msg("Found and using lsn: " LSN_PF " for %s %s\n", + msg("Found and using lsn: " LSN_PF " for %s %s", *incremental_lsn, opt_incremental_history_uuid ? "uuid" : "name", opt_incremental_history_uuid ? @@ -627,7 +625,7 @@ select_incremental_lsn_from_history(lsn_t *incremental_lsn) opt_incremental_history_name); } else { msg("Error while attempting to find history record " - "for %s %s\n", + "for %s %s", opt_incremental_history_uuid ? "uuid" : "name", opt_incremental_history_uuid ? opt_incremental_history_uuid : @@ -737,7 +735,7 @@ have_queries_to_wait_for(MYSQL *connection, uint threshold) && duration >= (int)threshold && ((all_queries && is_query(info)) || is_update_query(info))) { - msg_ts("Waiting for query %s (duration %d sec): %s", + msg("Waiting for query %s (duration %d sec): %s", id, duration, info); have_to_wait = true; break; @@ -766,7 +764,7 @@ kill_long_queries(MYSQL *connection, time_t timeout) (time_t)duration >= timeout && ((all_queries && is_query(info)) || is_select_query(info))) { - msg_ts("Killing query %s (duration %d sec): %s\n", + msg("Killing query %s (duration %d sec): %s", id, (int)duration, info); snprintf(kill_stmt, sizeof(kill_stmt), "KILL %s", id); @@ -785,8 +783,8 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold) start_time = time(NULL); - msg_ts("Waiting %u seconds for queries running longer than %u seconds " - "to finish\n", timeout, threshold); + msg("Waiting %u seconds for queries running longer than %u seconds " + "to finish", timeout, threshold); while (time(NULL) <= (time_t)(start_time + timeout)) { if (!have_queries_to_wait_for(connection, threshold)) { @@ -795,7 +793,7 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold) os_thread_sleep(1000000); } - msg_ts("Unable to obtain lock. Please try again later."); + msg("Unable to obtain lock. Please try again later."); return(false); } @@ -813,7 +811,7 @@ DECLARE_THREAD(kill_query_thread)( os_event_set(kill_query_thread_started); - msg_ts("Kill query timeout %d seconds.\n", + msg("Kill query timeout %d seconds.", opt_kill_long_queries_timeout); while (time(NULL) - start_time < @@ -825,7 +823,7 @@ DECLARE_THREAD(kill_query_thread)( } if ((mysql = xb_mysql_connect()) == NULL) { - msg("Error: kill query thread failed\n"); + msg("Error: kill query thread failed"); goto stop_thread; } @@ -840,7 +838,7 @@ DECLARE_THREAD(kill_query_thread)( mysql_close(mysql); stop_thread: - msg_ts("Kill query thread stopped\n"); + msg("Kill query thread stopped"); os_event_set(kill_query_thread_stopped); @@ -871,82 +869,6 @@ stop_query_killer() } -/* -Killing connections that wait for MDL lock. -If lock-ddl-per-table is used, there can be some DDL statements - -FLUSH TABLES would hang infinitely, if DDL statements are waiting for -MDL lock, which mariabackup currently holds. Therefore we start killing -those statements from a dedicated thread, until FLUSH TABLES WITH READ LOCK -succeeds. -*/ - -static os_event_t mdl_killer_stop_event; -static os_event_t mdl_killer_finished_event; - -static -os_thread_ret_t -DECLARE_THREAD(kill_mdl_waiters_thread(void *)) -{ - MYSQL *mysql; - if ((mysql = xb_mysql_connect()) == NULL) { - msg("Error: kill mdl waiters thread failed to connect\n"); - goto stop_thread; - } - - for(;;){ - if (os_event_wait_time(mdl_killer_stop_event, 1000) == 0) - break; - - MYSQL_RES *result = xb_mysql_query(mysql, - "SELECT ID, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST " - " WHERE State='Waiting for table metadata lock'", - true, true); - while (MYSQL_ROW row = mysql_fetch_row(result)) - { - char query[64]; - - if (row[1] && !strcmp(row[1], "Killed")) - continue; - - msg_ts("Killing MDL waiting %s ('%s') on connection %s\n", - row[1], row[2], row[0]); - snprintf(query, sizeof(query), "KILL QUERY %s", row[0]); - if (mysql_query(mysql, query) && (mysql_errno(mysql) != ER_NO_SUCH_THREAD)) { - msg("Error: failed to execute query %s: %s\n", query,mysql_error(mysql)); - exit(EXIT_FAILURE); - } - } - } - - mysql_close(mysql); - -stop_thread: - msg_ts("Kill mdl waiters thread stopped\n"); - os_event_set(mdl_killer_finished_event); - os_thread_exit(); - return os_thread_ret_t(0); -} - - -static void start_mdl_waiters_killer() -{ - mdl_killer_stop_event = os_event_create(0); - mdl_killer_finished_event = os_event_create(0); - os_thread_create(kill_mdl_waiters_thread, 0, 0); -} - - -/* Tell MDL killer to stop and finish for its completion*/ -static void stop_mdl_waiters_killer() -{ - os_event_set(mdl_killer_stop_event); - os_event_wait(mdl_killer_finished_event); - - os_event_destroy(mdl_killer_stop_event); - os_event_destroy(mdl_killer_finished_event); -} - /*********************************************************************//** Function acquires either a backup tables lock, if supported by the server, or a global read lock (FLUSH TABLES WITH READ LOCK) @@ -964,35 +886,11 @@ lock_tables(MYSQL *connection) } if (have_backup_locks) { - msg_ts("Executing LOCK TABLES FOR BACKUP...\n"); + msg("Executing LOCK TABLES FOR BACKUP..."); xb_mysql_query(connection, "LOCK TABLES FOR BACKUP", false); return(true); } - if (opt_lock_ddl_per_table) { - start_mdl_waiters_killer(); - } - - if (!opt_lock_wait_timeout && !opt_kill_long_queries_timeout) { - - /* We do first a FLUSH TABLES. If a long update is running, the - FLUSH TABLES will wait but will not stall the whole mysqld, and - when the long update is done the FLUSH TABLES WITH READ LOCK - will start and succeed quickly. So, FLUSH TABLES is to lower - the probability of a stage where both mysqldump and most client - connections are stalled. Of course, if a second long update - starts between the two FLUSHes, we have that bad stall. - - Option lock_wait_timeout serve the same purpose and is not - compatible with this trick. - */ - - msg_ts("Executing FLUSH NO_WRITE_TO_BINLOG TABLES...\n"); - - xb_mysql_query(connection, - "FLUSH NO_WRITE_TO_BINLOG TABLES", false); - } - if (opt_lock_wait_timeout) { if (!wait_for_no_updates(connection, opt_lock_wait_timeout, opt_lock_wait_threshold)) { @@ -1000,7 +898,7 @@ lock_tables(MYSQL *connection) } } - msg_ts("Executing FLUSH TABLES WITH READ LOCK...\n"); + msg("Acquiring BACKUP LOCKS..."); if (opt_kill_long_queries_timeout) { start_query_killer(); @@ -1011,11 +909,10 @@ lock_tables(MYSQL *connection) "SET SESSION wsrep_causal_reads=0", false); } - xb_mysql_query(connection, "FLUSH TABLES WITH READ LOCK", false); - - if (opt_lock_ddl_per_table) { - stop_mdl_waiters_killer(); - } + xb_mysql_query(connection, "BACKUP STAGE START", true); + //xb_mysql_query(connection, "BACKUP STAGE FLUSH", true); + //xb_mysql_query(connection, "BACKUP STAGE BLOCK_DDL", true); + xb_mysql_query(connection, "BACKUP STAGE BLOCK_COMMIT", true); if (opt_kill_long_queries_timeout) { stop_query_killer(); @@ -1033,7 +930,7 @@ bool lock_binlog_maybe(MYSQL *connection) { if (have_backup_locks && !opt_no_lock && !binlog_locked) { - msg_ts("Executing LOCK BINLOG FOR BACKUP...\n"); + msg("Executing LOCK BINLOG FOR BACKUP..."); xb_mysql_query(connection, "LOCK BINLOG FOR BACKUP", false); binlog_locked = true; @@ -1052,20 +949,15 @@ void unlock_all(MYSQL *connection) { if (opt_debug_sleep_before_unlock) { - msg_ts("Debug sleep for %u seconds\n", + msg("Debug sleep for %u seconds", opt_debug_sleep_before_unlock); os_thread_sleep(opt_debug_sleep_before_unlock * 1000); } - if (binlog_locked) { - msg_ts("Executing UNLOCK BINLOG\n"); - xb_mysql_query(connection, "UNLOCK BINLOG", false); - } + msg("Executing BACKUP STAGE END"); + xb_mysql_query(connection, "BACKUP STAGE END", false); - msg_ts("Executing UNLOCK TABLES\n"); - xb_mysql_query(connection, "UNLOCK TABLES", false); - - msg_ts("All tables unlocked\n"); + msg("All tables unlocked"); } @@ -1116,7 +1008,7 @@ wait_for_safe_slave(MYSQL *connection) if (!(read_master_log_pos && slave_sql_running)) { msg("Not checking slave open temp tables for " - "--safe-slave-backup because host is not a slave\n"); + "--safe-slave-backup because host is not a slave"); goto cleanup; } @@ -1130,36 +1022,36 @@ wait_for_safe_slave(MYSQL *connection) } open_temp_tables = get_open_temp_tables(connection); - msg_ts("Slave open temp tables: %d\n", open_temp_tables); + msg("Slave open temp tables: %d", open_temp_tables); while (open_temp_tables && n_attempts--) { - msg_ts("Starting slave SQL thread, waiting %d seconds, then " + msg("Starting slave SQL thread, waiting %d seconds, then " "checking Slave_open_temp_tables again (%d attempts " - "remaining)...\n", sleep_time, n_attempts); + "remaining)...", sleep_time, n_attempts); xb_mysql_query(connection, "START SLAVE SQL_THREAD", false); os_thread_sleep(sleep_time * 1000000); xb_mysql_query(connection, "STOP SLAVE SQL_THREAD", false); open_temp_tables = get_open_temp_tables(connection); - msg_ts("Slave open temp tables: %d\n", open_temp_tables); + msg("Slave open temp tables: %d", open_temp_tables); } /* Restart the slave if it was running at start */ if (open_temp_tables == 0) { - msg_ts("Slave is safe to backup\n"); + msg("Slave is safe to backup"); goto cleanup; } result = false; if (sql_thread_started) { - msg_ts("Restarting slave SQL thread.\n"); + msg("Restarting slave SQL thread."); xb_mysql_query(connection, "START SLAVE SQL_THREAD", false); } - msg_ts("Slave_open_temp_tables did not become zero after " - "%d seconds\n", opt_safe_slave_backup_timeout); + msg("Slave_open_temp_tables did not become zero after " + "%d seconds", opt_safe_slave_backup_timeout); cleanup: free_mysql_variables(status); @@ -1201,10 +1093,8 @@ write_slave_info(MYSQL *connection) if (master == NULL || filename == NULL || position == NULL) { msg("Failed to get master binlog coordinates " - "from SHOW SLAVE STATUS\n"); - msg("This means that the server is not a " - "replication slave. Ignoring the --slave-info " - "option\n"); + "from SHOW SLAVE STATUS.This means that the server is not a " + "replication slave. Ignoring the --slave-info option"); /* we still want to continue the backup */ result = true; goto cleanup; @@ -1287,7 +1177,7 @@ write_galera_info(MYSQL *connection) if ((state_uuid == NULL && state_uuid55 == NULL) || (last_committed == NULL && last_committed55 == NULL)) { - msg("Failed to get master wsrep state from SHOW STATUS.\n"); + msg("Failed to get master wsrep state from SHOW STATUS."); result = false; goto cleanup; } @@ -1758,62 +1648,63 @@ backup_cleanup() } -static pthread_mutex_t mdl_lock_con_mutex; static MYSQL *mdl_con = NULL; +std::map spaceid_to_tablename; + void mdl_lock_init() { - pthread_mutex_init(&mdl_lock_con_mutex, NULL); mdl_con = xb_mysql_connect(); - if (mdl_con) + if (!mdl_con) { - xb_mysql_query(mdl_con, "BEGIN", false, true); + msg("FATAL: cannot create connection for MDL locks"); + exit(1); } + const char *query = + "SELECT NAME, SPACE FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES WHERE NAME LIKE '%%/%%'"; + + MYSQL_RES *mysql_result = xb_mysql_query(mdl_con, query, true, true); + while (MYSQL_ROW row = mysql_fetch_row(mysql_result)) { + int err; + ulint id = (ulint)my_strtoll10(row[1], 0, &err); + spaceid_to_tablename[id] = ut_get_name(0, row[0]); + } + mysql_free_result(mysql_result); + + xb_mysql_query(mdl_con, "BEGIN", false, true); } void mdl_lock_table(ulint space_id) { - std::ostringstream oss; - oss << "SELECT NAME " - "FROM INFORMATION_SCHEMA.INNODB_SYS_TABLES " - "WHERE SPACE = " << space_id << " AND NAME LIKE '%%/%%'"; + if (space_id == 0) + return; - pthread_mutex_lock(&mdl_lock_con_mutex); + std::string full_table_name = spaceid_to_tablename[space_id]; - MYSQL_RES *mysql_result = xb_mysql_query(mdl_con, oss.str().c_str(), true, true); + DBUG_EXECUTE_IF("rename_during_mdl_lock_table", + if (full_table_name == "`test`.`t1`") + xb_mysql_query(mysql_connection, "RENAME TABLE test.t1 to test.t2", false, true); + ); - while (MYSQL_ROW row = mysql_fetch_row(mysql_result)) { - - DBUG_EXECUTE_IF("rename_during_mdl_lock_table", - if (strcmp(row[0], "test/t1") == 0) - xb_mysql_query(mysql_connection, "RENAME TABLE test.t1 to test.t2", false, true - );); - - std::string full_table_name = ut_get_name(0,row[0]); - std::ostringstream lock_query; - lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0"; - msg_ts("Locking MDL for %s\n", full_table_name.c_str()); - if (mysql_query(mdl_con, lock_query.str().c_str())) { - msg_ts("Warning : locking MDL failed for space id %zu, name %s\n", space_id, full_table_name.c_str()); - } else { + std::ostringstream lock_query; + lock_query << "SELECT 1 FROM " << full_table_name << " LIMIT 0"; + msg("Locking MDL for %s", full_table_name.c_str()); + if (mysql_query(mdl_con, lock_query.str().c_str())) { + msg("Warning : locking MDL failed for space id %zu, name %s", space_id, full_table_name.c_str()); + } else { MYSQL_RES *r = mysql_store_result(mdl_con); mysql_free_result(r); - } } - - pthread_mutex_unlock(&mdl_lock_con_mutex); - mysql_free_result(mysql_result); } - void mdl_unlock_all() { - msg_ts("Unlocking MDL for all tables\n"); + msg("Unlocking MDL for all tables"); xb_mysql_query(mdl_con, "COMMIT", false, true); mysql_close(mdl_con); - pthread_mutex_destroy(&mdl_lock_con_mutex); + spaceid_to_tablename.clear(); } diff --git a/extra/mariabackup/changed_page_bitmap.cc b/extra/mariabackup/changed_page_bitmap.cc index b704c3a063d..bff5f64e8fa 100644 --- a/extra/mariabackup/changed_page_bitmap.cc +++ b/extra/mariabackup/changed_page_bitmap.cc @@ -203,7 +203,7 @@ log_online_read_bitmap_page( /* The following call prints an error message */ os_file_get_last_error(TRUE); msg("InnoDB: Warning: failed reading changed page bitmap " - "file \'%s\'\n", bitmap_file->name); + "file \'%s\'", bitmap_file->name); return FALSE; } @@ -282,7 +282,7 @@ log_online_setup_bitmap_file_range( bitmap_dir = os_file_opendir(srv_data_home, FALSE); if (UNIV_UNLIKELY(!bitmap_dir)) { - msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n", + msg("InnoDB: Error: failed to open bitmap directory \'%s\'", srv_data_home); return FALSE; } @@ -332,7 +332,7 @@ log_online_setup_bitmap_file_range( if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) { os_file_get_last_error(TRUE); - msg("InnoDB: Error: cannot close \'%s\'\n",srv_data_home); + msg("InnoDB: Error: cannot close \'%s\'",srv_data_home); return FALSE; } @@ -349,7 +349,7 @@ log_online_setup_bitmap_file_range( bitmap_dir = os_file_opendir(srv_data_home, FALSE); if (UNIV_UNLIKELY(!bitmap_dir)) { - msg("InnoDB: Error: failed to open bitmap directory \'%s\'\n", + msg("InnoDB: Error: failed to open bitmap directory \'%s\'", srv_data_home); return FALSE; } @@ -380,7 +380,7 @@ log_online_setup_bitmap_file_range( if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) { msg("InnoDB: Error: inconsistent bitmap file " - "directory\n"); + "directory"); free(bitmap_files->files); return FALSE; } @@ -400,7 +400,7 @@ log_online_setup_bitmap_file_range( if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) { os_file_get_last_error(TRUE); - msg("InnoDB: Error: cannot close \'%s\'\n", srv_data_home); + msg("InnoDB: Error: cannot close \'%s\'", srv_data_home); free(bitmap_files->files); return FALSE; } @@ -451,7 +451,7 @@ log_online_open_bitmap_file_read_only( /* Here and below assume that bitmap file names do not contain apostrophes, thus no need for ut_print_filename(). */ msg("InnoDB: Warning: error opening the changed page " - "bitmap \'%s\'\n", bitmap_file->name); + "bitmap \'%s\'", bitmap_file->name); return success; } @@ -495,7 +495,7 @@ log_online_diagnose_bitmap_eof( itself. */ msg("InnoDB: Warning: junk at the end of changed " - "page bitmap file \'%s\'.\n", bitmap_file->name); + "page bitmap file \'%s\'.", bitmap_file->name); } if (UNIV_UNLIKELY(!last_page_in_run)) { @@ -506,7 +506,7 @@ log_online_diagnose_bitmap_eof( for the whole server */ msg("InnoDB: Warning: changed page bitmap " "file \'%s\' does not contain a complete run " - "at the end.\n", bitmap_file->name); + "at the end.", bitmap_file->name); return FALSE; } } @@ -537,7 +537,7 @@ xb_msg_missing_lsn_data( lsn_t missing_interval_end) /*!datasink = ds; } else { - msg("Error: failed to initialize datasink.\n"); - exit(EXIT_FAILURE); + die("failed to initialize datasink."); } return ctxt; diff --git a/extra/mariabackup/ds_archive.c b/extra/mariabackup/ds_archive.cc similarity index 100% rename from extra/mariabackup/ds_archive.c rename to extra/mariabackup/ds_archive.cc diff --git a/extra/mariabackup/ds_buffer.c b/extra/mariabackup/ds_buffer.cc similarity index 97% rename from extra/mariabackup/ds_buffer.c rename to extra/mariabackup/ds_buffer.cc index 186b897c675..687311976e8 100644 --- a/extra/mariabackup/ds_buffer.c +++ b/extra/mariabackup/ds_buffer.cc @@ -71,7 +71,7 @@ buffer_init(const char *root) ds_ctxt_t *ctxt; ds_buffer_ctxt_t *buffer_ctxt; - ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t), + ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_buffer_ctxt_t), MYF(MY_FAE)); buffer_ctxt = (ds_buffer_ctxt_t *) (ctxt + 1); buffer_ctxt->buffer_size = DS_DEFAULT_BUFFER_SIZE; @@ -96,7 +96,7 @@ buffer_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat) dst_file = ds_open(pipe_ctxt, path, mystat); if (dst_file == NULL) { - exit(EXIT_FAILURE); + die("ds_open(%s) failed", path); } buffer_ctxt = (ds_buffer_ctxt_t *) ctxt->ptr; diff --git a/extra/mariabackup/ds_compress.c b/extra/mariabackup/ds_compress.cc similarity index 98% rename from extra/mariabackup/ds_compress.c rename to extra/mariabackup/ds_compress.cc index d064068a7e2..7f4744ec972 100644 --- a/extra/mariabackup/ds_compress.c +++ b/extra/mariabackup/ds_compress.cc @@ -96,7 +96,7 @@ compress_init(const char *root) /* Create and initialize the worker threads */ threads = create_worker_threads(xtrabackup_compress_threads); if (threads == NULL) { - msg("compress: failed to create worker threads.\n"); + msg("compress: failed to create worker threads."); return NULL; } @@ -244,7 +244,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) write_uint64_le(dest_file, comp_file->bytes_processed)) { msg("compress: write to the destination stream " - "failed.\n"); + "failed."); return 1; } @@ -254,7 +254,7 @@ compress_write(ds_file_t *file, const uchar *buf, size_t len) ds_write(dest_file, threads[i].to, threads[i].to_len)) { msg("compress: write to the destination stream " - "failed.\n"); + "failed."); return 1; } @@ -368,7 +368,7 @@ create_worker_threads(uint n) if (pthread_create(&thd->id, NULL, compress_worker_thread_func, thd)) { msg("compress: pthread_create() failed: " - "errno = %d\n", errno); + "errno = %d", errno); goto err; } } diff --git a/extra/mariabackup/ds_local.cc b/extra/mariabackup/ds_local.cc index 5ecc711c3a4..eea4fcecdd8 100644 --- a/extra/mariabackup/ds_local.cc +++ b/extra/mariabackup/ds_local.cc @@ -23,7 +23,6 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include #include "common.h" #include "datasink.h" -#include "univ.i" #include "fsp0fsp.h" #ifdef _WIN32 #include diff --git a/extra/mariabackup/ds_stdout.c b/extra/mariabackup/ds_stdout.cc similarity index 97% rename from extra/mariabackup/ds_stdout.c rename to extra/mariabackup/ds_stdout.cc index a6555c17352..87c4bf1a99b 100644 --- a/extra/mariabackup/ds_stdout.c +++ b/extra/mariabackup/ds_stdout.cc @@ -49,7 +49,7 @@ stdout_init(const char *root) { ds_ctxt_t *ctxt; - ctxt = my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE)); + ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t), MYF(MY_FAE)); ctxt->root = my_strdup(root, MYF(MY_FAE)); diff --git a/extra/mariabackup/ds_tmpfile.c b/extra/mariabackup/ds_tmpfile.cc similarity index 91% rename from extra/mariabackup/ds_tmpfile.c rename to extra/mariabackup/ds_tmpfile.cc index 0e5decc5a6e..9af470980e2 100644 --- a/extra/mariabackup/ds_tmpfile.c +++ b/extra/mariabackup/ds_tmpfile.cc @@ -61,7 +61,7 @@ tmpfile_init(const char *root) ds_ctxt_t *ctxt; ds_tmpfile_ctxt_t *tmpfile_ctxt; - ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t), + ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_tmpfile_ctxt_t), MYF(MY_FAE)); tmpfile_ctxt = (ds_tmpfile_ctxt_t *) (ctxt + 1); tmpfile_ctxt->file_list = NULL; @@ -178,12 +178,11 @@ tmpfile_deinit(ds_ctxt_t *ctxt) /* Walk the files in the order they have been added */ list = list_reverse(list); while (list != NULL) { - tmp_file = list->data; + tmp_file = (ds_tmp_file_t *)list->data; /* Stat the file to replace size and mtime on the original * mystat struct */ if (my_fstat(tmp_file->fd, &mystat, MYF(0))) { - msg("error: my_fstat() failed.\n"); - exit(EXIT_FAILURE); + die("my_fstat() failed."); } tmp_file->mystat.st_size = mystat.st_size; tmp_file->mystat.st_mtime = mystat.st_mtime; @@ -191,32 +190,29 @@ tmpfile_deinit(ds_ctxt_t *ctxt) dst_file = ds_open(pipe_ctxt, tmp_file->orig_path, &tmp_file->mystat); if (dst_file == NULL) { - msg("error: could not stream a temporary file to " - "'%s'\n", tmp_file->orig_path); - exit(EXIT_FAILURE); + die("could not stream a temporary file to " + "'%s'", tmp_file->orig_path); } /* copy to the destination datasink */ posix_fadvise(tmp_file->fd, 0, 0, POSIX_FADV_SEQUENTIAL); if (my_seek(tmp_file->fd, 0, SEEK_SET, MYF(0)) == MY_FILEPOS_ERROR) { - msg("error: my_seek() failed for '%s', errno = %d.\n", + die("my_seek() failed for '%s', errno = %d.", tmp_file->file->path, my_errno); - exit(EXIT_FAILURE); } offset = 0; - while ((bytes = my_read(tmp_file->fd, buf, buf_size, + while ((bytes = my_read(tmp_file->fd, (unsigned char *)buf, buf_size, MYF(MY_WME))) > 0) { posix_fadvise(tmp_file->fd, offset, buf_size, POSIX_FADV_DONTNEED); offset += buf_size; if (ds_write(dst_file, buf, bytes)) { - msg("error: cannot write to stream for '%s'.\n", + die("cannot write to stream for '%s'.", tmp_file->orig_path); - exit(EXIT_FAILURE); } } if (bytes == (size_t) -1) { - exit(EXIT_FAILURE); + die("my_read failed for %s", tmp_file->orig_path); } my_close(tmp_file->fd, MYF(MY_WME)); diff --git a/extra/mariabackup/ds_xbstream.c b/extra/mariabackup/ds_xbstream.cc similarity index 94% rename from extra/mariabackup/ds_xbstream.c rename to extra/mariabackup/ds_xbstream.cc index 74ac27ac428..8f6c231404c 100644 --- a/extra/mariabackup/ds_xbstream.c +++ b/extra/mariabackup/ds_xbstream.cc @@ -79,18 +79,18 @@ xbstream_init(const char *root __attribute__((unused))) ds_stream_ctxt_t *stream_ctxt; xb_wstream_t *xbstream; - ctxt = my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t), + ctxt = (ds_ctxt_t *)my_malloc(sizeof(ds_ctxt_t) + sizeof(ds_stream_ctxt_t), MYF(MY_FAE)); stream_ctxt = (ds_stream_ctxt_t *)(ctxt + 1); if (pthread_mutex_init(&stream_ctxt->mutex, NULL)) { - msg("xbstream_init: pthread_mutex_init() failed.\n"); + msg("xbstream_init: pthread_mutex_init() failed."); goto err; } xbstream = xb_stream_write_new(); if (xbstream == NULL) { - msg("xb_stream_write_new() failed.\n"); + msg("xb_stream_write_new() failed."); goto err; } stream_ctxt->xbstream = xbstream; @@ -143,7 +143,7 @@ xbstream_open(ds_ctxt_t *ctxt, const char *path, MY_STAT *mystat) my_xbstream_write_callback); if (xbstream_file == NULL) { - msg("xb_stream_write_open() failed.\n"); + msg("xb_stream_write_open() failed."); goto err; } @@ -177,7 +177,7 @@ xbstream_write(ds_file_t *file, const uchar *buf, size_t len) xbstream_file = stream_file->xbstream_file; if (xb_stream_write_data(xbstream_file, buf, len)) { - msg("xb_stream_write_data() failed.\n"); + msg("xb_stream_write_data() failed."); return 1; } @@ -209,7 +209,7 @@ xbstream_deinit(ds_ctxt_t *ctxt) stream_ctxt = (ds_stream_ctxt_t *) ctxt->ptr; if (xb_stream_write_done(stream_ctxt->xbstream)) { - msg("xb_stream_done() failed.\n"); + msg("xb_stream_done() failed."); } if (stream_ctxt->dest_file) { diff --git a/extra/mariabackup/encryption_plugin.cc b/extra/mariabackup/encryption_plugin.cc index 6335cdf3cd7..505ae69af7b 100644 --- a/extra/mariabackup/encryption_plugin.cc +++ b/extra/mariabackup/encryption_plugin.cc @@ -61,8 +61,7 @@ static std::string get_encryption_plugin_from_cnf() FILE *f = fopen("backup-my.cnf", "r"); if (!f) { - msg("cannot open backup-my.cnf for reading\n"); - exit(EXIT_FAILURE); + die("Can't open backup-my.cnf for reading"); } char line[512]; std::string plugin_load; @@ -183,7 +182,7 @@ void encryption_plugin_prepare_init(int argc, char **argv) std::string plugin_load= get_encryption_plugin_from_cnf(); if (plugin_load.size()) { - msg("Loading encryption plugin from %s\n", plugin_load.c_str()); + msg("Loading encryption plugin from %s", plugin_load.c_str()); } else { @@ -210,9 +209,9 @@ static void encryption_plugin_init(int argc, char **argv) /* Patch optional and mandatory plugins, we only need to load the one in xb_plugin_load. */ mysql_optional_plugins[0] = mysql_mandatory_plugins[0] = 0; plugin_maturity = MariaDB_PLUGIN_MATURITY_UNKNOWN; /* mariabackup accepts all plugins */ - msg("Loading encryption plugin\n"); + msg("Loading encryption plugin"); for (int i= 1; i < argc; i++) - msg("\t Encryption plugin parameter : '%s'\n", argv[i]); + msg("\t Encryption plugin parameter : '%s'", argv[i]); plugin_init(&argc, argv, PLUGIN_INIT_SKIP_PLUGIN_TABLE); } diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc index 1c6070378ab..f40304c07d7 100644 --- a/extra/mariabackup/fil_cur.cc +++ b/extra/mariabackup/fil_cur.cc @@ -30,6 +30,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA #include #include "fil_cur.h" +#include "fil0crypt.h" +#include "fil0pagecompress.h" #include "common.h" #include "read_filt.h" #include "xtrabackup.h" @@ -109,7 +111,6 @@ xb_fil_node_close_file( ut_a(fil_system.n_open > 0); fil_system.n_open--; - fil_n_file_opened--; if (node->space->purpose == FIL_TYPE_TABLESPACE && fil_is_user_tablespace_id(node->space->id)) { @@ -159,8 +160,11 @@ xb_fil_cur_open( /* In the backup mode we should already have a tablespace handle created by fil_ibd_load() unless it is a system tablespace. Otherwise we open the file here. */ - if (cursor->is_system() || srv_operation == SRV_OPERATION_RESTORE_DELTA - || xb_close_files) { + if (!node->is_open()) { + ut_ad(cursor->is_system() + || srv_operation == SRV_OPERATION_RESTORE_DELTA + || xb_close_files); + node->handle = os_file_create_simple_no_error_handling( 0, node->name, OS_FILE_OPEN, @@ -169,16 +173,14 @@ xb_fil_cur_open( /* The following call prints an error message */ os_file_get_last_error(TRUE); - msg("[%02u] mariabackup: error: cannot open " - "tablespace %s\n", - thread_n, cursor->abs_path); + msg(thread_n, "mariabackup: error: cannot open " + "tablespace %s", cursor->abs_path); return(XB_FIL_CUR_SKIP); } mutex_enter(&fil_system.mutex); fil_system.n_open++; - fil_n_file_opened++; if (node->space->purpose == FIL_TYPE_TABLESPACE && fil_is_user_tablespace_id(node->space->id)) { @@ -213,8 +215,8 @@ xb_fil_cur_open( cursor->statinfo.st_size = (ulonglong)max_file_size; } if (err) { - msg("[%02u] mariabackup: error: cannot fstat %s\n", - thread_n, cursor->abs_path); + msg(thread_n, "mariabackup: error: cannot fstat %s", + cursor->abs_path); xb_fil_cur_close(cursor); @@ -229,7 +231,7 @@ xb_fil_cur_open( posix_fadvise(cursor->file, 0, 0, POSIX_FADV_SEQUENTIAL); - const page_size_t page_size(cursor->node->space->flags); + const page_size_t page_size(node->space->flags); cursor->page_size = page_size; /* Allocate read buffer */ @@ -245,6 +247,19 @@ xb_fil_cur_open( cursor->buf_page_no = 0; cursor->thread_n = thread_n; + if (!node->space->crypt_data + && os_file_read(IORequestRead, + node->handle, cursor->buf, 0, + page_size.physical())) { + mutex_enter(&fil_system.mutex); + if (!node->space->crypt_data) { + node->space->crypt_data + = fil_space_read_crypt_data(page_size, + cursor->buf); + } + mutex_exit(&fil_system.mutex); + } + cursor->space_size = (ulint)(cursor->statinfo.st_size / page_size.physical()); @@ -255,6 +270,107 @@ xb_fil_cur_open( return(XB_FIL_CUR_SUCCESS); } +static bool page_is_corrupted(const byte *page, ulint page_no, + const xb_fil_cur_t *cursor, + const fil_space_t *space) +{ + byte tmp_frame[UNIV_PAGE_SIZE_MAX]; + byte tmp_page[UNIV_PAGE_SIZE_MAX]; + const ulint page_size = cursor->page_size.physical(); + ulint page_type = mach_read_from_2(page + FIL_PAGE_TYPE); + + /* We ignore the doublewrite buffer pages.*/ + if (cursor->space_id == TRX_SYS_SPACE + && page_no >= FSP_EXTENT_SIZE + && page_no < FSP_EXTENT_SIZE * 3) { + return false; + } + + /* Validate page number. */ + if (mach_read_from_4(page + FIL_PAGE_OFFSET) != page_no + && cursor->space_id != TRX_SYS_SPACE) { + /* On pages that are not all zero, the + page number must match. + + There may be a mismatch on tablespace ID, + because files may be renamed during backup. + We disable the page number check + on the system tablespace, because it may consist + of multiple files, and here we count the pages + from the start of each file.) + + The first 38 and last 8 bytes are never encrypted. */ + const ulint* p = reinterpret_cast(page); + const ulint* const end = reinterpret_cast( + page + page_size); + do { + if (*p++) { + return true; + } + } while (p != end); + + /* Whole zero page is valid. */ + return false; + } + + /* Validate encrypted pages. The first page is never encrypted. + In the system tablespace, the first page would be written with + FIL_PAGE_FILE_FLUSH_LSN at shutdown, and if the LSN exceeds + 4,294,967,295, the mach_read_from_4() below would wrongly + interpret the page as encrypted. We prevent that by checking + page_no first. */ + if (page_no + && mach_read_from_4(page + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION) + && (opt_encrypted_backup + || (space->crypt_data + && space->crypt_data->type != CRYPT_SCHEME_UNENCRYPTED))) { + + if (!fil_space_verify_crypt_checksum(page, cursor->page_size)) + return true; + + /* Compressed encrypted need to be decrypted + and decompressed for verification. */ + if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED + && !opt_extended_validation) + return false; + + memcpy(tmp_page, page, page_size); + + bool decrypted = false; + if (!space->crypt_data + || space->crypt_data->type == CRYPT_SCHEME_UNENCRYPTED + || !fil_space_decrypt(space, tmp_frame, tmp_page, + &decrypted)) { + return true; + } + + if (page_type != FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { + return buf_page_is_corrupted(true, tmp_page, + cursor->page_size, space); + } + } + + if (page_type == FIL_PAGE_PAGE_COMPRESSED) { + memcpy(tmp_page, page, page_size); + } + + if (page_type == FIL_PAGE_PAGE_COMPRESSED + || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { + ulint decomp = fil_page_decompress(tmp_frame, tmp_page); + page_type = mach_read_from_2(tmp_page + FIL_PAGE_TYPE); + + return (!decomp + || (decomp != srv_page_size + && cursor->page_size.is_compressed()) + || page_type == FIL_PAGE_PAGE_COMPRESSED + || page_type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED + || buf_page_is_corrupted(true, tmp_page, + cursor->page_size, space)); + } + + return buf_page_is_corrupted(true, page, cursor->page_size, space); +} + /************************************************************************ Reads and verifies the next block of pages from the source file. Positions the cursor after the last read non-corrupted page. @@ -266,7 +382,6 @@ xb_fil_cur_read( /*============*/ xb_fil_cur_t* cursor) /*!< in/out: source file cursor */ { - ibool success; byte* page; ulint i; ulint npages; @@ -294,14 +409,8 @@ xb_fil_cur_read( && offset + to_read == cursor->statinfo.st_size) { if (to_read < (ib_int64_t) page_size) { - msg("[%02u] mariabackup: Warning: junk at the end of " - "%s:\n", cursor->thread_n, cursor->abs_path); - msg("[%02u] mariabackup: Warning: offset = %llu, " - "to_read = %llu\n", - cursor->thread_n, - (unsigned long long) offset, - (unsigned long long) to_read); - + msg(cursor->thread_n, "Warning: junk at the end of " + "%s, offset = %llu, to_read = %llu",cursor->abs_path, (ulonglong) offset, (ulonglong) to_read); return(XB_FIL_CUR_EOF); } @@ -311,67 +420,52 @@ xb_fil_cur_read( xb_a((to_read & (page_size - 1)) == 0); - npages = (ulint) (to_read / cursor->page_size.physical()); + npages = (ulint) (to_read / page_size); retry_count = 10; ret = XB_FIL_CUR_SUCCESS; + fil_space_t *space = fil_space_acquire_for_io(cursor->space_id); + + if (!space) { + return XB_FIL_CUR_ERROR; + } + read_retry: xtrabackup_io_throttling(); cursor->buf_read = 0; cursor->buf_npages = 0; cursor->buf_offset = offset; - cursor->buf_page_no = (ulint)(offset / cursor->page_size.physical()); + cursor->buf_page_no = (ulint)(offset / page_size); - fil_space_t* space = fil_space_get(cursor->space_id); - - if (!space) { - return(XB_FIL_CUR_ERROR); + if (!os_file_read(IORequestRead, cursor->file, cursor->buf, offset, + (ulint) to_read)) { + ret = XB_FIL_CUR_ERROR; + goto func_exit; } - - success = os_file_read(IORequestRead, - cursor->file, cursor->buf, offset, - (ulint) to_read); - if (!success) { - return(XB_FIL_CUR_ERROR); - } - /* check pages for corruption and re-read if necessary. i.e. in case of partially written pages */ for (page = cursor->buf, i = 0; i < npages; page += page_size, i++) { ulint page_no = cursor->buf_page_no + i; - if (cursor->space_id == TRX_SYS_SPACE && - page_no >= FSP_EXTENT_SIZE && - page_no < FSP_EXTENT_SIZE * 3) { - /* We ignore the doublewrite buffer pages */ - } else if (!fil_space_verify_crypt_checksum( - page, cursor->page_size, space->id, page_no) - && buf_page_is_corrupted(true, page, - cursor->page_size, - space)) { + if (page_is_corrupted(page, page_no, cursor, space)){ retry_count--; + if (retry_count == 0) { - msg("[%02u] mariabackup: " + msg(cursor->thread_n, "Error: failed to read page after " "10 retries. File %s seems to be " - "corrupted.\n", cursor->thread_n, - cursor->abs_path); + "corrupted.", cursor->abs_path); ret = XB_FIL_CUR_ERROR; + buf_page_print(page, cursor->page_size); break; } - - if (retry_count == 9) { - msg("[%02u] mariabackup: " - "Database page corruption detected at page " - ULINTPF ", retrying...\n", - cursor->thread_n, page_no); - } - + msg(cursor->thread_n, "Database page corruption detected at page " + ULINTPF ", retrying...", + page_no); os_thread_sleep(100000); - goto read_retry; } cursor->buf_read += page_size; @@ -379,7 +473,8 @@ read_retry: } posix_fadvise(cursor->file, offset, to_read, POSIX_FADV_DONTNEED); - +func_exit: + space->release_for_io(); return(ret); } diff --git a/extra/mariabackup/innobackupex.cc b/extra/mariabackup/innobackupex.cc index 1e174c0fec8..ac2272bf9b0 100644 --- a/extra/mariabackup/innobackupex.cc +++ b/extra/mariabackup/innobackupex.cc @@ -34,8 +34,8 @@ 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., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *******************************************************/ @@ -738,7 +738,7 @@ ibx_get_one_option(int optid, exit(0); break; case 'v': - msg("innobackupex version %s %s (%s)\n", + printf("innobackupex version %s %s (%s)", MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); exit(0); diff --git a/extra/mariabackup/write_filt.cc b/extra/mariabackup/write_filt.cc index 382a31f859f..63b11850bfb 100644 --- a/extra/mariabackup/write_filt.cc +++ b/extra/mariabackup/write_filt.cc @@ -80,9 +80,8 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, cp->delta_buf = (unsigned char *)os_mem_alloc_large(&cp->delta_buf_size); if (!cp->delta_buf) { - msg("[%02u] mariabackup: Error: " - "cannot allocate %zu bytes\n", - cursor->thread_n, (size_t) cp->delta_buf_size); + msg(cursor->thread_n,"Can't allocate %zu bytes", + (size_t) cp->delta_buf_size); return (FALSE); } @@ -91,9 +90,9 @@ wf_incremental_init(xb_write_filt_ctxt_t *ctxt, char *dst_name, XB_DELTA_INFO_SUFFIX); const xb_delta_info_t info(cursor->page_size, cursor->space_id); if (!xb_write_delta_metadata(meta_name, &info)) { - msg("[%02u] mariabackup: Error: " - "failed to write meta info for %s\n", - cursor->thread_n, cursor->rel_path); + msg(cursor->thread_n,"Error: " + "failed to write meta info for %s", + cursor->rel_path); return(FALSE); } diff --git a/extra/mariabackup/wsrep.cc b/extra/mariabackup/wsrep.cc index c3ad1b53a21..6b57dd4e712 100644 --- a/extra/mariabackup/wsrep.cc +++ b/extra/mariabackup/wsrep.cc @@ -92,7 +92,7 @@ xb_write_galera_info(bool incremental_prepare) fp = fopen(XB_GALERA_INFO_FILENAME, "w"); if (fp == NULL) { - msg("mariabackup: error: " + die( "could not create " XB_GALERA_INFO_FILENAME ", errno = %d\n", errno); @@ -106,11 +106,10 @@ xb_write_galera_info(bool incremental_prepare) if (fprintf(fp, "%s:%lld", uuid_str, (long long) seqno) < 0) { - msg("mariabackup: error: " + die( "could not write to " XB_GALERA_INFO_FILENAME ", errno = %d\n", - errno); - exit(EXIT_FAILURE); + errno);; } fclose(fp); diff --git a/extra/mariabackup/xbstream.c b/extra/mariabackup/xbstream.cc similarity index 92% rename from extra/mariabackup/xbstream.c rename to extra/mariabackup/xbstream.cc index 03bd2fda646..04d2c51b5d1 100644 --- a/extra/mariabackup/xbstream.c +++ b/extra/mariabackup/xbstream.cc @@ -45,7 +45,6 @@ datasink_t datasink_archive; datasink_t datasink_xbstream; datasink_t datasink_compress; datasink_t datasink_tmpfile; -datasink_t datasink_buffer; static run_mode_t opt_mode; static char * opt_directory = NULL; @@ -106,7 +105,7 @@ main(int argc, char **argv) } if (opt_mode == RUN_MODE_NONE) { - msg("%s: either -c or -x must be specified.\n", my_progname); + msg("%s: either -c or -x must be specified.", my_progname); goto err; } @@ -184,7 +183,7 @@ int set_run_mode(run_mode_t mode) { if (opt_mode != RUN_MODE_NONE) { - msg("%s: can't set specify both -c and -x.\n", my_progname); + msg("%s: can't set specify both -c and -x.", my_progname); return 1; } @@ -233,7 +232,7 @@ stream_one_file(File file, xb_wstream_file_t *xbfile) while ((bytes = (ssize_t)my_read(file, buf, XBSTREAM_BUFFER_SIZE, MYF(MY_WME))) > 0) { if (xb_stream_write_data(xbfile, buf, bytes)) { - msg("%s: xb_stream_write_data() failed.\n", + msg("%s: xb_stream_write_data() failed.", my_progname); my_free(buf); return 1; @@ -262,13 +261,13 @@ mode_create(int argc, char **argv) xb_wstream_t *stream; if (argc < 1) { - msg("%s: no files are specified.\n", my_progname); + msg("%s: no files are specified.", my_progname); return 1; } stream = xb_stream_write_new(); if (stream == NULL) { - msg("%s: xb_stream_write_new() failed.\n", my_progname); + msg("%s: xb_stream_write_new() failed.", my_progname); return 1; } @@ -281,13 +280,13 @@ mode_create(int argc, char **argv) goto err; } if (!MY_S_ISREG(mystat.st_mode)) { - msg("%s: %s is not a regular file, exiting.\n", + msg("%s: %s is not a regular file, exiting.", my_progname, filepath); goto err; } if ((src_file = my_open(filepath, O_RDONLY, MYF(MY_WME))) < 0) { - msg("%s: failed to open %s.\n", my_progname, filepath); + msg("%s: failed to open %s.", my_progname, filepath); goto err; } @@ -297,7 +296,7 @@ mode_create(int argc, char **argv) } if (opt_verbose) { - msg("%s\n", filepath); + msg("%s", filepath); } if (stream_one_file(src_file, file) || @@ -338,12 +337,12 @@ file_entry_new(extract_ctxt_t *ctxt, const char *path, uint pathlen) file = ds_open(ctxt->ds_ctxt, path, NULL); if (file == NULL) { - msg("%s: failed to create file.\n", my_progname); + msg("%s: failed to create file.", my_progname); goto err; } if (opt_verbose) { - msg("%s\n", entry->path); + msg("%s", entry->path); } entry->file = file; @@ -425,7 +424,7 @@ extract_worker_thread_func(void *arg) break; } if (my_hash_insert(ctxt->filehash, (uchar *) entry)) { - msg("%s: my_hash_insert() failed.\n", + msg("%s: my_hash_insert() failed.", my_progname); pthread_mutex_unlock(ctxt->mutex); break; @@ -454,7 +453,7 @@ extract_worker_thread_func(void *arg) if (entry->offset != chunk.offset) { msg("%s: out-of-order chunk: real offset = 0x%llx, " - "expected offset = 0x%llx\n", my_progname, + "expected offset = 0x%llx", my_progname, chunk.offset, entry->offset); pthread_mutex_unlock(&entry->mutex); res = XB_STREAM_READ_ERROR; @@ -462,7 +461,7 @@ extract_worker_thread_func(void *arg) } if (ds_write(entry->file, chunk.data, chunk.length)) { - msg("%s: my_write() failed.\n", my_progname); + msg("%s: my_write() failed.", my_progname); pthread_mutex_unlock(&entry->mutex); res = XB_STREAM_READ_ERROR; break; @@ -500,12 +499,12 @@ mode_extract(int n_threads, int argc __attribute__((unused)), if (my_hash_init(&filehash, &my_charset_bin, START_FILE_HASH_SIZE, 0, 0, (my_hash_get_key) get_file_entry_key, (my_hash_free_key) file_entry_free, MYF(0))) { - msg("%s: failed to initialize file hash.\n", my_progname); + msg("%s: failed to initialize file hash.", my_progname); return 1; } if (pthread_mutex_init(&mutex, NULL)) { - msg("%s: failed to initialize mutex.\n", my_progname); + msg("%s: failed to initialize mutex.", my_progname); my_hash_free(&filehash); return 1; } @@ -520,7 +519,7 @@ mode_extract(int n_threads, int argc __attribute__((unused)), stream = xb_stream_read_new(); if (stream == NULL) { - msg("%s: xb_stream_read_new() failed.\n", my_progname); + msg("%s: xb_stream_read_new() failed.", my_progname); pthread_mutex_destroy(&mutex); ret = 1; goto exit; @@ -531,8 +530,8 @@ mode_extract(int n_threads, int argc __attribute__((unused)), ctxt.ds_ctxt = ds_ctxt; ctxt.mutex = &mutex; - tids = calloc(n_threads, sizeof(pthread_t)); - retvals = calloc(n_threads, sizeof(void*)); + tids = (pthread_t *)calloc(n_threads, sizeof(pthread_t)); + retvals = (void **)calloc(n_threads, sizeof(void*)); for (i = 0; i < n_threads; i++) pthread_create(tids + i, NULL, extract_worker_thread_func, diff --git a/extra/mariabackup/xbstream.h b/extra/mariabackup/xbstream.h index 08b017ca5ce..5ee909d0a8e 100644 --- a/extra/mariabackup/xbstream.h +++ b/extra/mariabackup/xbstream.h @@ -101,6 +101,6 @@ xb_rstream_result_t xb_stream_read_chunk(xb_rstream_t *stream, int xb_stream_read_done(xb_rstream_t *stream); -int xb_stream_validate_checksum(xb_rstream_chunk_t *chunk); +xb_rstream_result_t xb_stream_validate_checksum(xb_rstream_chunk_t *chunk); #endif diff --git a/extra/mariabackup/xbstream_read.c b/extra/mariabackup/xbstream_read.cc similarity index 89% rename from extra/mariabackup/xbstream_read.c rename to extra/mariabackup/xbstream_read.cc index 3e38cffddae..a2bcea1c7a5 100644 --- a/extra/mariabackup/xbstream_read.c +++ b/extra/mariabackup/xbstream_read.cc @@ -67,15 +67,15 @@ validate_chunk_type(uchar code) } } -int +xb_rstream_result_t xb_stream_validate_checksum(xb_rstream_chunk_t *chunk) { ulong checksum; - checksum = crc32_iso3309(0, chunk->data, (uint)chunk->length); + checksum = crc32_iso3309(0, (unsigned char *)chunk->data, (uint)chunk->length); if (checksum != chunk->checksum) { msg("xb_stream_read_chunk(): invalid checksum at offset " - "0x%llx: expected 0x%lx, read 0x%lx.\n", + "0x%llx: expected 0x%lx, read 0x%lx.", (ulonglong) chunk->checksum_offset, chunk->checksum, checksum); return XB_STREAM_READ_ERROR; @@ -86,8 +86,8 @@ xb_stream_validate_checksum(xb_rstream_chunk_t *chunk) #define F_READ(buf,len) \ do { \ - if (xb_read_full(fd, buf, len) < len) { \ - msg("xb_stream_read_chunk(): my_read() failed.\n"); \ + if (xb_read_full(fd, (uchar *)buf, len) < len) { \ + msg("xb_stream_read_chunk(): my_read() failed."); \ goto err; \ } \ } while (0) @@ -111,7 +111,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) return XB_STREAM_READ_EOF; } else if (tbytes < CHUNK_HEADER_CONSTANT_LEN) { msg("xb_stream_read_chunk(): unexpected end of stream at " - "offset 0x%llx.\n", stream->offset); + "offset 0x%llx.", stream->offset); goto err; } @@ -120,7 +120,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) /* Chunk magic value */ if (memcmp(tmpbuf, XB_STREAM_CHUNK_MAGIC, 8)) { msg("xb_stream_read_chunk(): wrong chunk magic at offset " - "0x%llx.\n", (ulonglong) stream->offset); + "0x%llx.", (ulonglong) stream->offset); goto err; } ptr += 8; @@ -135,7 +135,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) if (chunk->type == XB_CHUNK_TYPE_UNKNOWN && !(chunk->flags & XB_STREAM_FLAG_IGNORABLE)) { msg("xb_stream_read_chunk(): unknown chunk type 0x%lu at " - "offset 0x%llx.\n", (ulong) *ptr, + "offset 0x%llx.", (ulong) *ptr, (ulonglong) stream->offset); goto err; } @@ -146,7 +146,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) pathlen = uint4korr(ptr); if (pathlen >= FN_REFLEN) { msg("xb_stream_read_chunk(): path length (%lu) is too large at " - "offset 0x%llx.\n", (ulong) pathlen, stream->offset); + "offset 0x%llx.", (ulong) pathlen, stream->offset); goto err; } chunk->pathlen = pathlen; @@ -170,7 +170,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) ullval = uint8korr(tmpbuf); if (ullval > (ulonglong) SIZE_T_MAX) { msg("xb_stream_read_chunk(): chunk length is too large at " - "offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset, + "offset 0x%llx: 0x%llx.", (ulonglong) stream->offset, ullval); goto err; } @@ -181,7 +181,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) ullval = uint8korr(tmpbuf + 8); if (ullval > (ulonglong) MY_OFF_T_MAX) { msg("xb_stream_read_chunk(): chunk offset is too large at " - "offset 0x%llx: 0x%llx.\n", (ulonglong) stream->offset, + "offset 0x%llx: 0x%llx.", (ulonglong) stream->offset, ullval); goto err; } @@ -194,7 +194,7 @@ xb_stream_read_chunk(xb_rstream_t *stream, xb_rstream_chunk_t *chunk) MYF(MY_WME | MY_ALLOW_ZERO_PTR)); if (chunk->data == NULL) { msg("xb_stream_read_chunk(): failed to increase buffer " - "to %lu bytes.\n", (ulong) chunk->length); + "to %lu bytes.", (ulong) chunk->length); goto err; } chunk->buflen = chunk->length; diff --git a/extra/mariabackup/xbstream_write.c b/extra/mariabackup/xbstream_write.cc similarity index 96% rename from extra/mariabackup/xbstream_write.c rename to extra/mariabackup/xbstream_write.cc index 649bce28788..8c27db78c83 100644 --- a/extra/mariabackup/xbstream_write.c +++ b/extra/mariabackup/xbstream_write.cc @@ -55,7 +55,7 @@ xb_stream_default_write_callback(xb_wstream_file_t *file __attribute__((unused)) void *userdata __attribute__((unused)), const void *buf, size_t len) { - if (my_write(my_fileno(stdout), buf, len, MYF(MY_WME | MY_NABP))) + if (my_write(my_fileno(stdout), (const uchar *)buf, len, MYF(MY_WME | MY_NABP))) return -1; return len; } @@ -83,7 +83,7 @@ xb_stream_write_open(xb_wstream_t *stream, const char *path, path_len = strlen(path); if (path_len > FN_REFLEN) { - msg("xb_stream_write_open(): file path is too long.\n"); + msg("xb_stream_write_open(): file path is too long."); return NULL; } @@ -216,7 +216,7 @@ xb_stream_write_chunk(xb_wstream_file_t *file, const void *buf, size_t len) int8store(ptr, len); /* Payload length */ ptr += 8; - checksum = crc32_iso3309(0, buf, (uint)len); /* checksum */ + checksum = crc32_iso3309(0, (const uchar *)buf, (uint)len); /* checksum */ pthread_mutex_lock(&stream->mutex); diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index aa0ed07c205..009a4891d93 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -36,8 +36,8 @@ 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., 59 Temple -Place, Suite 330, Boston, MA 02111-1307 USA +this program; if not, write to the Free Software Foundation, Inc., +51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA *******************************************************/ @@ -185,7 +185,7 @@ xb_stream_fmt_t xtrabackup_stream_fmt = XB_STREAM_FMT_NONE; ibool xtrabackup_stream = FALSE; const char *xtrabackup_compress_alg = NULL; -ibool xtrabackup_compress = FALSE; +uint xtrabackup_compress = FALSE; uint xtrabackup_compress_threads; ulonglong xtrabackup_compress_chunk_size = 0; @@ -200,6 +200,8 @@ static char* log_ignored_opt; extern my_bool opt_use_ssl; my_bool opt_ssl_verify_server_cert; +my_bool opt_extended_validation; +my_bool opt_encrypted_backup; /* === metadata of backup === */ #define XTRABACKUP_METADATA_FILENAME "xtrabackup_checkpoints" @@ -301,6 +303,7 @@ my_bool opt_decompress = FALSE; my_bool opt_remove_original; my_bool opt_lock_ddl_per_table = FALSE; +static my_bool opt_check_privileges; extern const char *innodb_checksum_algorithm_names[]; extern TYPELIB innodb_checksum_algorithm_typelib; @@ -474,9 +477,18 @@ DECLARE_THREAD(dbug_execute_in_new_connection)(void *arg) dbug_thread_param_t *par= (dbug_thread_param_t *)arg; int err = mysql_query(par->con, par->query); int err_no = mysql_errno(par->con); - DBUG_ASSERT(par->expect_err == err); - if (err && par->expect_errno) - DBUG_ASSERT(err_no == par->expect_errno); + if(par->expect_err != err) + { + msg("FATAL: dbug_execute_in_new_connection : mysql_query '%s' returns %d, instead of expected %d", + par->query, err, par->expect_err); + _exit(1); + } + if (err && par->expect_errno && par->expect_errno != err_no) + { + msg("FATAL: dbug_execute_in_new_connection: mysql_query '%s' returns mysql_errno %d, instead of expected %d", + par->query, err_no, par->expect_errno); + _exit(1); + } mysql_close(par->con); mysql_thread_end(); os_event_t done = par->done_event; @@ -522,16 +534,18 @@ static os_event_t dbug_start_query_thread( mysql_thread_id(par->con), wait_state); for (;;) { MYSQL_RES *result = xb_mysql_query(mysql_connection,q, true, true); - if (mysql_fetch_row(result)) { + bool exists = mysql_fetch_row(result) != NULL; + mysql_free_result(result); + if (exists) { goto end; } - msg_ts("Waiting for query '%s' on connection %lu to " + msg("Waiting for query '%s' on connection %lu to " " reach state '%s'", query, mysql_thread_id(par->con), wait_state); my_sleep(1000); } end: - msg_ts("query '%s' on connection %lu reached state '%s'", query, + msg("query '%s' on connection %lu reached state '%s'", query, mysql_thread_id(par->con), wait_state); return par->done_event; } @@ -577,7 +591,9 @@ std::string filename_to_spacename(const byte *filename, size_t len) char *db = strrchr(f, '/'); ut_a(db); *table = '/'; - return std::string(db+1); + std::string s(db+1); + free(f); + return s; } /** Report an operation to create, delete, or rename a file during backup. @@ -587,7 +603,7 @@ std::string filename_to_spacename(const byte *filename, size_t len) @param[in] len length of name, in bytes @param[in] new_name new file name (NULL if not rename) @param[in] new_len length of new_name, in bytes (0 if NULL) */ -void backup_file_op(ulint space_id, const byte* flags, +static void backup_file_op(ulint space_id, const byte* flags, const byte* name, ulint len, const byte* new_name, ulint new_len) { @@ -600,41 +616,123 @@ void backup_file_op(ulint space_id, const byte* flags, if (flags) { ddl_tracker.id_to_name[space_id] = filename_to_spacename(name, len); - msg("DDL tracking : create %zu \"%.*s\": %x\n", + msg("DDL tracking : create %zu \"%.*s\": %x", space_id, int(len), name, mach_read_from_4(flags)); } else if (new_name) { ddl_tracker.id_to_name[space_id] = filename_to_spacename(new_name, new_len); - msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"\n", + msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"", space_id, int(len), name, int(new_len), new_name); } else { ddl_tracker.drops.insert(space_id); - msg("DDL tracking : delete %zu \"%.*s\"\n", space_id, int(len), name); + msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); } pthread_mutex_unlock(&backup_mutex); } +/* + This callback is called if DDL operation is detected, + at the end of backup + + Normally, DDL operations are blocked due to FTWRL, + but in rare cases of --no-lock, they are not. + + We will abort backup in this case. +*/ +static void backup_file_op_fail(ulint space_id, const byte* flags, + const byte* name, ulint len, + const byte* new_name, ulint new_len) +{ + ut_a(opt_no_lock); + bool fail; + if (flags) { + msg("DDL tracking : create %zu \"%.*s\": %x", + space_id, int(len), name, mach_read_from_4(flags)); + std::string spacename = filename_to_spacename(name, len); + fail = !check_if_skip_table(spacename.c_str()); + } + else if (new_name) { + msg("DDL tracking : rename %zu \"%.*s\",\"%.*s\"", + space_id, int(len), name, int(new_len), new_name); + std::string spacename = filename_to_spacename(name, len); + std::string new_spacename = filename_to_spacename(new_name, new_len); + fail = !check_if_skip_table(spacename.c_str()) || !check_if_skip_table(new_spacename.c_str()); + } + else { + std::string spacename = filename_to_spacename(name, len); + fail = !check_if_skip_table(spacename.c_str()); + msg("DDL tracking : delete %zu \"%.*s\"", space_id, int(len), name); + } + if (fail) { + die("DDL operation detected in the late phase of backup." + "Backup is inconsistent. Remove --no-lock option to fix."); + } +} + + /** Callback whenever MLOG_INDEX_LOAD happens. @param[in] space_id space id to check */ static void backup_optimized_ddl_op(ulint space_id) { - // TODO : handle incremental - if (xtrabackup_incremental) - return; - pthread_mutex_lock(&backup_mutex); ddl_tracker.optimized_ddl.insert(space_id); pthread_mutex_unlock(&backup_mutex); } +/* + Optimized DDL callback at the end of backup that + run with --no-lock. Usually aborts the backup. +*/ +static void backup_optimized_ddl_op_fail(ulint space_id) { + ut_a(opt_no_lock); + msg("DDL tracking : optimized DDL on space %zu", space_id); + if (ddl_tracker.tables_in_backup.find(space_id) != ddl_tracker.tables_in_backup.end()) { + msg("ERROR : Optimized DDL operation detected in the late phase of backup." + "Backup is inconsistent. Remove --no-lock option to fix."); + exit(EXIT_FAILURE); + } +} + + +/* + Retrieve default data directory, to be used with --copy-back. + + On Windows, default datadir is ..\data, relative to the + directory where mariabackup.exe is located(usually "bin") + + Elsewhere, the compiled-in constant MYSQL_DATADIR is used. +*/ +static char *get_default_datadir() { + static char ddir[] = MYSQL_DATADIR; +#ifdef _WIN32 + static char buf[MAX_PATH]; + DWORD size = (DWORD)sizeof(buf) - 1; + if (GetModuleFileName(NULL, buf, size) <= size) + { + char *p; + if ((p = strrchr(buf, '\\'))) + { + *p = 0; + if ((p = strrchr(buf, '\\'))) + { + strncpy(p + 1, "data", buf + MAX_PATH - p); + return buf; + } + } + } +#endif + return ddir; +} + + /* ======== Date copying thread context ======== */ typedef struct { datafiles_iter_t *it; uint num; uint *count; - pthread_mutex_t count_mutex; + pthread_mutex_t* count_mutex; os_thread_id_t id; } data_thread_ctxt_t; @@ -661,6 +759,8 @@ enum options_xtrabackup OPT_XTRA_DATABASES, OPT_XTRA_DATABASES_FILE, OPT_XTRA_PARALLEL, + OPT_XTRA_EXTENDED_VALIDATION, + OPT_XTRA_ENCRYPTED_BACKUP, OPT_XTRA_STREAM, OPT_XTRA_COMPRESS, OPT_XTRA_COMPRESS_THREADS, @@ -734,7 +834,8 @@ enum options_xtrabackup OPT_PROTOCOL, OPT_LOCK_DDL_PER_TABLE, OPT_ROCKSDB_DATADIR, - OPT_BACKUP_ROCKSDB + OPT_BACKUP_ROCKSDB, + OPT_XTRA_CHECK_PRIVILEGES }; struct my_option xb_client_options[] = @@ -1117,6 +1218,22 @@ struct my_option xb_server_options[] = (G_PTR*) &xtrabackup_parallel, (G_PTR*) &xtrabackup_parallel, 0, GET_INT, REQUIRED_ARG, 1, 1, INT_MAX, 0, 0, 0}, + {"extended_validation", OPT_XTRA_EXTENDED_VALIDATION, + "Enable extended validation for Innodb data pages during backup phase. " + "Will slow down backup considerably, in case encryption is used. " + "May fail if tables are created during the backup.", + (G_PTR*)&opt_extended_validation, + (G_PTR*)&opt_extended_validation, + 0, GET_BOOL, NO_ARG, FALSE, 0, 0, 0, 0, 0}, + + {"encrypted_backup", OPT_XTRA_ENCRYPTED_BACKUP, + "In --backup, assume that nonzero key_version implies that the page" + " is encrypted. Use --backup --skip-encrypted-backup to allow" + " copying unencrypted that were originally created before MySQL 5.1.48.", + (G_PTR*)&opt_encrypted_backup, + (G_PTR*)&opt_encrypted_backup, + 0, GET_BOOL, NO_ARG, TRUE, 0, 0, 0, 0, 0}, + {"log", OPT_LOG, "Ignored option for MySQL option compatibility", (G_PTR*) &log_ignored_opt, (G_PTR*) &log_ignored_opt, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -1287,6 +1404,10 @@ struct my_option xb_server_options[] = &xb_backup_rocksdb, &xb_backup_rocksdb, 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, + {"check-privileges", OPT_XTRA_CHECK_PRIVILEGES, "Check database user " + "privileges fro the backup user", + &opt_check_privileges, &opt_check_privileges, + 0, GET_BOOL, NO_ARG, 1, 0, 0, 0, 0, 0 }, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -1327,14 +1448,13 @@ debug_sync_point(const char *name) xtrabackup_target_dir); fp = fopen(pid_path, "w"); if (fp == NULL) { - msg("mariabackup: Error: cannot open %s\n", pid_path); - exit(EXIT_FAILURE); + die("Can't open open %s", pid_path); } fprintf(fp, "%u\n", (uint) pid); fclose(fp); msg("mariabackup: DEBUG: Suspending at debug sync point '%s'. " - "Resume with 'kill -SIGCONT %u'.\n", name, (uint) pid); + "Resume with 'kill -SIGCONT %u'.", name, (uint) pid); debug_sync_resumed= 0; kill(pid, SIGSTOP); @@ -1343,13 +1463,13 @@ debug_sync_point(const char *name) } /* On resume */ - msg("mariabackup: DEBUG: removing the pid file.\n"); + msg("mariabackup: DEBUG: removing the pid file."); my_delete(pid_path, MYF(MY_WME)); #endif } -static std::vector tables_for_export; +static std::set tables_for_export; static void append_export_table(const char *dbname, const char *tablename, bool is_remote) { @@ -1361,7 +1481,15 @@ static void append_export_table(const char *dbname, const char *tablename, bool char *p=strrchr(buf, '.'); if (p) *p=0; - tables_for_export.push_back(ut_get_name(0,buf)); + std::string name=ut_get_name(0, buf); + /* Strip partition name comment from table name, if any */ + if (ends_with(name.c_str(), "*/")) + { + size_t pos= name.rfind("/*"); + if (pos != std::string::npos) + name.resize(pos); + } + tables_for_export.insert(name); } } @@ -1376,9 +1504,10 @@ static int create_bootstrap_file() fputs("SET NAMES UTF8;\n",f); enumerate_ibd_files(append_export_table); - for (size_t i= 0; i < tables_for_export.size(); i++) + for (std::set::iterator it = tables_for_export.begin(); + it != tables_for_export.end(); it++) { - const char *tab = tables_for_export[i].c_str(); + const char *tab = it->c_str(); fprintf(f, "BEGIN NOT ATOMIC " "DECLARE CONTINUE HANDLER FOR NOT FOUND,SQLEXCEPTION BEGIN END;" @@ -1408,7 +1537,7 @@ static int prepare_export() snprintf(cmdline, sizeof cmdline, IF_WIN("\"","") "\"%s\" --mysqld \"%s\" " " --defaults-extra-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." - " --innodb --innodb-fast-shutdown=0" + " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" " --console --skip-log-error --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), mariabackup_exe, @@ -1420,7 +1549,7 @@ static int prepare_export() sprintf(cmdline, IF_WIN("\"","") "\"%s\" --mysqld" " --defaults-file=./backup-my.cnf --defaults-group-suffix=%s --datadir=." - " --innodb --innodb-fast-shutdown=0" + " --innodb --innodb-fast-shutdown=0 --loose-partition" " --innodb_purge_rseg_truncate_frequency=1 --innodb-buffer-pool-size=%llu" " --console --log-error= --bootstrap < " BOOTSTRAP_FILENAME IF_WIN("\"",""), mariabackup_exe, @@ -1454,7 +1583,7 @@ static const char *xb_server_default_groups[]= static void print_version(void) { - msg("%s based on MariaDB server %s %s (%s) \n", + msg("%s based on MariaDB server %s %s (%s)", my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE); } @@ -1579,7 +1708,7 @@ xb_get_one_option(int optid, xtrabackup_stream_fmt = XB_STREAM_FMT_XBSTREAM; else { - msg("Invalid --stream argument: %s\n", argument); + msg("Invalid --stream argument: %s", argument); return 1; } xtrabackup_stream = TRUE; @@ -1589,7 +1718,7 @@ xb_get_one_option(int optid, xtrabackup_compress_alg = "quicklz"; else if (strcasecmp(argument, "quicklz")) { - msg("Invalid --compress argument: %s\n", argument); + msg("Invalid --compress argument: %s", argument); return 1; } xtrabackup_compress = TRUE; @@ -1654,8 +1783,10 @@ static bool innodb_init_param() /* === some variables from mysqld === */ memset((G_PTR) &mysql_tmpdir_list, 0, sizeof(mysql_tmpdir_list)); - if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) + if (init_tmpdir(&mysql_tmpdir_list, opt_mysql_tmpdir)) { + msg("init_tmpdir() failed"); return true; + } xtrabackup_tmpdir = my_tmpdir(&mysql_tmpdir_list); /* dummy for initialize all_charsets[] */ get_charset_name(0); @@ -1673,9 +1804,9 @@ static bool innodb_init_param() srv_page_size_shift = ulong(n_shift); srv_page_size = 1U << n_shift; msg("InnoDB: The universal page size of the " - "database is set to %lu.\n", srv_page_size); + "database is set to %lu.", srv_page_size); } else { - msg("InnoDB: Error: invalid value of " + msg("invalid value of " "innobase_page_size: %lld", innobase_page_size); goto error; } @@ -1688,12 +1819,12 @@ static bool innodb_init_param() if (sizeof(ulint) == 4) { if (xtrabackup_use_memory > UINT_MAX32) { msg("mariabackup: use-memory can't be over 4GB" - " on 32-bit systems\n"); + " on 32-bit systems"); } if (innobase_buffer_pool_size > UINT_MAX32) { msg("mariabackup: innobase_buffer_pool_size can't be " - "over 4GB on 32-bit systems\n"); + "over 4GB on 32-bit systems"); goto error; } @@ -1706,10 +1837,10 @@ static bool innodb_init_param() read from MySQL .cnf file */ if (xtrabackup_backup) { - msg("mariabackup: using the following InnoDB configuration:\n"); + msg("mariabackup: using the following InnoDB configuration:"); } else { msg("mariabackup: using the following InnoDB configuration " - "for recovery:\n"); + "for recovery:"); } /*--------------- Data files -------------------------*/ @@ -1718,7 +1849,7 @@ static bool innodb_init_param() srv_data_home = (xtrabackup_backup && innobase_data_home_dir ? innobase_data_home_dir : default_path); - msg("mariabackup: innodb_data_home_dir = %s\n", srv_data_home); + msg("innodb_data_home_dir = %s", srv_data_home); /* Set default InnoDB data file size to 10 MB and let it be auto-extending. Thus users can use InnoDB in >= 4.0 without having @@ -1727,7 +1858,7 @@ static bool innodb_init_param() if (!innobase_data_file_path) { innobase_data_file_path = (char*) "ibdata1:10M:autoextend"; } - msg("mariabackup: innodb_data_file_path = %s\n", + msg("innodb_data_file_path = %s", innobase_data_file_path); /* This is the first time univ_page_size is used. @@ -1757,13 +1888,12 @@ static bool innodb_init_param() if (xtrabackup_prepare && xtrabackup_incremental_dir) { srv_log_group_home_dir = xtrabackup_incremental_dir; } - msg("mariabackup: innodb_log_group_home_dir = %s\n", + msg("innodb_log_group_home_dir = %s", srv_log_group_home_dir); os_normalize_path(srv_log_group_home_dir); if (strchr(srv_log_group_home_dir, ';')) { - msg("syntax error in innodb_log_group_home_dir, "); goto error; } @@ -1811,8 +1941,7 @@ static bool innodb_init_param() #elif defined(LINUX_NATIVE_AIO) if (srv_use_native_aio) { - ut_print_timestamp(stderr); - msg(" InnoDB: Using Linux native AIO\n"); + msg("InnoDB: Using Linux native AIO"); } #else /* Currently native AIO is supported only on windows and linux @@ -1857,7 +1986,7 @@ static bool innodb_init() } if (err != DB_SUCCESS) { - msg("mariabackup: innodb_init() returned %d (%s).\n", + msg("mariabackup: innodb_init() returned %d (%s).", err, ut_strerr(err)); innodb_shutdown(); return(TRUE); @@ -1881,7 +2010,7 @@ xtrabackup_read_metadata(char *filename) fp = fopen(filename,"r"); if(!fp) { - msg("mariabackup: Error: cannot open %s\n", filename); + msg("Error: cannot open %s", filename); return(FALSE); } @@ -1960,8 +2089,7 @@ xtrabackup_stream_metadata(ds_ctxt_t *ds_ctxt) stream = ds_open(ds_ctxt, XTRABACKUP_METADATA_FILENAME, &mystat); if (stream == NULL) { - msg("mariabackup: Error: cannot open output stream " - "for %s\n", XTRABACKUP_METADATA_FILENAME); + msg("Error: cannot open output stream for %s", XTRABACKUP_METADATA_FILENAME); return(FALSE); } @@ -1993,7 +2121,7 @@ xtrabackup_write_metadata(const char *filepath) fp = fopen(filepath, "w"); if(!fp) { - msg("mariabackup: Error: cannot open %s\n", filepath); + msg("Error: cannot open %s", filepath); return(FALSE); } if (fwrite(buf, len, 1, fp) < 1) { @@ -2042,7 +2170,7 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info) fclose(fp); if (page_size == ULINT_UNDEFINED) { - msg("mariabackup: page_size is required in %s\n", filepath); + msg("page_size is required in %s", filepath); r = FALSE; } else { info->page_size = page_size_t(zip_size ? zip_size : page_size, @@ -2052,7 +2180,7 @@ xb_read_delta_metadata(const char *filepath, xb_delta_info_t *info) if (info->space_id == ULINT_UNDEFINED) { msg("mariabackup: Warning: This backup was taken with XtraBackup 2.0.1 " "or earlier, some DDL operations between full and incremental " - "backups may be handled incorrectly\n"); + "backups may be handled incorrectly"); } return(r); @@ -2085,8 +2213,7 @@ xb_write_delta_metadata(const char *filename, const xb_delta_info_t *info) f = ds_open(ds_meta, filename, &mystat); if (f == NULL) { - msg("mariabackup: Error: cannot open output stream for %s\n", - filename); + msg("Error: Can't open output stream for %s",filename); return(FALSE); } @@ -2260,6 +2387,18 @@ check_if_skip_table( const char *ptr; char *eptr; + + dbname = NULL; + tbname = name; + while ((ptr = strchr(tbname, '/')) != NULL) { + dbname = tbname; + tbname = ptr + 1; + } + + if (strncmp(tbname, tmp_file_prefix, tmp_file_prefix_length) == 0) { + return TRUE; + } + if (regex_exclude_list.empty() && regex_include_list.empty() && tables_include_hash == NULL && @@ -2269,13 +2408,6 @@ check_if_skip_table( return(FALSE); } - dbname = NULL; - tbname = name; - while ((ptr = strchr(tbname, '/')) != NULL) { - dbname = tbname; - tbname = ptr + 1; - } - if (dbname == NULL) { return(FALSE); } @@ -2394,7 +2526,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name= if (fil_is_user_tablespace_id(node->space->id) && check_if_skip_table(node_name)) { - msg("[%02u] Skipping %s.\n", thread_n, node_name); + msg(thread_n, "Skipping %s.", node_name); return(FALSE); } @@ -2440,26 +2572,22 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name= if (write_filter->init != NULL && !write_filter->init(&write_filt_ctxt, dst_name, &cursor)) { - msg("[%02u] mariabackup: error: " - "failed to initialize page write filter.\n", thread_n); + msg (thread_n, "mariabackup: error: failed to initialize page write filter."); goto error; } dstfile = ds_open(ds_data, dst_name, &cursor.statinfo); if (dstfile == NULL) { - msg("[%02u] mariabackup: error: " - "cannot open the destination stream for %s\n", - thread_n, dst_name); + msg(thread_n,"mariabackup: error: can't open the destination stream for %s", dst_name); goto error; } action = xb_get_copy_action(); if (xtrabackup_stream) { - msg_ts("[%02u] %s %s\n", thread_n, action, node_path); + msg(thread_n, "%s %s", action, node_path); } else { - msg_ts("[%02u] %s %s to %s\n", thread_n, action, - node_path, dstfile->path); + msg(thread_n, "%s %s to %s", action, node_path, dstfile->path); } /* The main copy loop */ @@ -2483,7 +2611,7 @@ xtrabackup_copy_datafile(fil_node_t* node, uint thread_n, const char *dest_name= pthread_mutex_unlock(&backup_mutex); /* close */ - msg_ts("[%02u] ...done\n", thread_n); + msg(thread_n," ...done"); xb_fil_cur_close(&cursor); if (ds_close(dstfile)) { rc = TRUE; @@ -2501,8 +2629,7 @@ error: if (write_filter && write_filter->deinit) { write_filter->deinit(&write_filt_ctxt);; } - msg("[%02u] mariabackup: Error: " - "xtrabackup_copy_datafile() failed.\n", thread_n); + msg(thread_n, "mariabackup: xtrabackup_copy_datafile() failed."); return(TRUE); /*ERROR*/ skip: @@ -2513,11 +2640,7 @@ skip: if (write_filter && write_filter->deinit) { write_filter->deinit(&write_filt_ctxt); } - msg("[%02u] mariabackup: Warning: We assume the " - "table was dropped during xtrabackup execution " - "and ignore the file.\n", thread_n); - msg("[%02u] mariabackup: Warning: skipping tablespace %s.\n", - thread_n, node_name); + msg(thread_n,"Warning: We assume the table was dropped during xtrabackup execution and ignore the tablespace %s", node_name); return(FALSE); } @@ -2542,9 +2665,8 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last) && scanned_checkpoint - checkpoint >= 0x80000000UL) { /* Garbage from a log buffer flush which was made before the most recent database recovery */ - msg("mariabackup: checkpoint wrap: " - LSN_PF ",%zx,%zx\n", - scanned_lsn, scanned_checkpoint, checkpoint); + msg(0,"checkpoint wrap: " LSN_PF ",%zx,%zx", + scanned_lsn, scanned_checkpoint, checkpoint); break; } @@ -2564,8 +2686,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last) } else if (data_len >= log_sys.trailer_offset() || data_len <= LOG_BLOCK_HDR_SIZE) { /* We got a garbage block (abrupt end of the log). */ - msg("mariabackup: garbage block: " LSN_PF ",%zu\n", - scanned_lsn, data_len); + msg(0,"garbage block: " LSN_PF ",%zu",scanned_lsn, data_len); break; } else { /* We got a partial block (abrupt end of the log). */ @@ -2576,7 +2697,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last) if (more_data && recv_parse_log_recs(0, STORE_NO, false)) { - msg("mariabackup: copying the log failed \n"); + msg("Error: copying the log failed"); return(0); } @@ -2595,8 +2716,7 @@ static lsn_t xtrabackup_copy_log(lsn_t start_lsn, lsn_t end_lsn, bool last) } if (ds_write(dst_log_file, log_sys.buf, write_size)) { - msg("mariabackup: Error: " - "write to logfile failed\n"); + msg("Error: write to logfile failed"); return(0); } } @@ -2632,7 +2752,7 @@ static bool xtrabackup_copy_logfile(bool last = false) || lsn != start_lsn) { break; } - msg("Retrying read of log at LSN=" LSN_PF "\n", lsn); + msg("Retrying read of log at LSN=" LSN_PF, lsn); my_sleep(1000); } @@ -2642,15 +2762,13 @@ static bool xtrabackup_copy_logfile(bool last = false) log_mutex_exit(); if (!start_lsn) { - msg("mariabackup: Error: xtrabackup_copy_logfile()" - " failed.\n"); - exit(EXIT_FAILURE); + die("xtrabackup_copy_logfile() failed."); } } while (start_lsn == end_lsn); ut_ad(start_lsn == log_sys.log.scanned_lsn); - msg_ts(">> log scanned up to (" LSN_PF ")\n", start_lsn); + msg(">> log scanned up to (" LSN_PF ")", start_lsn); /* update global variable*/ pthread_mutex_lock(&backup_mutex); @@ -2759,7 +2877,7 @@ static void dbug_mariabackup_event(const char *event,const char *key) } char *sql = getenv(envvar); if (sql) { - msg("dbug_mariabackup_event : executing '%s'\n", sql); + msg("dbug_mariabackup_event : executing '%s'", sql); xb_mysql_query(mysql_connection, sql, false, true); } @@ -2790,24 +2908,19 @@ DECLARE_THREAD(data_copy_thread_func)( debug_sync_point("data_copy_thread_func"); while ((node = datafiles_iter_next(ctxt->it)) != NULL) { - DBUG_MARIABACKUP_EVENT("before_copy", node->space->name); - - /* copy the datafile */ if(xtrabackup_copy_datafile(node, num)) { - msg("[%02u] mariabackup: Error: " - "failed to copy datafile.\n", num); - exit(EXIT_FAILURE); + die("failed to copy datafile."); } DBUG_MARIABACKUP_EVENT("after_copy", node->space->name); } - pthread_mutex_lock(&ctxt->count_mutex); + pthread_mutex_lock(ctxt->count_mutex); (*ctxt->count)--; - pthread_mutex_unlock(&ctxt->count_mutex); + pthread_mutex_unlock(ctxt->count_mutex); my_thread_end(); os_thread_exit(); @@ -2974,12 +3087,19 @@ xb_load_single_table_tablespace( Datafile *file = xb_new_datafile(name, is_remote); if (file->open_read_only(true) != DB_SUCCESS) { - msg("Can't open datafile %s\n", name); - ut_free(name); - exit(EXIT_FAILURE); + die("Can't open datafile %s", name); } - err = file->validate_first_page(&flush_lsn); + for (int i = 0; i < 10; i++) { + err = file->validate_first_page(&flush_lsn); + if (err != DB_CORRUPTION) { + break; + } + + my_sleep(1000); + } + + bool is_empty_file = file->exists() && file->is_empty_file(); if (err == DB_SUCCESS && file->space_id() != SRV_TMP_SPACE_ID) { os_offset_t node_size = os_file_get_size(file->handle()); @@ -2995,11 +3115,8 @@ xb_load_single_table_tablespace( ut_a(space != NULL); - if (!fil_node_create(file->filepath(), ulint(n_pages), space, - false, false)) { - ut_error; - } - + space->add(file->filepath(), OS_FILE_CLOSED, ulint(n_pages), + false, false); /* by opening the tablespace we forcing node and space objects in the cache to be populated with fields from space header */ space->open(); @@ -3014,10 +3131,8 @@ xb_load_single_table_tablespace( delete file; - if (err != DB_SUCCESS && err != DB_CORRUPTION && xtrabackup_backup) { - /* allow corrupted first page for xtrabackup, it could be just - zero-filled page, which we restore from redo log later */ - exit(EXIT_FAILURE); + if (err != DB_SUCCESS && xtrabackup_backup && !is_empty_file) { + die("Failed to not validate first page of the file %s, error %d",name, (int)err); } } @@ -3163,35 +3278,24 @@ the first slot rollback segments of TRX_SYS_PAGE_NO. @retval DB_SUCCESS if srv_undo_space_id assigned successfully. */ static dberr_t xb_assign_undo_space_start() { - ulint dirnamelen; - char name[1000]; + pfs_os_file_t file; byte* buf; byte* page; bool ret; dberr_t error = DB_SUCCESS; ulint space, page_no __attribute__((unused)); + int n_retries = 5; if (srv_undo_tablespaces == 0) { return error; } - os_normalize_path(srv_data_home); - dirnamelen = strlen(srv_data_home); - memcpy(name, srv_data_home, dirnamelen); - - if (dirnamelen && name[dirnamelen - 1] != OS_PATH_SEPARATOR) { - name[dirnamelen++] = OS_PATH_SEPARATOR; - } - - snprintf(name + dirnamelen, (sizeof name) - dirnamelen, - "%s", "ibdata1"); - - file = os_file_create(0, name, OS_FILE_OPEN, - OS_FILE_NORMAL, OS_DATA_FILE, true, &ret); + file = os_file_create(0, srv_sys_space.first_datafile()->filepath(), + OS_FILE_OPEN, OS_FILE_NORMAL, OS_DATA_FILE, true, &ret); if (!ret) { - msg("mariabackup: Error in opening %s\n", name); + msg("Error opening %s", srv_sys_space.first_datafile()->filepath()); return DB_ERROR; } @@ -3202,14 +3306,21 @@ retry: if (!os_file_read(IORequestRead, file, page, TRX_SYS_PAGE_NO << srv_page_size_shift, srv_page_size)) { - msg("mariabackup: Reading TRX_SYS page failed.\n"); + msg("Reading TRX_SYS page failed.\n"); error = DB_ERROR; goto func_exit; } /* TRX_SYS page can't be compressed or encrypted. */ if (buf_page_is_corrupted(false, page, univ_page_size)) { - goto retry; + if (n_retries--) { + os_thread_sleep(1000); + goto retry; + } else { + msg("mariabackup: TRX_SYS page corrupted.\n"); + error = DB_ERROR; + goto func_exit; + } } /* 0th slot always points to system tablespace. @@ -3253,16 +3364,22 @@ xb_load_tablespaces() /* create_new_db must not be true. */ if (err != DB_SUCCESS || create_new_db) { - msg("mariabackup: could not find data files at the " - "specified datadir\n"); + msg("Could not find data files at the specified datadir"); return(DB_ERROR); } - err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes, - &flush_lsn); + for (int i= 0; i < 10; i++) { + err = srv_sys_space.open_or_create(false, false, &sum_of_new_sizes, + &flush_lsn); + if (err == DB_PAGE_CORRUPTED || err == DB_CORRUPTION) { + my_sleep(1000); + } + else + break; + } if (err != DB_SUCCESS) { - msg("mariabackup: Could not open data files.\n"); + msg("Could not open data files.\n"); return(err); } @@ -3284,7 +3401,7 @@ xb_load_tablespaces() srv_undo_tablespaces_init(), because fil_is_user_tablespace_id() * relies on srv_undo_tablespaces_open to be properly initialized */ - msg("mariabackup: Generating a list of tablespaces\n"); + msg("mariabackup: Generating a list of tablespaces"); err = enumerate_ibd_files(xb_load_single_table_tablespace); if (err != DB_SUCCESS) { @@ -3387,13 +3504,11 @@ xb_validate_name( /* perform only basic validation. validate length and path symbols */ if (len > NAME_LEN) { - msg("mariabackup: name `%s` is too long.\n", name); - exit(EXIT_FAILURE); + die("name `%s` is too long.", name); } p = strpbrk(name, "/\\~"); if (p && (uint) (p - name) < NAME_LEN) { - msg("mariabackup: name `%s` is not valid.\n", name); - exit(EXIT_FAILURE); + die("name `%s` is not valid.", name); } } @@ -3471,8 +3586,7 @@ xb_register_table( const char* name) /*!< in: name of table */ { if (strchr(name, '.') == NULL) { - msg("mariabackup: `%s` is not fully qualified name.\n", name); - exit(EXIT_FAILURE); + die("`%s` is not fully qualified name.", name); } xb_register_include_filter_entry(name); @@ -3493,7 +3607,7 @@ xb_add_regex_to_list( if (ret != 0) { regerror(ret, &compiled_regex, errbuf, sizeof(errbuf)); - msg("mariabackup: error: %s regcomp(%s): %s\n", + msg("mariabackup: error: %s regcomp(%s): %s", error_context, regex, errbuf); exit(EXIT_FAILURE); } @@ -3562,17 +3676,15 @@ xb_load_list_file( /* read and store the filenames */ fp = fopen(filename, "r"); if (!fp) { - msg("mariabackup: cannot open %s\n", + die("Can't open %s", filename); - exit(EXIT_FAILURE); } while (fgets(name_buf, sizeof(name_buf), fp) != NULL) { char* p = strchr(name_buf, '\n'); if (p) { *p = '\0'; } else { - msg("mariabackup: `%s...` name is too long", name_buf); - exit(EXIT_FAILURE); + die("`%s...` name is too long", name_buf); } ins(name_buf); @@ -3680,22 +3792,17 @@ xb_filters_free() } /*********************************************************************//** -Creates or opens the log files and closes them. -@return DB_SUCCESS or error code */ +Create log file metadata. */ static -ulint +void open_or_create_log_file( /*====================*/ fil_space_t* space, - ibool* log_file_created, /*!< out: TRUE if new log file - created */ ulint i) /*!< in: log file number in group */ { char name[10000]; ulint dirnamelen; - *log_file_created = FALSE; - os_normalize_path(srv_log_group_home_dir); dirnamelen = strlen(srv_log_group_home_dir); @@ -3707,14 +3814,13 @@ open_or_create_log_file( name[dirnamelen++] = OS_PATH_SEPARATOR; } - sprintf(name + dirnamelen, "%s%lu", "ib_logfile", (ulong) i); + sprintf(name + dirnamelen, "%s%zu", "ib_logfile", i); ut_a(fil_validate()); - ut_a(fil_node_create(name, ulint(srv_log_file_size >> srv_page_size_shift), - space, false, false)); - - return(DB_SUCCESS); + space->add(name, OS_FILE_CLOSED, + ulint(srv_log_file_size >> srv_page_size_shift), + false, false); } /*********************************************************************** @@ -3818,10 +3924,10 @@ static bool xtrabackup_backup_low() metadata_to_lsn = mach_read_from_8( log_sys.checkpoint_buf + LOG_CHECKPOINT_LSN); msg("mariabackup: The latest check point" - " (for incremental): '" LSN_PF "'\n", + " (for incremental): '" LSN_PF "'", metadata_to_lsn); } else { - msg("mariabackup: Error: recv_find_max_checkpoint() failed.\n"); + msg("Error: recv_find_max_checkpoint() failed."); } log_mutex_exit(); } @@ -3851,7 +3957,7 @@ static bool xtrabackup_backup_low() metadata_last_lsn = log_copy_scanned_lsn; if (!xtrabackup_stream_metadata(ds_meta)) { - msg("mariabackup: Error: failed to stream metadata.\n"); + msg("Error: failed to stream metadata."); return false; } if (xtrabackup_extra_lsndir) { @@ -3860,15 +3966,15 @@ static bool xtrabackup_backup_low() sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_METADATA_FILENAME); if (!xtrabackup_write_metadata(filename)) { - msg("mariabackup: Error: failed to write metadata " - "to '%s'.\n", filename); + msg("Error: failed to write metadata " + "to '%s'.", filename); return false; } sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_INFO); if (!write_xtrabackup_info(mysql_connection, filename, false)) { - msg("mariabackup: Error: failed to write info " - "to '%s'.\n", filename); + msg("Error: failed to write info " + "to '%s'.", filename); return false; } } @@ -3891,19 +3997,19 @@ xtrabackup_backup_func() pthread_cond_init(&scanned_lsn_cond, NULL); #ifdef USE_POSIX_FADVISE - msg("mariabackup: uses posix_fadvise().\n"); + msg("uses posix_fadvise()."); #endif /* cd to datadir */ if (my_setwd(mysql_real_data_home,MYF(MY_WME))) { - msg("mariabackup: cannot my_setwd %s\n", mysql_real_data_home); + msg("my_setwd() failed , %s", mysql_real_data_home); return(false); } - msg("mariabackup: cd to %s\n", mysql_real_data_home); + msg("cd to %s", mysql_real_data_home); encryption_plugin_backup_init(mysql_connection); - msg("mariabackup: open files limit requested %u, set to %u\n", + msg("open files limit requested %u, set to %u", (uint) xb_open_files_limit, xb_set_max_open_files(xb_open_files_limit)); @@ -3918,12 +4024,6 @@ xtrabackup_backup_func() log_file_op = backup_file_op; metadata_to_lsn = 0; - if (xb_close_files) - msg("mariabackup: warning: close-files specified. Use it " - "at your own risk. If there are DDL operations like table DROP TABLE " - "or RENAME TABLE during the backup, inconsistent backup will be " - "produced.\n"); - /* initialize components */ if(innodb_init_param()) { fail: @@ -3974,13 +4074,6 @@ fail: xb_filters_init(); - { - ibool log_file_created; - ibool log_created = FALSE; - ibool log_opened = FALSE; - ulint err; - ulint i; - xb_fil_io_init(); srv_n_file_io_threads = srv_n_read_io_threads; @@ -3993,43 +4086,15 @@ fail: "innodb_redo_log", SRV_LOG_SPACE_FIRST_ID, 0, FIL_TYPE_LOG, NULL); - for (i = 0; i < srv_n_log_files; i++) { - err = open_or_create_log_file(space, &log_file_created, i); - if (err != DB_SUCCESS) { - goto fail; - } - - if (log_file_created) { - log_created = TRUE; - } else { - log_opened = TRUE; - } - if ((log_opened && log_created)) { - msg( - "mariabackup: Error: all log files must be created at the same time.\n" - "mariabackup: All log files must be created also in database creation.\n" - "mariabackup: If you want bigger or smaller log files, shut down the\n" - "mariabackup: database and make sure there were no errors in shutdown.\n" - "mariabackup: Then delete the existing log files. Edit the .cnf file\n" - "mariabackup: and start the database again.\n"); - - goto fail; - } - } - - /* log_file_created must not be TRUE, if online */ - if (log_file_created) { - msg("mariabackup: Something wrong with source files...\n"); - goto fail; - } - + for (ulint i = 0; i < srv_n_log_files; i++) { + open_or_create_log_file(space, i); } /* create extra LSN dir if it does not exist. */ if (xtrabackup_extra_lsndir &&!my_stat(xtrabackup_extra_lsndir,&stat_info,MYF(0)) && (my_mkdir(xtrabackup_extra_lsndir,0777,MYF(0)) < 0)) { - msg("mariabackup: Error: cannot mkdir %d: %s\n", + msg("Error: cannot mkdir %d: %s\n", my_errno, xtrabackup_extra_lsndir); goto fail; } @@ -4037,7 +4102,7 @@ fail: /* create target dir if not exist */ if (!xtrabackup_stream_str && !my_stat(xtrabackup_target_dir,&stat_info,MYF(0)) && (my_mkdir(xtrabackup_target_dir,0777,MYF(0)) < 0)){ - msg("mariabackup: Error: cannot mkdir %d: %s\n", + msg("Error: cannot mkdir %d: %s\n", my_errno, xtrabackup_target_dir); goto fail; } @@ -4048,7 +4113,6 @@ fail: /* start back ground thread to copy newer log */ os_thread_id_t log_copying_thread_id; - datafiles_iter_t *it; /* get current checkpoint_lsn */ /* Look for the latest checkpoint from any of the log groups */ @@ -4065,8 +4129,8 @@ log_fail: if (log_sys.log.format == 0) { old_format: - msg("mariabackup: Error: cannot process redo log" - " before MariaDB 10.2.2\n"); + msg("Error: cannot process redo log" + " before MariaDB 10.2.2"); log_mutex_exit(); goto log_fail; } @@ -4105,8 +4169,8 @@ reread_log_header: memset(&stat_info, 0, sizeof(MY_STAT)); dst_log_file = ds_open(ds_redo, "ib_logfile0", &stat_info); if (dst_log_file == NULL) { - msg("mariabackup: error: failed to open the target stream for " - "'ib_logfile0'.\n"); + msg("§rror: failed to open the target stream for " + "'ib_logfile0'."); goto fail; } @@ -4124,7 +4188,7 @@ reread_log_header: /* Write the log header. */ if (ds_write(dst_log_file, log_hdr, sizeof log_hdr)) { log_write_fail: - msg("mariabackup: error: write to logfile failed\n"); + msg("error: write to logfile failed"); goto fail; } /* Adjust the checkpoint page. */ @@ -4159,8 +4223,8 @@ reread_log_header: /* Populate fil_system with tablespaces to copy */ err = xb_load_tablespaces(); if (err != DB_SUCCESS) { - msg("mariabackup: error: xb_load_tablespaces() failed with" - " error %s.\n", ut_strerr(err)); + msg("merror: xb_load_tablespaces() failed with" + " error %s.", ut_strerr(err)); fail_before_log_copying_thread_start: log_copying_running = false; goto fail; @@ -4183,25 +4247,12 @@ fail_before_log_copying_thread_start: } debug_sync_point("xtrabackup_suspend_at_start"); - if (xtrabackup_incremental) { - if (!xtrabackup_incremental_force_scan) { - changed_page_bitmap = xb_page_bitmap_init(); - } - if (!changed_page_bitmap) { - msg("mariabackup: using the full scan for incremental " - "backup\n"); - } else if (incremental_lsn != checkpoint_lsn_start) { - /* Do not print that bitmaps are used when dummy bitmap - is build for an empty LSN range. */ - msg("mariabackup: using the changed page bitmap\n"); - } - } ut_a(xtrabackup_parallel > 0); if (xtrabackup_parallel > 1) { msg("mariabackup: Starting %u threads for parallel data " - "files transfer\n", xtrabackup_parallel); + "files transfer", xtrabackup_parallel); } if (opt_lock_ddl_per_table) { @@ -4210,12 +4261,12 @@ fail_before_log_copying_thread_start: DBUG_EXECUTE_IF("check_mdl_lock_works", dbug_alter_thread_done = dbug_start_query_thread("ALTER TABLE test.t ADD COLUMN mdl_lock_column int", - "Waiting for table metadata lock", 1, ER_QUERY_INTERRUPTED);); + "Waiting for table metadata lock", 0, 0);); } - it = datafiles_iter_new(); + datafiles_iter_t *it = datafiles_iter_new(); if (it == NULL) { - msg("mariabackup: Error: datafiles_iter_new() failed.\n"); + msg("mariabackup: Error: datafiles_iter_new() failed."); goto fail; } @@ -4229,7 +4280,7 @@ fail_before_log_copying_thread_start: data_threads[i].it = it; data_threads[i].num = i+1; data_threads[i].count = &count; - data_threads[i].count_mutex = count_mutex; + data_threads[i].count_mutex = &count_mutex; os_thread_create(data_copy_thread_func, data_threads + i, &data_threads[i].id); } @@ -4276,16 +4327,16 @@ fail_before_log_copying_thread_start: } xtrabackup_destroy_datasinks(); - msg("mariabackup: Redo log (from LSN " LSN_PF " to " LSN_PF - ") was copied.\n", checkpoint_lsn_start, log_copy_scanned_lsn); + msg("Redo log (from LSN " LSN_PF " to " LSN_PF + ") was copied.", checkpoint_lsn_start, log_copy_scanned_lsn); xb_filters_free(); xb_data_files_close(); /* Make sure that the latest checkpoint was included */ if (metadata_to_lsn > log_copy_scanned_lsn) { - msg("mariabackup: error: failed to copy enough redo log (" - "LSN=" LSN_PF "; checkpoint LSN=" LSN_PF ").\n", + msg("Error: failed to copy enough redo log (" + "LSN=" LSN_PF "; checkpoint LSN=" LSN_PF ").", log_copy_scanned_lsn, metadata_to_lsn); goto fail; } @@ -4322,6 +4373,14 @@ void backup_fix_ddl(void) std::set dropped_tables; std::map renamed_tables; + /* Disable further DDL on backed up tables (only needed for --no-lock).*/ + pthread_mutex_lock(&backup_mutex); + log_file_op = backup_file_op_fail; + log_optimized_ddl_op = backup_optimized_ddl_op_fail; + pthread_mutex_unlock(&backup_mutex); + + DBUG_MARIABACKUP_EVENT("backup_fix_ddl",0); + for (space_id_to_name_t::iterator iter = ddl_tracker.tables_in_backup.begin(); iter != ddl_tracker.tables_in_backup.end(); iter++) { @@ -4418,8 +4477,9 @@ void backup_fix_ddl(void) } fil_space_free(n->space->id, false); } + datafiles_iter_free(it); - + DBUG_EXECUTE_IF("check_mdl_lock_works", DBUG_ASSERT(new_tables.size() == 0);); for (std::set::iterator iter = new_tables.begin(); iter != new_tables.end(); iter++) { const char *space_name = iter->c_str(); @@ -4434,7 +4494,7 @@ void backup_fix_ddl(void) const char *dbname = buf; char *p = strchr(buf, '/'); if (p == 0) { - msg("Unexpected tablespace %s filename %s\n", space_name, name.c_str()); + msg("Unexpected tablespace %s filename %s", space_name, name.c_str()); ut_a(0); } ut_a(p); @@ -4453,18 +4513,10 @@ void backup_fix_ddl(void) continue; std::string dest_name(node->space->name); dest_name.append(".new"); -#if 0 - bool do_full_copy = ddl_tracker.optimized_ddl.find(n->space->id) != ddl_tracker.optimized_ddl.end(); - if (do_full_copy) { - msg( - "Performing a full copy of the tablespace %s, because optimized (without redo logging) DDL operation" - "ran during backup. You can use set innodb_log_optimize_ddl=OFF to improve backup performance" - "in the future.\n", - n->space->name); - } -#endif xtrabackup_copy_datafile(node, 0, dest_name.c_str()/*, do_full_copy ? ULONGLONG_MAX:UNIV_PAGE_SIZE */); } + + datafiles_iter_free(it); } /* ================= prepare ================= */ @@ -4515,7 +4567,7 @@ xb_space_create_file( *file = os_file_create_simple_no_error_handling( 0, path, OS_FILE_CREATE, OS_FILE_READ_WRITE, false, &ret); if (!ret) { - msg("mariabackup: cannot create file %s\n", path); + msg("Can't create file %s", path); return ret; } @@ -4523,7 +4575,7 @@ xb_space_create_file( FIL_IBD_FILE_INITIAL_SIZE << srv_page_size_shift); if (!ret) { - msg("mariabackup: cannot set size for file %s\n", path); + msg("mariabackup: cannot set size for file %s", path); os_file_close(*file); os_file_delete(0, path); return ret; @@ -4567,7 +4619,7 @@ xb_space_create_file( free(buf); if (!ret) { - msg("mariabackup: could not write the first page to %s\n", + msg("mariabackup: could not write the first page to %s", path); os_file_close(*file); os_file_delete(0, path); @@ -4638,7 +4690,7 @@ xb_delta_open_matching_space( /* Create the database directory if it doesn't exist yet */ if (!os_file_create_directory(dest_dir, FALSE)) { - msg("mariabackup: error: cannot create dir %s\n", dest_dir); + msg("mariabackup: error: cannot create dir %s", dest_dir); return file; } @@ -4685,12 +4737,12 @@ exit: snprintf(tmpname, FN_REFLEN, "%s/xtrabackup_tmp_#" ULINTPF, dbname, fil_space->id); - msg("mariabackup: Renaming %s to %s.ibd\n", + msg("mariabackup: Renaming %s to %s.ibd", fil_space->name, tmpname); if (fil_space->rename(tmpname, NULL, false) != DB_SUCCESS) { - msg("mariabackup: Cannot rename %s to %s\n", + msg("mariabackup: Cannot rename %s to %s", fil_space->name, tmpname); goto exit; } @@ -4699,9 +4751,8 @@ exit: if (info.space_id == ULINT_UNDEFINED) { - msg("mariabackup: Error: Cannot handle DDL operation on tablespace " + die("Can't handle DDL operation on tablespace " "%s\n", dest_space_name); - exit(EXIT_FAILURE); } mutex_enter(&fil_system.mutex); fil_space = fil_space_get_by_id(info.space_id); @@ -4711,12 +4762,12 @@ exit: strncpy(tmpname, dest_space_name, FN_REFLEN); - msg("mariabackup: Renaming %s to %s\n", + msg("mariabackup: Renaming %s to %s", fil_space->name, dest_space_name); if (fil_space->rename(tmpname, NULL, false) != DB_SUCCESS) { - msg("mariabackup: Cannot rename %s to %s\n", + msg("mariabackup: Cannot rename %s to %s", fil_space->name, dest_space_name); goto exit; } @@ -4744,8 +4795,7 @@ exit: *success = xb_space_create_file(real_name, info.space_id, flags, &file); } else { - msg("mariabackup: Cannot create tablespace %s\n", - dest_space_name); + msg("Can't create tablespace %s\n", dest_space_name); } goto exit; @@ -4815,12 +4865,12 @@ xtrabackup_apply_delta( page_size = info.page_size.physical(); page_size_shift = get_bit_shift(page_size); - msg("mariabackup: page size for %s is %zu bytes\n", + msg("page size for %s is %zu bytes", src_path, page_size); if (page_size_shift < 10 || page_size_shift > UNIV_PAGE_SIZE_SHIFT_MAX) { - msg("mariabackup: error: invalid value of page_size " - "(%zu bytes) read from %s\n", page_size, meta_path); + msg("error: invalid value of page_size " + "(%zu bytes) read from %s", page_size, meta_path); goto error; } @@ -4829,7 +4879,7 @@ xtrabackup_apply_delta( OS_FILE_OPEN, OS_FILE_READ_WRITE, false, &success); if (!success) { os_file_get_last_error(TRUE); - msg("mariabackup: error: cannot open %s\n", src_path); + msg("error: can't open %s", src_path); goto error; } @@ -4839,7 +4889,7 @@ xtrabackup_apply_delta( dbname, space_name, info, dst_path, sizeof(dst_path), &success); if (!success) { - msg("mariabackup: error: cannot open %s\n", dst_path); + msg("error: can't open %s", dst_path); goto error; } @@ -4852,7 +4902,7 @@ xtrabackup_apply_delta( (ut_align(incremental_buffer_base, page_size)); - msg("Applying %s to %s...\n", src_path, dst_path); + msg("Applying %s to %s...", src_path, dst_path); while (!last_buffer) { ulint cluster_header; @@ -4875,8 +4925,8 @@ xtrabackup_apply_delta( last_buffer = TRUE; break; default: - msg("mariabackup: error: %s seems not " - ".delta file.\n", src_path); + msg("error: %s seems not " + ".delta file.", src_path); goto error; } @@ -4974,7 +5024,7 @@ error: os_file_close(src_file); if (dst_file != OS_FILE_CLOSED) os_file_close(dst_file); - msg("mariabackup: Error: xtrabackup_apply_delta(): " + msg("Error: xtrabackup_apply_delta(): " "failed to apply %s to %s.\n", src_path, dst_path); return FALSE; } @@ -4992,8 +5042,7 @@ std::string change_extension(std::string filename, std::string new_ext) { static void rename_file(const char *from,const char *to) { msg("Renaming %s to %s\n", from, to); if (my_rename(from, to, MY_WME)) { - msg("Cannot rename %s to %s errno %d", from, to, errno); - exit(EXIT_FAILURE); + die("Can't rename %s to %s errno %d", from, to, errno); } } @@ -5014,7 +5063,7 @@ typedef ibool (*handle_datadir_entry_func_t)( /** Rename, and replace destination file, if exists */ static void rename_force(const char *from, const char *to) { if (access(to, R_OK) == 0) { - msg("Removing %s\n", to); + msg("Removing %s", to); if (my_delete(to, MYF(MY_WME))) { msg("Can't remove %s, errno %d", to, errno); exit(EXIT_FAILURE); @@ -5122,6 +5171,7 @@ xb_process_datadir( path, NULL, fileinfo.name, NULL)) { + os_file_closedir(dbdir); return(FALSE); } } @@ -5133,16 +5183,14 @@ next_file_item_1: os_file_closedir(dbdir); } else { - msg("mariabackup: Cannot open dir %s\n", - path); + msg("Can't open dir %s", path); } /* single table tablespaces */ dir = os_file_opendir(path, FALSE); if (dir == NULL) { - msg("mariabackup: Cannot open dir %s\n", - path); + msg("Can't open dir %s", path); } ret = fil_file_readdir_next_file(&err, path, dir, @@ -5183,6 +5231,7 @@ next_file_item_1: dbinfo.name, fileinfo.name, NULL)) { + os_file_closedir(dbdir); return(FALSE); } } @@ -5237,7 +5286,7 @@ store_binlog_info(const char* filename, const char* name, ulonglong pos) FILE *fp = fopen(filename, "w"); if (!fp) { - msg("mariabackup: failed to open '%s'\n", filename); + msg("mariabackup: failed to open '%s'", filename); return(false); } @@ -5258,7 +5307,7 @@ static std::string read_file_as_string(const std::string file) { char content[FN_REFLEN]; FILE *f = fopen(file.c_str(), "r"); if (!f) { - msg("Can not open %s\n", file.c_str()); + msg("Can not open %s", file.c_str()); } size_t len = fread(content, 1, FN_REFLEN, f); fclose(f); @@ -5270,8 +5319,7 @@ static void delete_file(const std::string& file, bool if_exists = false) { if (if_exists && !file_exists(file)) return; if (my_delete(file.c_str(), MYF(MY_WME))) { - msg("Can't remove %s, errno %d", file.c_str(), errno); - exit(EXIT_FAILURE); + die("Can't remove %s, errno %d", file.c_str(), errno); } } @@ -5355,14 +5403,21 @@ xtrabackup_prepare_func(char** argv) if (my_setwd(xtrabackup_real_target_dir,MYF(MY_WME))) { - msg("mariabackup: cannot my_setwd %s\n", - xtrabackup_real_target_dir); + msg("can't my_setwd %s", xtrabackup_real_target_dir); return(false); } - msg("mariabackup: cd to %s\n", xtrabackup_real_target_dir); + msg("cd to %s", xtrabackup_real_target_dir); fil_path_to_mysql_datadir = "."; + /* Fix DDL for prepare. Process .del,.ren, and .new files. + The order in which files are processed, is important + (see MDEV-18185, MDEV-18201) + */ + xb_process_datadir(xtrabackup_incremental_dir ? xtrabackup_incremental_dir : ".", + ".del", prepare_handle_del_files); + xb_process_datadir(xtrabackup_incremental_dir? xtrabackup_incremental_dir:".", + ".ren", prepare_handle_ren_files); if (xtrabackup_incremental_dir) { xb_process_datadir(xtrabackup_incremental_dir, ".new.meta", prepare_handle_new_files); xb_process_datadir(xtrabackup_incremental_dir, ".new.delta", prepare_handle_new_files); @@ -5370,11 +5425,6 @@ xtrabackup_prepare_func(char** argv) else { xb_process_datadir(".", ".new", prepare_handle_new_files); } - xb_process_datadir(xtrabackup_incremental_dir? xtrabackup_incremental_dir:".", - ".ren", prepare_handle_ren_files); - xb_process_datadir(xtrabackup_incremental_dir ? xtrabackup_incremental_dir : ".", - ".del", prepare_handle_del_files); - int argc; for (argc = 0; argv[argc]; argc++) {} encryption_plugin_prepare_init(argc, argv); @@ -5392,32 +5442,31 @@ xtrabackup_prepare_func(char** argv) XTRABACKUP_METADATA_FILENAME); if (!xtrabackup_read_metadata(metadata_path)) { - msg("mariabackup: Error: failed to read metadata from '%s'\n", + msg("Error: failed to read metadata from '%s'\n", metadata_path); return(false); } if (!strcmp(metadata_type, "full-backuped")) { if (xtrabackup_incremental) { - msg("mariabackup: error: applying incremental backup " - "needs a prepared target.\n"); + msg("error: applying incremental backup " + "needs a prepared target."); return(false); } - msg("mariabackup: This target seems to be not prepared yet.\n"); + msg("This target seems to be not prepared yet."); } else if (!strcmp(metadata_type, "log-applied")) { - msg("mariabackup: This target seems to be already prepared.\n"); + msg("This target seems to be already prepared."); } else { - msg("mariabackup: This target does not have correct metadata.\n"); + msg("This target does not have correct metadata."); return(false); } bool ok = !xtrabackup_incremental || metadata_to_lsn == incremental_lsn; if (!ok) { - msg("mariabackup: error: This incremental backup seems " - "not to be proper for the target.\n" - "mariabackup: Check 'to_lsn' of the target and " - "'from_lsn' of the incremental.\n"); + msg("error: This incremental backup seems " + "not to be proper for the target. Check 'to_lsn' of the target and " + "'from_lsn' of the incremental."); return(false); } @@ -5493,9 +5542,10 @@ xtrabackup_prepare_func(char** argv) srv_n_write_io_threads = 4; } - msg("mariabackup: Starting InnoDB instance for recovery.\n" - "mariabackup: Using %lld bytes for buffer pool " - "(set by --use-memory parameter)\n", xtrabackup_use_memory); + msg("Starting InnoDB instance for recovery."); + + msg("mariabackup: Using %lld bytes for buffer pool " + "(set by --use-memory parameter)", xtrabackup_use_memory); srv_max_buf_pool_modified_pct = (double)max_buf_pool_modified_pct; @@ -5508,7 +5558,7 @@ xtrabackup_prepare_func(char** argv) } if (ok) { - msg("Last binlog file %s, position %lld\n", + msg("Last binlog file %s, position %lld", trx_sys.recovered_binlog_filename, longlong(trx_sys.recovered_binlog_offset)); @@ -5532,7 +5582,7 @@ xtrabackup_prepare_func(char** argv) && srv_start_lsn < target_lsn) { msg("mariabackup: error: " "The log was only applied up to LSN " LSN_PF - ", instead of " LSN_PF "\n", + ", instead of " LSN_PF, srv_start_lsn, target_lsn); ok = false; } @@ -5560,13 +5610,13 @@ xtrabackup_prepare_func(char** argv) if (!xtrabackup_write_metadata(filename)) { msg("mariabackup: Error: failed to write metadata " - "to '%s'\n", filename); + "to '%s'", filename); ok = false; } else if (xtrabackup_extra_lsndir) { sprintf(filename, "%s/%s", xtrabackup_extra_lsndir, XTRABACKUP_METADATA_FILENAME); if (!xtrabackup_write_metadata(filename)) { msg("mariabackup: Error: failed to write " - "metadata to '%s'\n", filename); + "metadata to '%s'", filename); ok = false; } } @@ -5601,6 +5651,153 @@ append_defaults_group(const char *group, const char *default_groups[], ut_a(appended); } +static const char* +normalize_privilege_target_name(const char* name) +{ + if (strcmp(name, "*") == 0) { + return "\\*"; + } + else { + /* should have no regex special characters. */ + ut_ad(strpbrk(name, ".()[]*+?") == 0); + } + return name; +} + +/******************************************************************//** +Check if specific privilege is granted. +Uses regexp magic to check if requested privilege is granted for given +database.table or database.* or *.* +or if user has 'ALL PRIVILEGES' granted. +@return true if requested privilege is granted, false otherwise. */ +static bool +has_privilege(const std::list &granted, + const char* required, + const char* db_name, + const char* table_name) +{ + char buffer[1000]; + regex_t priv_re; + regmatch_t tables_regmatch[1]; + bool result = false; + + db_name = normalize_privilege_target_name(db_name); + table_name = normalize_privilege_target_name(table_name); + + int written = snprintf(buffer, sizeof(buffer), + "GRANT .*(%s)|(ALL PRIVILEGES).* ON (\\*|`%s`)\\.(\\*|`%s`)", + required, db_name, table_name); + if (written < 0 || written == sizeof(buffer) + || regcomp(&priv_re, buffer, REG_EXTENDED)) { + die("regcomp() failed for '%s'", buffer); + } + + typedef std::list::const_iterator string_iter; + for (string_iter i = granted.begin(), e = granted.end(); i != e; ++i) { + int res = regexec(&priv_re, i->c_str(), + 1, tables_regmatch, 0); + + if (res != REG_NOMATCH) { + result = true; + break; + } + } + + xb_regfree(&priv_re); + return result; +} + +enum { + PRIVILEGE_OK = 0, + PRIVILEGE_WARNING = 1, + PRIVILEGE_ERROR = 2, +}; + +/******************************************************************//** +Check if specific privilege is granted. +Prints error message if required privilege is missing. +@return PRIVILEGE_OK if requested privilege is granted, error otherwise. */ +static +int check_privilege( + const std::list &granted_priv, /* in: list of + granted privileges*/ + const char* required, /* in: required privilege name */ + const char* target_database, /* in: required privilege target + database name */ + const char* target_table, /* in: required privilege target + table name */ + int error = PRIVILEGE_ERROR) /* in: return value if privilege + is not granted */ +{ + if (!has_privilege(granted_priv, + required, target_database, target_table)) { + msg("%s: missing required privilege %s on %s.%s", + (error == PRIVILEGE_ERROR ? "Error" : "Warning"), + required, target_database, target_table); + return error; + } + return PRIVILEGE_OK; +} + + +/** +Check DB user privileges according to the intended actions. + +Fetches DB user privileges, determines intended actions based on +command-line arguments and prints missing privileges. +@return whether all the necessary privileges are granted */ +static bool check_all_privileges() +{ + if (!mysql_connection) { + /* Not connected, no queries is going to be executed. */ + return true; + } + + /* Fetch effective privileges. */ + std::list granted_privileges; + MYSQL_RES* result = xb_mysql_query(mysql_connection, "SHOW GRANTS", + true); + while (MYSQL_ROW row = mysql_fetch_row(result)) { + granted_privileges.push_back(*row); + } + mysql_free_result(result); + + int check_result = PRIVILEGE_OK; + + /* FLUSH TABLES WITH READ LOCK */ + if (!opt_no_lock) + { + check_result |= check_privilege( + granted_privileges, + "RELOAD", "*", "*"); + check_result |= check_privilege( + granted_privileges, + "PROCESS", "*", "*"); + } + + /* KILL ... */ + if ((!opt_no_lock && (opt_kill_long_queries_timeout || opt_lock_ddl_per_table)) + /* START SLAVE SQL_THREAD */ + /* STOP SLAVE SQL_THREAD */ + || opt_safe_slave_backup) { + check_result |= check_privilege( + granted_privileges, + "SUPER", "*", "*", + PRIVILEGE_WARNING); + } + + /* SHOW MASTER STATUS */ + /* SHOW SLAVE STATUS */ + if (opt_galera_info || opt_slave_info + || (opt_no_lock && opt_safe_slave_backup)) { + check_result |= check_privilege(granted_privileges, + "REPLICATION CLIENT", "*", "*", + PRIVILEGE_WARNING); + } + + return !(check_result & PRIVILEGE_ERROR); +} + bool xb_init() { @@ -5614,7 +5811,7 @@ xb_init() && !opt_safe_slave_backup) { msg("Error: --slave-info is used with --no-lock but " "without --safe-slave-backup. The binlog position " - "cannot be consistent with the backup data.\n"); + "cannot be consistent with the backup data."); return(false); } @@ -5665,7 +5862,9 @@ xb_init() if (!get_mysql_vars(mysql_connection)) { return(false); } - + if (opt_check_privileges && !check_all_privileges()) { + return(false); + } history_start_time = time(NULL); } @@ -5834,21 +6033,13 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) char *optend = strcend((argv)[i], '='); if (optend - argv[i] == 15 && - !strncmp(argv[i], "--defaults-file", optend - argv[i])) { - - msg("mariabackup: Error: --defaults-file " - "must be specified first on the command " - "line\n"); - exit(EXIT_FAILURE); + !strncmp(argv[i], "--defaults-file", optend - argv[i])) { + die("--defaults-file must be specified first on the command line"); } - if (optend - argv[i] == 21 && - !strncmp(argv[i], "--defaults-extra-file", - optend - argv[i])) { - - msg("mariabackup: Error: --defaults-extra-file " - "must be specified first on the command " - "line\n"); - exit(EXIT_FAILURE); + if (optend - argv[i] == 21 && + !strncmp(argv[i], "--defaults-extra-file", + optend - argv[i])) { + die("--defaults-extra-file must be specified first on the command line"); } } @@ -5895,7 +6086,7 @@ handle_options(int argc, char **argv, char ***argv_client, char ***argv_server) if (!server_option) { msg("mariabackup: Error:" - " unknown argument: '%s'\n", opt); + " unknown argument: '%s'", opt); exit(EXIT_FAILURE); } } @@ -5951,7 +6142,7 @@ int main(int argc, char **argv) if (mysql_server_init(-1, NULL, NULL)) { - exit(EXIT_FAILURE); + die("mysql_server_init() failed"); } system_charset_info = &my_charset_utf8_general_ci; @@ -5995,7 +6186,7 @@ int main(int argc, char **argv) mysql_mutex_destroy(&LOCK_error_log); if (status == EXIT_SUCCESS) { - msg_ts("completed OK!\n"); + msg("completed OK!"); } return status; @@ -6013,7 +6204,7 @@ static int main_low(char** argv) && !strcmp(mysql_data_home, "./")) { if (!xtrabackup_print_param) usage(); - msg("\nmariabackup: Error: Please set parameter 'datadir'\n"); + msg("mariabackup: Error: Please set parameter 'datadir'"); return(EXIT_FAILURE); } @@ -6084,7 +6275,7 @@ static int main_low(char** argv) if (error) { msg("mariabackup: value '%s' may be wrong format for " - "incremental option.\n", xtrabackup_incremental); + "incremental option.", xtrabackup_incremental); return(EXIT_FAILURE); } } else if (xtrabackup_backup && xtrabackup_incremental_basedir) { @@ -6094,7 +6285,7 @@ static int main_low(char** argv) if (!xtrabackup_read_metadata(filename)) { msg("mariabackup: error: failed to read metadata from " - "%s\n", filename); + "%s", filename); return(EXIT_FAILURE); } @@ -6107,7 +6298,7 @@ static int main_low(char** argv) if (!xtrabackup_read_metadata(filename)) { msg("mariabackup: error: failed to read metadata from " - "%s\n", filename); + "%s", filename); return(EXIT_FAILURE); } @@ -6125,7 +6316,7 @@ static int main_low(char** argv) } if (xtrabackup_stream && !xtrabackup_backup) { - msg("Warning: --stream parameter is ignored, it only works together with --backup.\n"); + msg("Warning: --stream parameter is ignored, it only works together with --backup."); } if (!xb_init()) { @@ -6140,13 +6331,13 @@ static int main_low(char** argv) print_version(); if (xtrabackup_incremental) { - msg("incremental backup from " LSN_PF " is enabled.\n", + msg("incremental backup from " LSN_PF " is enabled.", incremental_lsn); } if (xtrabackup_export && innobase_file_per_table == FALSE) { msg("mariabackup: auto-enabling --innodb-file-per-table due to " - "the --export option\n"); + "the --export option"); innobase_file_per_table = TRUE; } @@ -6184,8 +6375,7 @@ static int main_low(char** argv) if (xtrabackup_copy_back || xtrabackup_move_back) { if (!check_if_param_set("datadir")) { - msg("Error: datadir must be specified.\n"); - return(EXIT_FAILURE); + mysql_data_home = get_default_datadir(); } if (!copy_back()) return(EXIT_FAILURE); @@ -6213,3 +6403,12 @@ static int get_exepath(char *buf, size_t size, const char *argv0) return my_realpath(buf, argv0, 0); } + + +#if defined (__SANITIZE_ADDRESS__) && defined (__linux__) +/* Avoid LeakSanitizer's false positives. */ +const char* __asan_default_options() +{ + return "detect_leaks=0"; +} +#endif diff --git a/extra/mariabackup/xtrabackup.h b/extra/mariabackup/xtrabackup.h index 857c253f803..90f5e28e2c7 100644 --- a/extra/mariabackup/xtrabackup.h +++ b/extra/mariabackup/xtrabackup.h @@ -71,7 +71,7 @@ extern char *xtrabackup_databases_file; extern char *xtrabackup_tables_exclude; extern char *xtrabackup_databases_exclude; -extern ibool xtrabackup_compress; +extern uint xtrabackup_compress; extern my_bool xtrabackup_backup; extern my_bool xtrabackup_prepare; @@ -86,14 +86,10 @@ extern int xtrabackup_parallel; extern my_bool xb_close_files; extern const char *xtrabackup_compress_alg; -#ifdef __cplusplus -extern "C"{ -#endif - extern uint xtrabackup_compress_threads; - extern ulonglong xtrabackup_compress_chunk_size; -#ifdef __cplusplus -} -#endif + +extern uint xtrabackup_compress_threads; +extern ulonglong xtrabackup_compress_chunk_size; + extern my_bool xtrabackup_export; extern char *xtrabackup_extra_lsndir; extern ulint xtrabackup_log_copy_interval; @@ -111,6 +107,8 @@ extern my_bool opt_noversioncheck; extern my_bool opt_no_backup_locks; extern my_bool opt_decompress; extern my_bool opt_remove_original; +extern my_bool opt_extended_validation; +extern my_bool opt_encrypted_backup; extern my_bool opt_lock_ddl_per_table; extern char *opt_incremental_history_name; diff --git a/extra/my_print_defaults.c b/extra/my_print_defaults.c index 07c95a79ddc..8eb0baa6eeb 100644 --- a/extra/my_print_defaults.c +++ b/extra/my_print_defaults.c @@ -41,24 +41,6 @@ const char *default_dbug_option="d:t:o,/tmp/my_print_defaults.trace"; static struct my_option my_long_options[] = { - /* - NB: --config-file is troublesome, because get_defaults_options() doesn't - know about it, but we pretend --config-file is like --defaults-file. In - fact they behave differently: see the comments at the top of - mysys/default.c for how --defaults-file should behave. - - This --config-file option behaves as: - - If it has a directory name part (absolute or relative), then only this - file is read; no error is given if the file doesn't exist - - If the file has no directory name part, the standard locations are - searched for a file of this name (and standard filename extensions are - added if the file has no extension) - */ - {"config-file", 'c', "Deprecated, please use --defaults-file instead. " - "Name of config file to read; if no extension is given, default " - "extension (e.g., .ini or .cnf) will be added", - (char**) &config_file, (char**) &config_file, 0, GET_STR, REQUIRED_ARG, - 0, 0, 0, 0, 0, 0}, #ifdef DBUG_OFF {"debug", '#', "This is a non-debug version. Catch this and exit", 0,0, 0, GET_DISABLED, OPT_ARG, 0, 0, 0, 0, 0, 0}, @@ -66,8 +48,8 @@ static struct my_option my_long_options[] = {"debug", '#', "Output debug log", (char**) &default_dbug_option, (char**) &default_dbug_option, 0, GET_STR, OPT_ARG, 0, 0, 0, 0, 0, 0}, #endif - {"defaults-file", 'c', "Like --config-file, except: if first option, " - "then read this file only, do not read global or per-user config " + {"defaults-file", 'c', + "Read this file only, do not read global or per-user config " "files; should be the first option", (char**) &config_file, (char*) &config_file, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, @@ -80,11 +62,6 @@ static struct my_option my_long_options[] = "In addition to the given groups, read also groups with this suffix", (char**) &my_defaults_group_suffix, (char**) &my_defaults_group_suffix, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, - {"extra-file", 'e', - "Deprecated. Synonym for --defaults-extra-file.", - (void *)&my_defaults_extra_file, - (void *)&my_defaults_extra_file, 0, GET_STR, - REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"mysqld", 0, "Read the same set of groups that the mysqld binary does.", &opt_mysqld, &opt_mysqld, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, {"no-defaults", 'n', "Return an empty string (useful for scripts).", @@ -107,7 +84,7 @@ static void cleanup_and_exit(int exit_code) static void version() { - printf("%s Ver 1.6 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); + printf("%s Ver 1.7 for %s at %s\n",my_progname,SYSTEM_TYPE, MACHINE_TYPE); } diff --git a/extra/perror.c b/extra/perror.c index bd62401c8b2..49b1318cbb2 100644 --- a/extra/perror.c +++ b/extra/perror.c @@ -87,7 +87,7 @@ static void usage(void) { print_version(); puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000")); - printf("Print a description for a system error code or a MySQL error code.\n"); + printf("Print a description for a system error code or a MariaDB error code.\n"); printf("If you want to get the error for a negative error code, you should use\n-- before the first error code to tell perror that there was no more options.\n\n"); printf("Usage: %s [OPTIONS] [ERRORCODE [ERRORCODE...]]\n",my_progname); my_print_help(my_long_options); @@ -336,7 +336,7 @@ int main(int argc,char *argv[]) { found= 1; if (verbose) - printf("MySQL error code %3d: %s\n", code, msg); + printf("MariaDB error code %3d: %s\n", code, msg); else puts(msg); } @@ -344,7 +344,7 @@ int main(int argc,char *argv[]) { found= 1; if (verbose) - printf("MySQL error code %3d (%s): %s\n", code, name, msg); + printf("MariaDB error code %3d (%s): %s\n", code, name, msg); else puts(msg); } diff --git a/extra/resolve_stack_dump.c b/extra/resolve_stack_dump.c index dbd9941141d..78a32298dab 100644 --- a/extra/resolve_stack_dump.c +++ b/extra/resolve_stack_dump.c @@ -75,7 +75,7 @@ static void print_version(void) static void usage() { print_version(); - printf("MySQL AB, by Sasha Pachev\n"); + printf("MariaDB Corporation, originally created by Sasha Pachev\n"); printf("This software comes with ABSOLUTELY NO WARRANTY\n\n"); printf("Resolve numeric stack strace dump into symbols.\n\n"); printf("Usage: %s [OPTIONS] symbols-file [numeric-dump-file]\n", diff --git a/extra/yassl/src/ssl.cpp b/extra/yassl/src/ssl.cpp index 51e1bd1ab21..d0234a6b68e 100644 --- a/extra/yassl/src/ssl.cpp +++ b/extra/yassl/src/ssl.cpp @@ -295,6 +295,7 @@ int SSL_connect(SSL* ssl) sendClientHello(*ssl); if (!ssl->GetError()) ssl->useStates().UseConnect() = CLIENT_HELLO_SENT; + /* fall through */ case CLIENT_HELLO_SENT : neededState = ssl->getSecurity().get_resuming() ? @@ -302,13 +303,14 @@ int SSL_connect(SSL* ssl) while (ssl->getStates().getClient() < neededState) { if (ssl->GetError()) break; processReply(*ssl); - // if resumption failed, reset needed state + // if resumption failed, reset needed state if (neededState == serverFinishedComplete) if (!ssl->getSecurity().get_resuming()) neededState = serverHelloDoneComplete; } if (!ssl->GetError()) ssl->useStates().UseConnect() = FIRST_REPLY_DONE; + /* fall through */ case FIRST_REPLY_DONE : if(ssl->getCrypto().get_certManager().sendVerify()) @@ -326,6 +328,7 @@ int SSL_connect(SSL* ssl) if (!ssl->GetError()) ssl->useStates().UseConnect() = FINISHED_DONE; + /* fall through */ case FINISHED_DONE : if (!ssl->getSecurity().get_resuming()) @@ -335,6 +338,7 @@ int SSL_connect(SSL* ssl) } if (!ssl->GetError()) ssl->useStates().UseConnect() = SECOND_REPLY_DONE; + /* fall through */ case SECOND_REPLY_DONE : ssl->verifyState(serverFinishedComplete); @@ -343,7 +347,7 @@ int SSL_connect(SSL* ssl) if (ssl->GetError()) { GetErrors().Add(ssl->GetError()); return SSL_FATAL_ERROR; - } + } return SSL_SUCCESS; default : @@ -371,7 +375,6 @@ int SSL_accept(SSL* ssl) ssl->SetError(no_error); if (ssl->GetError() == YasslError(SSL_ERROR_WANT_WRITE)) { - ssl->SetError(no_error); ssl->SendWriteBuffered(); if (!ssl->GetError()) @@ -385,6 +388,7 @@ int SSL_accept(SSL* ssl) processReply(*ssl); if (!ssl->GetError()) ssl->useStates().UseAccept() = ACCEPT_FIRST_REPLY_DONE; + /* fall through */ case ACCEPT_FIRST_REPLY_DONE : sendServerHello(*ssl); @@ -401,9 +405,10 @@ int SSL_accept(SSL* ssl) sendServerHelloDone(*ssl); ssl->flushBuffer(); } - + if (!ssl->GetError()) ssl->useStates().UseAccept() = SERVER_HELLO_DONE; + /* fall through */ case SERVER_HELLO_DONE : if (!ssl->getSecurity().get_resuming()) { @@ -414,6 +419,7 @@ int SSL_accept(SSL* ssl) } if (!ssl->GetError()) ssl->useStates().UseAccept() = ACCEPT_SECOND_REPLY_DONE; + /* fall through */ case ACCEPT_SECOND_REPLY_DONE : sendChangeCipher(*ssl); @@ -422,6 +428,7 @@ int SSL_accept(SSL* ssl) if (!ssl->GetError()) ssl->useStates().UseAccept() = ACCEPT_FINISHED_DONE; + /* fall through */ case ACCEPT_FINISHED_DONE : if (ssl->getSecurity().get_resuming()) { @@ -432,6 +439,7 @@ int SSL_accept(SSL* ssl) } if (!ssl->GetError()) ssl->useStates().UseAccept() = ACCEPT_THIRD_REPLY_DONE; + /* fall through */ case ACCEPT_THIRD_REPLY_DONE : ssl->useLog().ShowTCP(ssl->getSocket().get_fd()); diff --git a/include/aria_backup.h b/include/aria_backup.h new file mode 100644 index 00000000000..bb2d06b0acd --- /dev/null +++ b/include/aria_backup.h @@ -0,0 +1,34 @@ +/* Copyright (C) 2018 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 Street, Fifth Floor, Boston, MA 02111-1301 USA */ + +/* Interfaces for doing backups of Aria tables */ + +typedef struct st_aria_table_capabilities +{ + my_off_t header_size; + ulong bitmap_pages_covered; + uint block_size; + uint keypage_header; + my_bool checksum; + my_bool transactional; + /* This is true if the table can be copied without any locks */ + my_bool online_backup_safe; +} ARIA_TABLE_CAPABILITIES; + +int aria_get_capabilities(File kfile, ARIA_TABLE_CAPABILITIES *cap); +int aria_read_index(File kfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block, + uchar *buffer); +int aria_read_data(File dfile, ARIA_TABLE_CAPABILITIES *cap, ulonglong block, + uchar *buffer, size_t *bytes_read); diff --git a/include/big_endian.h b/include/big_endian.h index 021b6abc383..5f6e623f6a0 100644 --- a/include/big_endian.h +++ b/include/big_endian.h @@ -11,7 +11,7 @@ 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 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */ /* Data in big-endian format. diff --git a/include/byte_order_generic.h b/include/byte_order_generic.h index d4ac27eeb9c..14b00fc87eb 100644 --- a/include/byte_order_generic.h +++ b/include/byte_order_generic.h @@ -11,7 +11,7 @@ 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 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */ /* Endianness-independent definitions for architectures other diff --git a/include/byte_order_generic_x86.h b/include/byte_order_generic_x86.h index a97dd0f43a3..5df208ff35c 100644 --- a/include/byte_order_generic_x86.h +++ b/include/byte_order_generic_x86.h @@ -11,7 +11,7 @@ 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 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */ /* Optimized function-like macros for the x86 architecture (_WIN32 included). diff --git a/include/byte_order_generic_x86_64.h b/include/byte_order_generic_x86_64.h index fbc6e1f536b..42c1944ad21 100644 --- a/include/byte_order_generic_x86_64.h +++ b/include/byte_order_generic_x86_64.h @@ -11,7 +11,7 @@ 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 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */ /* Optimized function-like macros for the x86 architecture (_WIN32 included). diff --git a/include/json_lib.h b/include/json_lib.h index 781978cd6ca..b6add6d13a3 100644 --- a/include/json_lib.h +++ b/include/json_lib.h @@ -174,11 +174,11 @@ enum json_value_types { JSON_VALUE_OBJECT=1, JSON_VALUE_ARRAY=2, - JSON_VALUE_STRING, - JSON_VALUE_NUMBER, - JSON_VALUE_TRUE, - JSON_VALUE_FALSE, - JSON_VALUE_NULL + JSON_VALUE_STRING=3, + JSON_VALUE_NUMBER=4, + JSON_VALUE_TRUE=5, + JSON_VALUE_FALSE=6, + JSON_VALUE_NULL=7 }; @@ -319,6 +319,12 @@ int json_skip_to_level(json_engine_t *j, int level); json_skip_to_level((json_engine), (json_engine)->stack_p) +/* + works as json_skip_level() but also counts items on the current + level skipped. +*/ +int json_skip_level_and_count(json_engine_t *j, int *n_items_skipped); + #define json_skip_array_item json_skip_key /* @@ -417,10 +423,15 @@ int json_path_parts_compare( int json_path_compare(const json_path_t *a, const json_path_t *b, enum json_value_types vt); +int json_valid(const char *js, size_t js_len, CHARSET_INFO *cs); + +int json_locate_key(const char *js, const char *js_end, + const char *kname, + const char **key_start, const char **key_end, + int *comma_pos); #ifdef __cplusplus } #endif #endif /* JSON_LIB_INCLUDED */ - diff --git a/include/lf.h b/include/lf.h index a9d7e9ee688..fe861a524dc 100644 --- a/include/lf.h +++ b/include/lf.h @@ -167,6 +167,8 @@ void *lf_hash_search_using_hash_value(LF_HASH *hash, LF_PINS *pins, int lf_hash_delete(LF_HASH *hash, LF_PINS *pins, const void *key, uint keylen); int lf_hash_iterate(LF_HASH *hash, LF_PINS *pins, my_hash_walk_action action, void *argument); +#define lf_hash_size(hash) \ + my_atomic_load32_explicit(&(hash)->count, MY_MEMORY_ORDER_RELAXED) /* shortcut macros to access underlying pinbox functions from an LF_HASH see lf_pinbox_get_pins() and lf_pinbox_put_pins() diff --git a/include/little_endian.h b/include/little_endian.h index 7223fea648f..eb704f4344f 100644 --- a/include/little_endian.h +++ b/include/little_endian.h @@ -11,7 +11,7 @@ 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 02111-1307 USA */ + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */ /* Data in little-endian format. diff --git a/include/m_ctype.h b/include/m_ctype.h index a4aa5b51218..c6273590bbe 100644 --- a/include/m_ctype.h +++ b/include/m_ctype.h @@ -362,7 +362,6 @@ extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler; extern MY_COLLATION_HANDLER my_collation_8bit_nopad_bin_handler; extern MY_COLLATION_HANDLER my_collation_8bit_simple_nopad_ci_handler; -extern MY_COLLATION_HANDLER my_collation_ucs2_uca_handler; /* Some typedef to make it easy for C++ to make function pointers */ typedef int (*my_charset_conv_mb_wc)(CHARSET_INFO *, my_wc_t *, @@ -872,14 +871,6 @@ size_t my_strnxfrm_mb_nopad(CHARSET_INFO *, uchar *dst, size_t dstlen, uint nweights, const uchar *src, size_t srclen, uint flags); -size_t my_strnxfrm_unicode(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); - -size_t my_strnxfrm_unicode_nopad(CHARSET_INFO *, - uchar *dst, size_t dstlen, uint nweights, - const uchar *src, size_t srclen, uint flags); - size_t my_strnxfrmlen_unicode(CHARSET_INFO *, size_t); size_t my_strnxfrm_unicode_full_bin(CHARSET_INFO *, diff --git a/include/my_bit.h b/include/my_bit.h index 36764d8253d..b19c660d0cd 100644 --- a/include/my_bit.h +++ b/include/my_bit.h @@ -106,11 +106,11 @@ static inline uint32 my_clear_highest_bit(uint32 v) static inline uint32 my_reverse_bits(uint32 key) { - return (uint32) - (_my_bits_reverse_table[ key & 255] << 24) | - (_my_bits_reverse_table[(key>> 8) & 255] << 16) | - (_my_bits_reverse_table[(key>>16) & 255] << 8) | - _my_bits_reverse_table[(key>>24) ]; + return + ((uint32)_my_bits_reverse_table[ key & 255] << 24) | + ((uint32)_my_bits_reverse_table[(key>> 8) & 255] << 16) | + ((uint32)_my_bits_reverse_table[(key>>16) & 255] << 8) | + (uint32)_my_bits_reverse_table[(key>>24) ]; } /* diff --git a/include/my_counter.h b/include/my_counter.h new file mode 100644 index 00000000000..c5cbe296df0 --- /dev/null +++ b/include/my_counter.h @@ -0,0 +1,49 @@ +#ifndef MY_COUNTER_H_INCLUDED +#define MY_COUNTER_H_INCLUDED +/* + Copyright (C) 2018 MariaDB Foundation + + 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-1301 USA +*/ + +#include + + +template class Atomic_counter +{ + std::atomic m_counter; + + Type add(Type i) { return m_counter.fetch_add(i, std::memory_order_relaxed); } + Type sub(Type i) { return m_counter.fetch_sub(i, std::memory_order_relaxed); } + +public: + Atomic_counter(const Atomic_counter &rhs) + { m_counter.store(rhs, std::memory_order_relaxed); } + Atomic_counter(Type val): m_counter(val) {} + Atomic_counter() {} + + Type operator++(int) { return add(1); } + Type operator--(int) { return sub(1); } + + Type operator++() { return add(1) + 1; } + Type operator--() { return sub(1) - 1; } + + Type operator+=(const Type i) { return add(i) + i; } + Type operator-=(const Type i) { return sub(i) - i; } + + operator Type() const { return m_counter.load(std::memory_order_relaxed); } + Type operator=(const Type val) + { m_counter.store(val, std::memory_order_relaxed); return val; } +}; +#endif /* MY_COUNTER_H_INCLUDED */ diff --git a/include/my_cpu.h b/include/my_cpu.h index f2e26fca70c..cab016a8c4a 100644 --- a/include/my_cpu.h +++ b/include/my_cpu.h @@ -13,7 +13,7 @@ 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 02111-1307 USA + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02111-1301 USA */ /* instructions for specific cpu's */ diff --git a/include/my_global.h b/include/my_global.h index 40a83c6ab48..69b91f8b870 100644 --- a/include/my_global.h +++ b/include/my_global.h @@ -241,7 +241,9 @@ AIX includes inttypes.h from sys/types.h Explicitly request format macros before the first inclusion of inttypes.h */ -#define __STDC_FORMAT_MACROS +#if !defined(__STDC_FORMAT_MACROS) +#define __STDC_FORMAT_MACROS +#endif // !defined(__STDC_FORMAT_MACROS) #endif @@ -979,7 +981,6 @@ typedef unsigned long my_off_t; TODO Convert these to use Bitmap class. */ typedef ulonglong table_map; /* Used for table bits in join */ -typedef ulong nesting_map; /* Used for flags of nesting constructs */ /* often used type names - opaque declarations */ typedef const struct charset_info_st CHARSET_INFO; @@ -1047,7 +1048,9 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */ #include -#ifdef HAVE_CHARSET_utf8 +#ifdef HAVE_CHARSET_utf8mb4 +#define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8mb4" +#elif defined(HAVE_CHARSET_utf8) #define MYSQL_UNIVERSAL_CLIENT_CHARSET "utf8" #else #define MYSQL_UNIVERSAL_CLIENT_CHARSET MYSQL_DEFAULT_CHARSET_NAME @@ -1065,7 +1068,7 @@ typedef ulong myf; /* Type of MyFlags in my_funcs */ static inline char *dlerror(void) { static char win_errormsg[2048]; - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, 0, GetLastError(), 0, win_errormsg, 2048, NULL); return win_errormsg; } diff --git a/include/my_pthread.h b/include/my_pthread.h index c6379047c16..843701ccab9 100644 --- a/include/my_pthread.h +++ b/include/my_pthread.h @@ -161,7 +161,7 @@ int pthread_cancel(pthread_t thread); #define pthread_key(T,V) pthread_key_t V #define my_pthread_getspecific_ptr(T,V) my_pthread_getspecific(T,(V)) #define my_pthread_setspecific_ptr(T,V) pthread_setspecific(T,(void*) (V)) -#define pthread_detach_this_thread() { pthread_t tmp=pthread_self() ; pthread_detach(tmp); } +#define pthread_detach_this_thread() #define pthread_handler_t EXTERNC void * typedef void *(* pthread_handler)(void *); @@ -189,7 +189,19 @@ extern int my_pthread_create_detached; int sigwait(sigset_t *set, int *sig); #endif -#define my_sigwait(A,B) sigwait((A),(B)) +static inline int my_sigwait(sigset_t *set, int *sig, int *code) +{ +#ifdef HAVE_SIGWAITINFO + siginfo_t siginfo; + *sig= sigwaitinfo(set, &siginfo); + *code= siginfo.si_code; + return *sig < 0 ? errno : 0; +#else +#define SI_KERNEL 128 + *code= 0; + return sigwait(set, sig); +#endif +} #if defined(HAVE_SIGTHREADMASK) && !defined(HAVE_PTHREAD_SIGMASK) #define pthread_sigmask(A,B,C) sigthreadmask((A),(B),(C)) diff --git a/include/my_service_manager.h b/include/my_service_manager.h index 4d88e992b5e..d9f41ace4d5 100644 --- a/include/my_service_manager.h +++ b/include/my_service_manager.h @@ -24,7 +24,9 @@ sd-daemon.h may include inttypes.h. Explicitly request format macros before the first inclusion of inttypes.h. */ +#if !defined(__STDC_FORMAT_MACROS) #define __STDC_FORMAT_MACROS +#endif // !defined(__STDC_FORMAT_MACROS) #include /** INTERVAL in seconds followed by printf style status */ #define service_manager_extend_timeout(INTERVAL, FMTSTR, ...) \ diff --git a/include/my_sys.h b/include/my_sys.h index 325c473eb23..11993c02516 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -903,6 +903,7 @@ static inline char *safe_strdup_root(MEM_ROOT *root, const char *str) } extern char *strmake_root(MEM_ROOT *root,const char *str,size_t len); extern void *memdup_root(MEM_ROOT *root,const void *str, size_t len); +extern LEX_CSTRING safe_lexcstrdup_root(MEM_ROOT *root, const LEX_CSTRING str); extern my_bool my_compress(uchar *, size_t *, size_t *); extern my_bool my_uncompress(uchar *, size_t , size_t *); extern uchar *my_compress_alloc(const uchar *packet, size_t *len, diff --git a/include/my_time.h b/include/my_time.h index cec168c6fd6..27011be8b47 100644 --- a/include/my_time.h +++ b/include/my_time.h @@ -57,22 +57,20 @@ extern uchar days_in_month[]; /* Flags to str_to_datetime */ -/* - TIME_FUZZY_DATES is used for the result will only be used for comparison - purposes. Conversion is as relaxed as possible. -*/ -#define TIME_FUZZY_DATES 1U -#define TIME_DATETIME_ONLY 2U -#define TIME_TIME_ONLY 4U -#define TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */ -#define TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */ -#define TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */ +#define C_TIME_NO_ZERO_IN_DATE (1UL << 23) /* == MODE_NO_ZERO_IN_DATE */ +#define C_TIME_NO_ZERO_DATE (1UL << 24) /* == MODE_NO_ZERO_DATE */ +#define C_TIME_INVALID_DATES (1UL << 25) /* == MODE_INVALID_DATES */ #define MYSQL_TIME_WARN_TRUNCATED 1U #define MYSQL_TIME_WARN_OUT_OF_RANGE 2U +#define MYSQL_TIME_WARN_EDOM 4U +#define MYSQL_TIME_WARN_ZERO_DATE 8U #define MYSQL_TIME_NOTE_TRUNCATED 16U -#define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|MYSQL_TIME_WARN_OUT_OF_RANGE) +#define MYSQL_TIME_WARN_WARNINGS (MYSQL_TIME_WARN_TRUNCATED|\ + MYSQL_TIME_WARN_OUT_OF_RANGE|\ + MYSQL_TIME_WARN_EDOM|\ + MYSQL_TIME_WARN_ZERO_DATE) #define MYSQL_TIME_WARN_NOTES (MYSQL_TIME_NOTE_TRUNCATED) #define MYSQL_TIME_WARN_HAVE_WARNINGS(x) MY_TEST((x) & MYSQL_TIME_WARN_WARNINGS) @@ -81,6 +79,16 @@ extern uchar days_in_month[]; /* Useful constants */ #define SECONDS_IN_24H 86400L +/* Limits for the INTERVAL data type */ + + /* Number of hours between '0001-01-01 00h' and '9999-12-31 23h' */ +#define TIME_MAX_INTERVAL_HOUR 87649415 +#define TIME_MAX_INTERVAL_HOUR_CHAR_LENGTH 8 + +/* Number of full days between '0001-01-01' and '9999-12-31'*/ +#define TIME_MAX_INTERVAL_DAY 3652058 /*87649415/24*/ +#define TIME_MAX_INTERVAL_DAY_CHAR_LENGTH 7 + /* Limits for the TIME data type */ #define TIME_MAX_HOUR 838 #define TIME_MAX_MINUTE 59 @@ -100,35 +108,46 @@ typedef struct st_mysql_time_status { int warnings; uint precision; + uint nanoseconds; } MYSQL_TIME_STATUS; static inline void my_time_status_init(MYSQL_TIME_STATUS *status) { status->warnings= 0; status->precision= 0; + status->nanoseconds= 0; } my_bool check_date(const MYSQL_TIME *ltime, my_bool not_zero_date, ulonglong flags, int *was_cut); -my_bool str_to_time(const char *str, size_t length, MYSQL_TIME *l_time, - ulonglong flag, MYSQL_TIME_STATUS *status); -my_bool str_to_datetime(const char *str, size_t length, MYSQL_TIME *l_time, - ulonglong flags, MYSQL_TIME_STATUS *status); -longlong number_to_datetime(longlong nr, ulong sec_part, MYSQL_TIME *time_res, - ulonglong flags, int *was_cut); +my_bool str_to_DDhhmmssff(const char *str, size_t length, MYSQL_TIME *l_time, + ulong max_hour, MYSQL_TIME_STATUS *status); +my_bool str_to_datetime_or_date_or_time(const char *str, size_t length, + MYSQL_TIME *to, ulonglong flag, + MYSQL_TIME_STATUS *status, + ulong time_max_hour, + ulong time_err_hour); +my_bool +str_to_datetime_or_date_or_interval_hhmmssff(const char *str, size_t length, + MYSQL_TIME *to, ulonglong flag, + MYSQL_TIME_STATUS *status, + ulong time_max_hour, + ulong time_err_hour); +my_bool +str_to_datetime_or_date_or_interval_day(const char *str, size_t length, + MYSQL_TIME *to, ulonglong flag, + MYSQL_TIME_STATUS *status, + ulong time_max_hour, + ulong time_err_hour); +my_bool str_to_datetime_or_date(const char *str, size_t length, MYSQL_TIME *to, + ulonglong flags, MYSQL_TIME_STATUS *status); -static inline -longlong double_to_datetime(double nr, MYSQL_TIME *ltime, ulonglong flags, int *cut) -{ - if (nr < 0 || nr > LONGLONG_MAX) - nr= (double)LONGLONG_MAX; - return number_to_datetime((longlong) floor(nr), - (ulong)((nr-floor(nr))*TIME_SECOND_PART_FACTOR), - ltime, flags, cut); -} +longlong number_to_datetime_or_date(longlong nr, ulong sec_part, + MYSQL_TIME *time_res, + ulonglong flags, int *was_cut); +int number_to_time_only(my_bool neg, ulonglong nr, ulong sec_part, + ulong max_hour, MYSQL_TIME *to, int *was_cut); -int number_to_time(my_bool neg, ulonglong nr, ulong sec_part, - MYSQL_TIME *ltime, int *was_cut); ulonglong TIME_to_ulonglong_datetime(const MYSQL_TIME *); ulonglong TIME_to_ulonglong_date(const MYSQL_TIME *); ulonglong TIME_to_ulonglong_time(const MYSQL_TIME *); @@ -191,6 +210,7 @@ void set_zero_time(MYSQL_TIME *tm, enum enum_mysql_timestamp_type time_type); #define MAX_DATE_STRING_REP_LENGTH 30 #define AUTO_SEC_PART_DIGITS DECIMAL_NOT_SPECIFIED +int my_interval_DDhhmmssff_to_str(const MYSQL_TIME *, char *to, uint digits); int my_time_to_str(const MYSQL_TIME *l_time, char *to, uint digits); int my_date_to_str(const MYSQL_TIME *l_time, char *to); int my_datetime_to_str(const MYSQL_TIME *l_time, char *to, uint digits); diff --git a/include/mysql/plugin.h b/include/mysql/plugin.h index b122d888c6d..02a87c6db71 100644 --- a/include/mysql/plugin.h +++ b/include/mysql/plugin.h @@ -75,7 +75,7 @@ typedef struct st_mysql_xid MYSQL_XID; #define MYSQL_PLUGIN_INTERFACE_VERSION 0x0104 /* MariaDB plugin interface version */ -#define MARIA_PLUGIN_INTERFACE_VERSION 0x010d +#define MARIA_PLUGIN_INTERFACE_VERSION 0x010e /* The allowable types of plugins diff --git a/include/mysql/plugin_audit.h.pp b/include/mysql/plugin_audit.h.pp index 89f7dcc36c4..c5ae678e82a 100644 --- a/include/mysql/plugin_audit.h.pp +++ b/include/mysql/plugin_audit.h.pp @@ -374,6 +374,51 @@ extern struct thd_wait_service_st { } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); +enum json_types +{ + JSV_BAD_JSON=-1, + JSV_NOTHING=0, + JSV_OBJECT=1, + JSV_ARRAY=2, + JSV_STRING=3, + JSV_NUMBER=4, + JSV_TRUE=5, + JSV_FALSE=6, + JSV_NULL=7 +}; +extern struct json_service_st { + enum json_types (*json_type)(const char *js, const char *js_end, + const char **value, int *value_len); + enum json_types (*json_get_array_item)(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); + enum json_types (*json_get_object_key)(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); + enum json_types (*json_get_object_nkey)(const char *js,const char *js_end, + int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); + int (*json_escape_string)(const char *str,const char *str_end, + char *json, char *json_end); + int (*json_unescape_json)(const char *json_str, const char *json_end, + char *res, char *res_end); +} *json_service; +enum json_types json_type(const char *js, const char *js_end, + const char **value, int *value_len); +enum json_types json_get_array_item(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); +enum json_types json_get_object_key(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); +enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); +int json_escape_string(const char *str,const char *str_end, + char *json, char *json_end); +int json_unescape_json(const char *json_str, const char *json_end, + char *res, char *res_end); struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/plugin_auth.h b/include/mysql/plugin_auth.h index 638d9b57fd9..44e51c3fd0b 100644 --- a/include/mysql/plugin_auth.h +++ b/include/mysql/plugin_auth.h @@ -27,7 +27,7 @@ #include -#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0201 +#define MYSQL_AUTHENTICATION_INTERFACE_VERSION 0x0202 #include @@ -60,7 +60,8 @@ typedef struct st_mysql_server_auth_info /** A corresponding column value from the mysql.user table for the - matching account name + matching account name or the preprocessed value, if preprocess_hash + method is not NULL */ const char *auth_string; @@ -130,6 +131,47 @@ struct st_mysql_auth used for authorization. */ int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); + /** + Create a password hash (or digest) out of a plain-text password + + Used in SET PASSWORD, GRANT, and CREATE USER to convert user specified + plain-text password into a value that will be stored in mysql.user table. + + @see preprocess_hash + + @param password plain-text password + @param password_length plain-text password length + @param hash the digest will be stored there + @param hash_length in: hash buffer size + out: the actual length of the hash + + @return 0 for ok, 1 for error + + Can be NULL. + */ + int (*hash_password)(const char *password, size_t password_length, + char *hash, size_t *hash_length); + + /** + Prepare the password hash for authentication. + + Password hash is stored in the authentication_string column of the + mysql.user table in a text form. If a plugin needs to preprocess the + value somehow before the authentication (e.g. convert from hex or base64 + to binary), it can do it in this method. This way the conversion + will happen only once, not for every authentication attempt. + + The value written to the out buffer will be cached and later made + available to the authenticate_user() method in the + MYSQL_SERVER_AUTH_INFO::auth_string[] buffer. + + @return 0 for ok, 1 for error + + Can be NULL, in this case the mysql.user.authentication_string value will + be given to the authenticate_user() method as is, unconverted. + */ + int (*preprocess_hash)(const char *hash, size_t hash_length, + unsigned char *out, size_t *out_length); }; #ifdef __cplusplus diff --git a/include/mysql/plugin_auth.h.pp b/include/mysql/plugin_auth.h.pp index e515699cad6..41cb7d075c4 100644 --- a/include/mysql/plugin_auth.h.pp +++ b/include/mysql/plugin_auth.h.pp @@ -374,6 +374,51 @@ extern struct thd_wait_service_st { } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); +enum json_types +{ + JSV_BAD_JSON=-1, + JSV_NOTHING=0, + JSV_OBJECT=1, + JSV_ARRAY=2, + JSV_STRING=3, + JSV_NUMBER=4, + JSV_TRUE=5, + JSV_FALSE=6, + JSV_NULL=7 +}; +extern struct json_service_st { + enum json_types (*json_type)(const char *js, const char *js_end, + const char **value, int *value_len); + enum json_types (*json_get_array_item)(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); + enum json_types (*json_get_object_key)(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); + enum json_types (*json_get_object_nkey)(const char *js,const char *js_end, + int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); + int (*json_escape_string)(const char *str,const char *str_end, + char *json, char *json_end); + int (*json_unescape_json)(const char *json_str, const char *json_end, + char *res, char *res_end); +} *json_service; +enum json_types json_type(const char *js, const char *js_end, + const char **value, int *value_len); +enum json_types json_get_array_item(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); +enum json_types json_get_object_key(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); +enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); +int json_escape_string(const char *str,const char *str_end, + char *json, char *json_end); +int json_unescape_json(const char *json_str, const char *json_end, + char *res, char *res_end); struct st_mysql_xid { long formatID; long gtrid_length; @@ -561,4 +606,8 @@ struct st_mysql_auth int interface_version; const char *client_auth_plugin; int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, MYSQL_SERVER_AUTH_INFO *info); + int (*hash_password)(const char *password, size_t password_length, + char *hash, size_t *hash_length); + int (*preprocess_hash)(const char *hash, size_t hash_length, + unsigned char *out, size_t *out_length); }; diff --git a/include/mysql/plugin_encryption.h.pp b/include/mysql/plugin_encryption.h.pp index 7defe0aec2c..6597decfbef 100644 --- a/include/mysql/plugin_encryption.h.pp +++ b/include/mysql/plugin_encryption.h.pp @@ -374,6 +374,51 @@ extern struct thd_wait_service_st { } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); +enum json_types +{ + JSV_BAD_JSON=-1, + JSV_NOTHING=0, + JSV_OBJECT=1, + JSV_ARRAY=2, + JSV_STRING=3, + JSV_NUMBER=4, + JSV_TRUE=5, + JSV_FALSE=6, + JSV_NULL=7 +}; +extern struct json_service_st { + enum json_types (*json_type)(const char *js, const char *js_end, + const char **value, int *value_len); + enum json_types (*json_get_array_item)(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); + enum json_types (*json_get_object_key)(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); + enum json_types (*json_get_object_nkey)(const char *js,const char *js_end, + int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); + int (*json_escape_string)(const char *str,const char *str_end, + char *json, char *json_end); + int (*json_unescape_json)(const char *json_str, const char *json_end, + char *res, char *res_end); +} *json_service; +enum json_types json_type(const char *js, const char *js_end, + const char **value, int *value_len); +enum json_types json_get_array_item(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); +enum json_types json_get_object_key(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); +enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); +int json_escape_string(const char *str,const char *str_end, + char *json, char *json_end); +int json_unescape_json(const char *json_str, const char *json_end, + char *res, char *res_end); struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/plugin_ftparser.h.pp b/include/mysql/plugin_ftparser.h.pp index a36f51e74e1..bd1cfc7b68b 100644 --- a/include/mysql/plugin_ftparser.h.pp +++ b/include/mysql/plugin_ftparser.h.pp @@ -374,6 +374,51 @@ extern struct thd_wait_service_st { } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); +enum json_types +{ + JSV_BAD_JSON=-1, + JSV_NOTHING=0, + JSV_OBJECT=1, + JSV_ARRAY=2, + JSV_STRING=3, + JSV_NUMBER=4, + JSV_TRUE=5, + JSV_FALSE=6, + JSV_NULL=7 +}; +extern struct json_service_st { + enum json_types (*json_type)(const char *js, const char *js_end, + const char **value, int *value_len); + enum json_types (*json_get_array_item)(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); + enum json_types (*json_get_object_key)(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); + enum json_types (*json_get_object_nkey)(const char *js,const char *js_end, + int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); + int (*json_escape_string)(const char *str,const char *str_end, + char *json, char *json_end); + int (*json_unescape_json)(const char *json_str, const char *json_end, + char *res, char *res_end); +} *json_service; +enum json_types json_type(const char *js, const char *js_end, + const char **value, int *value_len); +enum json_types json_get_array_item(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); +enum json_types json_get_object_key(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); +enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); +int json_escape_string(const char *str,const char *str_end, + char *json, char *json_end); +int json_unescape_json(const char *json_str, const char *json_end, + char *res, char *res_end); struct st_mysql_xid { long formatID; long gtrid_length; diff --git a/include/mysql/plugin_password_validation.h b/include/mysql/plugin_password_validation.h index e2763483db6..699d42d6b50 100644 --- a/include/mysql/plugin_password_validation.h +++ b/include/mysql/plugin_password_validation.h @@ -42,8 +42,8 @@ struct st_mariadb_password_validation Function provided by the plugin which should perform password validation and return 0 if the password has passed the validation. */ - int (*validate_password)(MYSQL_CONST_LEX_STRING *username, - MYSQL_CONST_LEX_STRING *password); + int (*validate_password)(const MYSQL_CONST_LEX_STRING *username, + const MYSQL_CONST_LEX_STRING *password); }; #ifdef __cplusplus diff --git a/include/mysql/plugin_password_validation.h.pp b/include/mysql/plugin_password_validation.h.pp index 9701ad1b92f..2f9d2299c1f 100644 --- a/include/mysql/plugin_password_validation.h.pp +++ b/include/mysql/plugin_password_validation.h.pp @@ -374,6 +374,51 @@ extern struct thd_wait_service_st { } *thd_wait_service; void thd_wait_begin(void* thd, int wait_type); void thd_wait_end(void* thd); +enum json_types +{ + JSV_BAD_JSON=-1, + JSV_NOTHING=0, + JSV_OBJECT=1, + JSV_ARRAY=2, + JSV_STRING=3, + JSV_NUMBER=4, + JSV_TRUE=5, + JSV_FALSE=6, + JSV_NULL=7 +}; +extern struct json_service_st { + enum json_types (*json_type)(const char *js, const char *js_end, + const char **value, int *value_len); + enum json_types (*json_get_array_item)(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); + enum json_types (*json_get_object_key)(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); + enum json_types (*json_get_object_nkey)(const char *js,const char *js_end, + int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); + int (*json_escape_string)(const char *str,const char *str_end, + char *json, char *json_end); + int (*json_unescape_json)(const char *json_str, const char *json_end, + char *res, char *res_end); +} *json_service; +enum json_types json_type(const char *js, const char *js_end, + const char **value, int *value_len); +enum json_types json_get_array_item(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); +enum json_types json_get_object_key(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); +enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); +int json_escape_string(const char *str,const char *str_end, + char *json, char *json_end); +int json_unescape_json(const char *json_str, const char *json_end, + char *res, char *res_end); struct st_mysql_xid { long formatID; long gtrid_length; @@ -531,6 +576,6 @@ void thd_wakeup_subsequent_commits(void* thd, int wakeup_error); struct st_mariadb_password_validation { int interface_version; - int (*validate_password)(MYSQL_CONST_LEX_STRING *username, - MYSQL_CONST_LEX_STRING *password); + int (*validate_password)(const MYSQL_CONST_LEX_STRING *username, + const MYSQL_CONST_LEX_STRING *password); }; diff --git a/include/mysql/psi/mysql_socket.h b/include/mysql/psi/mysql_socket.h index b8854edbfd0..2076f8cc999 100644 --- a/include/mysql/psi/mysql_socket.h +++ b/include/mysql/psi/mysql_socket.h @@ -735,7 +735,7 @@ inline_mysql_socket_send MYSQL_SOCKET mysql_socket, const SOCKBUF_T *buf, size_t n, int flags) { ssize_t result; - + DBUG_ASSERT(mysql_socket.fd != INVALID_SOCKET); #ifdef HAVE_PSI_SOCKET_INTERFACE if (psi_likely(mysql_socket.m_psi != NULL)) { @@ -776,7 +776,7 @@ inline_mysql_socket_recv MYSQL_SOCKET mysql_socket, SOCKBUF_T *buf, size_t n, int flags) { ssize_t result; - + DBUG_ASSERT(mysql_socket.fd != INVALID_SOCKET); #ifdef HAVE_PSI_SOCKET_INTERFACE if (psi_likely(mysql_socket.m_psi != NULL)) { diff --git a/include/mysql/service_json.h b/include/mysql/service_json.h new file mode 100644 index 00000000000..141b76279a5 --- /dev/null +++ b/include/mysql/service_json.h @@ -0,0 +1,117 @@ +/* Copyright (C) 2018 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 Street, Fifth Floor, Boston, MA 02111-1301 USA */ + +#ifndef MYSQL_SERVICE_JSON +#define MYSQL_SERVICE_JSON + +/** + @file + json service + + Esports JSON parsing methods for plugins to use. + + Fuctions of the service: + js_type - returns the type of the JSON argument, + and the parsed value if it's scalar (not object or array) + + js_get_array_item - expecs JSON array as an argument, + and returns the n_item's item's type and value + Returns JSV_NOTHING type if the array is shorter + than n_item and the actual length of the array in v_len. + + js_get_object_key - expects JSON object as an argument, + searches for a key in the object, return it's type and value. + JSV_NOTHING if no such key found, the number of keys + in v_len. + + js_get_object_nkey - expects JSON object as an argument. + finds n_key's key in the object, returns it's name, type and value. + JSV_NOTHING if object has less keys than n_key. +*/ + + +#ifdef __cplusplus +extern "C" { +#endif + +enum json_types +{ + JSV_BAD_JSON=-1, + JSV_NOTHING=0, + JSV_OBJECT=1, + JSV_ARRAY=2, + JSV_STRING=3, + JSV_NUMBER=4, + JSV_TRUE=5, + JSV_FALSE=6, + JSV_NULL=7 +}; + +extern struct json_service_st { + enum json_types (*json_type)(const char *js, const char *js_end, + const char **value, int *value_len); + enum json_types (*json_get_array_item)(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); + enum json_types (*json_get_object_key)(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); + enum json_types (*json_get_object_nkey)(const char *js,const char *js_end, + int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); + int (*json_escape_string)(const char *str,const char *str_end, + char *json, char *json_end); + int (*json_unescape_json)(const char *json_str, const char *json_end, + char *res, char *res_end); +} *json_service; + +#ifdef MYSQL_DYNAMIC_PLUGIN + +#define json_type json_service->json_type +#define json_get_array_item json_service->json_get_array_item +#define json_get_object_key json_service->json_get_object_key +#define json_get_object_nkey json_service->json_get_object_nkey +#define json_escape_string json_service->json_escape_string +#define json_unescape_json json_service->json_unescape_json + +#else + +enum json_types json_type(const char *js, const char *js_end, + const char **value, int *value_len); +enum json_types json_get_array_item(const char *js, const char *js_end, + int n_item, + const char **value, int *value_len); +enum json_types json_get_object_key(const char *js, const char *js_end, + const char *key, + const char **value, int *value_len); +enum json_types json_get_object_nkey(const char *js,const char *js_end, int nkey, + const char **keyname, const char **keyname_end, + const char **value, int *value_len); +int json_escape_string(const char *str,const char *str_end, + char *json, char *json_end); +int json_unescape_json(const char *json_str, const char *json_end, + char *res, char *res_end); + +#endif /*MYSQL_DYNAMIC_PLUGIN*/ + + +#ifdef __cplusplus +} +#endif + +#endif /*MYSQL_SERVICE_JSON */ + + diff --git a/include/mysql/service_kill_statement.h b/include/mysql/service_kill_statement.h index 995b21f0a9f..bfb222301eb 100644 --- a/include/mysql/service_kill_statement.h +++ b/include/mysql/service_kill_statement.h @@ -1,4 +1,4 @@ -/* Copyright (c) 2013, Monty Program Ab. +/* Copyright (c) 2013, 2018, MariaDB 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 @@ -27,7 +27,7 @@ time-consuming loops, and gracefully abort the operation if it is non-zero. - thd_is_killed(thd) + thd_killed(thd) @return 0 - no KILL statement was issued, continue normally @return 1 - there was a KILL statement, abort the execution. diff --git a/include/mysql/service_wsrep.h b/include/mysql/service_wsrep.h index 1540a5e56fe..5aa97cdb47e 100644 --- a/include/mysql/service_wsrep.h +++ b/include/mysql/service_wsrep.h @@ -1,5 +1,20 @@ #ifndef MYSQL_SERVICE_WSREP_INCLUDED +#define MYSQL_SERVICE_WSREP_INCLUDED + +enum Wsrep_service_key_type +{ + WSREP_SERVICE_KEY_SHARED, + WSREP_SERVICE_KEY_REFERENCE, + WSREP_SERVICE_KEY_UPDATE, + WSREP_SERVICE_KEY_EXCLUSIVE +}; + +#if (defined (MYSQL_DYNAMIC_PLUGIN) && defined(MYSQL_SERVICE_WSREP_DYNAMIC_INCLUDED)) || (!defined(MYSQL_DYNAMIC_PLUGIN) && defined(MYSQL_SERVICE_WSREP_STATIC_INCLUDED)) + +#else + /* Copyright (c) 2015 MariaDB Corporation Ab + 2018 Codership Oy 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 @@ -21,151 +36,92 @@ Interface to WSREP functionality in the server. For engines that want to support galera. */ - +#include #ifdef __cplusplus -extern "C" { #endif -enum wsrep_conflict_state { - NO_CONFLICT, - MUST_ABORT, - ABORTING, - ABORTED, - MUST_REPLAY, - REPLAYING, - RETRY_AUTOCOMMIT, - CERT_FAILURE, -}; - -enum wsrep_exec_mode { - /* Transaction processing before replication. */ - LOCAL_STATE, - /* Slave thread applying write sets from other nodes or replaying thread. */ - REPL_RECV, - /* Total-order-isolation mode. */ - TOTAL_ORDER, - /* - Transaction procession after it has been replicated in prepare stage and - has passed certification. - */ - LOCAL_COMMIT -}; - -enum wsrep_query_state { - QUERY_IDLE, - QUERY_EXEC, - QUERY_COMMITTING, - QUERY_EXITING, - QUERY_ROLLINGBACK, -}; - -enum wsrep_trx_status { - WSREP_TRX_OK, - WSREP_TRX_CERT_FAIL, /* certification failure, must abort */ - WSREP_TRX_SIZE_EXCEEDED, /* trx size exceeded */ - WSREP_TRX_ERROR, /* native mysql error */ -}; - struct xid_t; -struct wsrep; struct wsrep_ws_handle; struct wsrep_buf; +/* Must match to definition in sql/mysqld.h */ +typedef int64 query_id_t; + + extern struct wsrep_service_st { - struct wsrep * (*get_wsrep_func)(); - my_bool (*get_wsrep_certify_nonPK_func)(); - my_bool (*get_wsrep_debug_func)(); - my_bool (*get_wsrep_drupal_282555_workaround_func)(); my_bool (*get_wsrep_recovery_func)(); - my_bool (*get_wsrep_load_data_splitting_func)(); - my_bool (*get_wsrep_log_conflicts_func)(); - long (*get_wsrep_protocol_version_func)(); - my_bool (*wsrep_aborting_thd_contains_func)(THD *thd); - void (*wsrep_aborting_thd_enqueue_func)(THD *thd); - bool (*wsrep_consistency_check_func)(THD *thd); - int (*wsrep_is_wsrep_xid_func)(const struct xid_t *xid); + bool (*wsrep_consistency_check_func)(MYSQL_THD thd); + int (*wsrep_is_wsrep_xid_func)(const void *xid); long long (*wsrep_xid_seqno_func)(const struct xid_t *xid); const unsigned char* (*wsrep_xid_uuid_func)(const struct xid_t *xid); - void (*wsrep_lock_rollback_func)(); - int (*wsrep_on_func)(MYSQL_THD); - void (*wsrep_post_commit_func)(THD* thd, bool all); - bool (*wsrep_prepare_key_func)(const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*); - enum wsrep_trx_status (*wsrep_run_wsrep_commit_func)(THD *thd, bool all); - void (*wsrep_thd_LOCK_func)(THD *thd); - void (*wsrep_thd_UNLOCK_func)(THD *thd); - void (*wsrep_thd_awake_func)(THD *thd, my_bool signal); - enum wsrep_conflict_state (*wsrep_thd_conflict_state_func)(MYSQL_THD, my_bool); - const char * (*wsrep_thd_conflict_state_str_func)(THD *thd); - enum wsrep_exec_mode (*wsrep_thd_exec_mode_func)(THD *thd); - const char * (*wsrep_thd_exec_mode_str_func)(THD *thd); - enum wsrep_conflict_state (*wsrep_thd_get_conflict_state_func)(MYSQL_THD); - my_bool (*wsrep_thd_is_BF_func)(MYSQL_THD , my_bool); - my_bool (*wsrep_thd_is_wsrep_func)(MYSQL_THD thd); - char * (*wsrep_thd_query_func)(THD *thd); - enum wsrep_query_state (*wsrep_thd_query_state_func)(THD *thd); - const char * (*wsrep_thd_query_state_str_func)(THD *thd); - int (*wsrep_thd_retry_counter_func)(THD *thd); - void (*wsrep_thd_set_conflict_state_func)(THD *thd, enum wsrep_conflict_state state); - bool (*wsrep_thd_ignore_table_func)(THD *thd); - long long (*wsrep_thd_trx_seqno_func)(THD *thd); - struct wsrep_ws_handle * (*wsrep_thd_ws_handle_func)(THD *thd); - int (*wsrep_trx_is_aborting_func)(MYSQL_THD thd); - int (*wsrep_trx_order_before_func)(MYSQL_THD, MYSQL_THD); - void (*wsrep_unlock_rollback_func)(); + my_bool (*wsrep_on_func)(const MYSQL_THD thd); + bool (*wsrep_prepare_key_for_innodb_func)(MYSQL_THD thd, const unsigned char*, size_t, const unsigned char*, size_t, struct wsrep_buf*, size_t*); + void (*wsrep_thd_LOCK_func)(const MYSQL_THD thd); + void (*wsrep_thd_UNLOCK_func)(const MYSQL_THD thd); + const char * (*wsrep_thd_query_func)(const MYSQL_THD thd); + int (*wsrep_thd_retry_counter_func)(const MYSQL_THD thd); + bool (*wsrep_thd_ignore_table_func)(MYSQL_THD thd); + long long (*wsrep_thd_trx_seqno_func)(const MYSQL_THD thd); + my_bool (*wsrep_thd_is_aborting_func)(const MYSQL_THD thd); + void (*wsrep_set_data_home_dir_func)(const char *data_dir); + my_bool (*wsrep_thd_is_BF_func)(const MYSQL_THD thd, my_bool sync); + my_bool (*wsrep_thd_is_local_func)(const MYSQL_THD thd); + void (*wsrep_thd_self_abort_func)(MYSQL_THD thd); + int (*wsrep_thd_append_key_func)(MYSQL_THD thd, const struct wsrep_key* key, + int n_keys, enum Wsrep_service_key_type); + const char* (*wsrep_thd_client_state_str_func)(const MYSQL_THD thd); + const char* (*wsrep_thd_client_mode_str_func)(const MYSQL_THD thd); + const char* (*wsrep_thd_transaction_state_str_func)(const MYSQL_THD thd); + query_id_t (*wsrep_thd_transaction_id_func)(const MYSQL_THD thd); + my_bool (*wsrep_thd_bf_abort_func)(const MYSQL_THD bf_thd, + MYSQL_THD victim_thd, + my_bool signal); + my_bool (*wsrep_thd_order_before_func)(const MYSQL_THD left, const MYSQL_THD right); + void (*wsrep_handle_SR_rollback_func)(MYSQL_THD BF_thd, MYSQL_THD victim_thd); + my_bool (*wsrep_thd_skip_locking_func)(const MYSQL_THD thd); + const char* (*wsrep_get_sr_table_name_func)(); + my_bool (*wsrep_get_debug_func)(); } *wsrep_service; +#define MYSQL_SERVICE_WSREP_INCLUDED +#endif + #ifdef MYSQL_DYNAMIC_PLUGIN -#define get_wsrep() wsrep_service->get_wsrep_func() -#define get_wsrep_certify_nonPK() wsrep_service->get_wsrep_certify_nonPK_func() -#define get_wsrep_debug() wsrep_service->get_wsrep_debug_func() -#define get_wsrep_drupal_282555_workaround() wsrep_service->get_wsrep_drupal_282555_workaround_func() + +#define MYSQL_SERVICE_WSREP_DYNAMIC_INCLUDED #define get_wsrep_recovery() wsrep_service->get_wsrep_recovery_func() -#define get_wsrep_load_data_splitting() wsrep_service->get_wsrep_load_data_splitting_func() -#define get_wsrep_log_conflicts() wsrep_service->get_wsrep_log_conflicts_func() -#define get_wsrep_protocol_version() wsrep_service->get_wsrep_protocol_version_func() -#define wsrep_aborting_thd_contains(T) wsrep_service->wsrep_aborting_thd_contains_func(T) -#define wsrep_aborting_thd_enqueue(T) wsrep_service->wsrep_aborting_thd_enqueue_func(T) #define wsrep_consistency_check(T) wsrep_service->wsrep_consistency_check_func(T) #define wsrep_is_wsrep_xid(X) wsrep_service->wsrep_is_wsrep_xid_func(X) #define wsrep_xid_seqno(X) wsrep_service->wsrep_xid_seqno_func(X) #define wsrep_xid_uuid(X) wsrep_service->wsrep_xid_uuid_func(X) -#define wsrep_lock_rollback() wsrep_service->wsrep_lock_rollback_func() #define wsrep_on(X) wsrep_service->wsrep_on_func(X) -#define wsrep_post_commit(T,A) wsrep_service->wsrep_post_commit_func(T,A) -#define wsrep_prepare_key(A,B,C,D,E,F) wsrep_service->wsrep_prepare_key_func(A,B,C,D,E,F) -#define wsrep_run_wsrep_commit(T,A) wsrep_service->wsrep_run_wsrep_commit_func(T,A) +#define wsrep_prepare_key_for_innodb(A,B,C,D,E,F,G) wsrep_service->wsrep_prepare_key_for_innodb_func(A,B,C,D,E,F,G) #define wsrep_thd_LOCK(T) wsrep_service->wsrep_thd_LOCK_func(T) #define wsrep_thd_UNLOCK(T) wsrep_service->wsrep_thd_UNLOCK_func(T) -#define wsrep_thd_awake(T,S) wsrep_service->wsrep_thd_awake_func(T,S) -#define wsrep_thd_conflict_state(T,S) wsrep_service->wsrep_thd_conflict_state_func(T,S) -#define wsrep_thd_conflict_state_str(T) wsrep_service->wsrep_thd_conflict_state_str_func(T) -#define wsrep_thd_exec_mode(T) wsrep_service->wsrep_thd_exec_mode_func(T) -#define wsrep_thd_exec_mode_str(T) wsrep_service->wsrep_thd_exec_mode_str_func(T) -#define wsrep_thd_get_conflict_state(T) wsrep_service->wsrep_thd_get_conflict_state_func(T) -#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S) -#define wsrep_thd_is_wsrep(T) wsrep_service->wsrep_thd_is_wsrep_func(T) #define wsrep_thd_query(T) wsrep_service->wsrep_thd_query_func(T) -#define wsrep_thd_query_state(T) wsrep_service->wsrep_thd_query_state_func(T) -#define wsrep_thd_query_state_str(T) wsrep_service->wsrep_thd_query_state_str_func(T) #define wsrep_thd_retry_counter(T) wsrep_service->wsrep_thd_retry_counter_func(T) -#define wsrep_thd_set_conflict_state(T,S) wsrep_service->wsrep_thd_set_conflict_state_func(T,S) #define wsrep_thd_ignore_table(T) wsrep_service->wsrep_thd_ignore_table_func(T) #define wsrep_thd_trx_seqno(T) wsrep_service->wsrep_thd_trx_seqno_func(T) -#define wsrep_thd_ws_handle(T) wsrep_service->wsrep_thd_ws_handle_func(T) -#define wsrep_trx_is_aborting(T) wsrep_service->wsrep_trx_is_aborting_func(T) -#define wsrep_trx_order_before(T1,T2) wsrep_service->wsrep_trx_order_before_func(T1,T2) -#define wsrep_unlock_rollback() wsrep_service->wsrep_unlock_rollback_func() - -#define wsrep_debug get_wsrep_debug() -#define wsrep_log_conflicts get_wsrep_log_conflicts() -#define wsrep_certify_nonPK get_wsrep_certify_nonPK() -#define wsrep_load_data_splitting get_wsrep_load_data_splitting() -#define wsrep_drupal_282555_workaround get_wsrep_drupal_282555_workaround() -#define wsrep_recovery get_wsrep_recovery() -#define wsrep_protocol_version get_wsrep_protocol_version() +#define wsrep_set_data_home_dir(A) wsrep_service->wsrep_set_data_home_dir_func(A) +#define wsrep_thd_is_BF(T,S) wsrep_service->wsrep_thd_is_BF_func(T,S) +#define wsrep_thd_is_aborting(T) wsrep_service->wsrep_thd_is_aborting_func(T) +#define wsrep_thd_is_local(T) wsrep_service->wsrep_thd_is_local_func(T) +#define wsrep_thd_self_abort(T) wsrep_service->wsrep_thd_self_abort_func(T) +#define wsrep_thd_append_key(T,W,N,K) wsrep_service->wsrep_thd_append_key_func(T,W,N,K) +#define wsrep_thd_client_state_str(T) wsrep_service->wsrep_thd_client_state_str_func(T) +#define wsrep_thd_client_mode_str(T) wsrep_service->wsrep_thd_client_mode_str_func(T) +#define wsrep_thd_transaction_state_str(T) wsrep_service->wsrep_thd_transaction_state_str_func(T) +#define wsrep_thd_transaction_id(T) wsrep_service->wsrep_thd_transaction_id_func(T) +#define wsrep_thd_bf_abort(T,T2,S) wsrep_service->wsrep_thd_bf_abort_func(T,T2,S) +#define wsrep_thd_order_before(L,R) wsrep_service->wsrep_thd_order_before_func(L,R) +#define wsrep_handle_SR_rollback(B,V) wsrep_service->wsrep_handle_SR_rollback_func(B,V) +#define wsrep_thd_skip_locking(T) wsrep_service->wsrep_thd_skip_locking_func(T) +#define wsrep_get_sr_table_name() wsrep_service->wsrep_get_sr_table_name_func() +#define wsrep_get_debug() wsrep_service->wsrep_get_debug_func() #else +#define MYSQL_SERVICE_WSREP_STATIC_INCLUDED extern my_bool wsrep_debug; extern my_bool wsrep_log_conflicts; extern my_bool wsrep_certify_nonPK; @@ -174,53 +130,81 @@ extern my_bool wsrep_drupal_282555_workaround; extern my_bool wsrep_recovery; extern long wsrep_protocol_version; -bool wsrep_consistency_check(THD *thd); -bool wsrep_prepare_key(const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len); -char *wsrep_thd_query(THD *thd); -const char *wsrep_thd_conflict_state_str(THD *thd); -const char *wsrep_thd_exec_mode_str(THD *thd); -const char *wsrep_thd_query_state_str(THD *thd); -enum wsrep_conflict_state wsrep_thd_conflict_state(MYSQL_THD thd, my_bool sync); -enum wsrep_conflict_state wsrep_thd_get_conflict_state(MYSQL_THD thd); -enum wsrep_exec_mode wsrep_thd_exec_mode(THD *thd); -enum wsrep_query_state wsrep_thd_query_state(THD *thd); -enum wsrep_trx_status wsrep_run_wsrep_commit(THD *thd, bool all); -int wsrep_is_wsrep_xid(const struct xid_t* xid); -long long wsrep_xid_seqno(const struct xid_t* xid); +extern "C" bool wsrep_consistency_check(MYSQL_THD thd); +bool wsrep_prepare_key_for_innodb(MYSQL_THD thd, const unsigned char* cache_key, size_t cache_key_len, const unsigned char* row_id, size_t row_id_len, struct wsrep_buf* key, size_t* key_len); +extern "C" const char *wsrep_thd_query(const MYSQL_THD thd); +extern "C" int wsrep_is_wsrep_xid(const void* xid); +extern "C" long long wsrep_xid_seqno(const struct xid_t* xid); const unsigned char* wsrep_xid_uuid(const struct xid_t* xid); -int wsrep_on(MYSQL_THD thd); -int wsrep_thd_retry_counter(THD *thd); -int wsrep_trx_is_aborting(MYSQL_THD thd); -int wsrep_trx_order_before(MYSQL_THD thd1, MYSQL_THD thd2); -long get_wsrep_protocol_version(); -long long wsrep_thd_trx_seqno(THD *thd); -my_bool get_wsrep_certify_nonPK(); -my_bool get_wsrep_debug(); -my_bool get_wsrep_drupal_282555_workaround(); +extern "C" long long wsrep_thd_trx_seqno(const MYSQL_THD thd); my_bool get_wsrep_recovery(); -my_bool get_wsrep_load_data_splitting(); -my_bool get_wsrep_log_conflicts(); -my_bool wsrep_aborting_thd_contains(THD *thd); -my_bool wsrep_thd_is_BF(MYSQL_THD thd, my_bool sync); -my_bool wsrep_thd_is_wsrep(MYSQL_THD thd); -struct wsrep *get_wsrep(); -struct wsrep_ws_handle *wsrep_thd_ws_handle(THD *thd); -void wsrep_aborting_thd_enqueue(THD *thd); -void wsrep_lock_rollback(); -void wsrep_post_commit(THD* thd, bool all); -void wsrep_thd_LOCK(THD *thd); -void wsrep_thd_UNLOCK(THD *thd); -void wsrep_thd_awake(THD *thd, my_bool signal); -void wsrep_thd_set_conflict_state(THD *thd, enum wsrep_conflict_state state); -bool wsrep_thd_ignore_table(THD *thd); -void wsrep_unlock_rollback(); +bool wsrep_thd_ignore_table(MYSQL_THD thd); +void wsrep_set_data_home_dir(const char *data_dir); +/* from mysql wsrep-lib */ +#include "my_global.h" +#include "my_pthread.h" + +/* Return true if wsrep is enabled for a thd. This means that + wsrep is enabled globally and the thd has wsrep on */ +extern "C" my_bool wsrep_on(const MYSQL_THD thd); +/* Lock thd wsrep lock */ +extern "C" void wsrep_thd_LOCK(const MYSQL_THD thd); +/* Unlock thd wsrep lock */ +extern "C" void wsrep_thd_UNLOCK(const MYSQL_THD thd); + +/* Return thd client state string */ +extern "C" const char* wsrep_thd_client_state_str(const MYSQL_THD thd); +/* Return thd client mode string */ +extern "C" const char* wsrep_thd_client_mode_str(const MYSQL_THD thd); +/* Return thd transaction state string */ +extern "C" const char* wsrep_thd_transaction_state_str(const MYSQL_THD thd); + +/* Return current transaction id */ +extern "C" query_id_t wsrep_thd_transaction_id(const MYSQL_THD thd); +/* Mark thd own transaction as aborted */ +extern "C" void wsrep_thd_self_abort(MYSQL_THD thd); +/* Return true if thd is in replicating mode */ +extern "C" my_bool wsrep_thd_is_local(const MYSQL_THD thd); +/* Return true if thd is in high priority mode */ +/* todo: rename to is_high_priority() */ +extern "C" my_bool wsrep_thd_is_applying(const MYSQL_THD thd); +/* Return true if thd is in TOI mode */ +extern "C" my_bool wsrep_thd_is_toi(const MYSQL_THD thd); +/* Return true if thd is in replicating TOI mode */ +extern "C" my_bool wsrep_thd_is_local_toi(const MYSQL_THD thd); +/* Return true if thd is in RSU mode */ +extern "C" my_bool wsrep_thd_is_in_rsu(const MYSQL_THD thd); +/* Return true if thd is in BF mode, either high_priority or TOI */ +extern "C" my_bool wsrep_thd_is_BF(const MYSQL_THD thd, my_bool sync); +/* Return true if thd is streaming */ +extern "C" my_bool wsrep_thd_is_SR(const MYSQL_THD thd); +extern "C" void wsrep_handle_SR_rollback(MYSQL_THD BF_thd, MYSQL_THD victim_thd); +/* Return thd retry counter */ +extern "C" int wsrep_thd_retry_counter(const MYSQL_THD thd); +/* BF abort victim_thd */ +extern "C" my_bool wsrep_thd_bf_abort(const MYSQL_THD bf_thd, + MYSQL_THD victim_thd, + my_bool signal); +/* Return true if left thd is ordered before right thd */ +extern "C" my_bool wsrep_thd_order_before(const MYSQL_THD left, const MYSQL_THD right); +/* Return true if thd should skip locking. This means that the thd + is operating on shared resource inside commit order critical section. */ +extern "C" my_bool wsrep_thd_skip_locking(const MYSQL_THD thd); +/* Return true if thd is aborting */ +extern "C" my_bool wsrep_thd_is_aborting(const MYSQL_THD thd); + +struct wsrep_key; +struct wsrep_key_array; +extern "C" int wsrep_thd_append_key(MYSQL_THD thd, + const struct wsrep_key* key, + int n_keys, + enum Wsrep_service_key_type); + +extern const char* wsrep_sr_table_name_full; + +extern "C" const char* wsrep_get_sr_table_name(); + +extern "C" my_bool wsrep_get_debug(); #endif - -#ifdef __cplusplus -} -#endif - -#define MYSQL_SERVICE_WSREP_INCLUDED -#endif - +#endif /* MYSQL_SERVICE_WSREP_INCLUDED */ diff --git a/include/mysql/services.h b/include/mysql/services.h index 6168c5ed8dc..6dc970df1e6 100644 --- a/include/mysql/services.h +++ b/include/mysql/services.h @@ -39,6 +39,7 @@ extern "C" { #include #include #include +#include /*#include */ #ifdef __cplusplus diff --git a/include/mysql_com.h b/include/mysql_com.h index 902c0ff2706..8b0847ab399 100644 --- a/include/mysql_com.h +++ b/include/mysql_com.h @@ -231,6 +231,7 @@ enum enum_indicator_type #define REFRESH_DES_KEY_FILE (1ULL << 18) #define REFRESH_USER_RESOURCES (1ULL << 19) #define REFRESH_FOR_EXPORT (1ULL << 20) /* FLUSH TABLES ... FOR EXPORT */ +#define REFRESH_SSL (1ULL << 21) #define REFRESH_GENERIC (1ULL << 30) #define REFRESH_FAST (1ULL << 31) /* Intern flag */ diff --git a/include/service_versions.h b/include/service_versions.h index 582b3912355..050012d30b9 100644 --- a/include/service_versions.h +++ b/include/service_versions.h @@ -41,4 +41,5 @@ #define VERSION_thd_specifics 0x0100 #define VERSION_thd_timezone 0x0100 #define VERSION_thd_wait 0x0100 -#define VERSION_wsrep 0x0201 +#define VERSION_wsrep 0x0202 +#define VERSION_json 0x0100 diff --git a/include/thr_lock.h b/include/thr_lock.h index e6451bf21c4..ee15fd7315d 100644 --- a/include/thr_lock.h +++ b/include/thr_lock.h @@ -168,9 +168,9 @@ void thr_set_lock_wait_callback(void (*before_wait)(void), void (*after_wait)(void)); #ifdef WITH_WSREP - typedef my_bool (* wsrep_thd_is_brute_force_fun)(void *, my_bool); - typedef int (* wsrep_abort_thd_fun)(void *, void *, my_bool); - typedef int (* wsrep_on_fun)(void *); + typedef my_bool (* wsrep_thd_is_brute_force_fun)(const MYSQL_THD, my_bool); + typedef my_bool(* wsrep_abort_thd_fun)(const MYSQL_THD, MYSQL_THD, my_bool); + typedef my_bool (* wsrep_on_fun)(const MYSQL_THD); void wsrep_thr_lock_init( wsrep_thd_is_brute_force_fun bf_fun, wsrep_abort_thd_fun abort_fun, my_bool debug, my_bool convert_LOCK_to_trx, wsrep_on_fun on_fun); diff --git a/include/thread_pool_priv.h b/include/thread_pool_priv.h index f5fdbfbdf47..cd53306e851 100644 --- a/include/thread_pool_priv.h +++ b/include/thread_pool_priv.h @@ -61,9 +61,6 @@ void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var); my_socket thd_get_fd(THD *thd); int thd_store_globals(THD* thd); -THD *first_global_thread(); -THD *next_global_thread(THD *thd); - /* Print to the MySQL error log */ void sql_print_error(const char *format, ...); diff --git a/include/violite.h b/include/violite.h index 4d75d7435b9..74b53f41fdd 100644 --- a/include/violite.h +++ b/include/violite.h @@ -68,13 +68,6 @@ Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags); Vio* mysql_socket_vio_new(MYSQL_SOCKET mysql_socket, enum enum_vio_type type, uint flags); #ifdef __WIN__ Vio* vio_new_win32pipe(HANDLE hPipe); -Vio* vio_new_win32shared_memory(HANDLE handle_file_map, - HANDLE handle_map, - HANDLE event_server_wrote, - HANDLE event_server_read, - HANDLE event_client_wrote, - HANDLE event_client_read, - HANDLE event_conn_closed); #else #define HANDLE void * #endif /* __WIN__ */ @@ -268,8 +261,6 @@ struct st_vio #ifdef _WIN32 HANDLE hPipe; OVERLAPPED overlapped; - DWORD read_timeout_ms; - DWORD write_timeout_ms; #endif }; #endif /* vio_violite_h_ */ diff --git a/include/wsrep.h b/include/wsrep.h index 0c06bb32b31..df8a88e1c69 100644 --- a/include/wsrep.h +++ b/include/wsrep.h @@ -13,11 +13,11 @@ along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ -#include - #ifndef WSREP_INCLUDED #define WSREP_INCLUDED +#include + #ifdef WITH_WSREP #define IF_WSREP(A,B) A #define DBUG_ASSERT_IF_WSREP(A) DBUG_ASSERT(A) @@ -25,10 +25,17 @@ #define WSREP_MYSQL_DB (char *)"mysql" #define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) \ if (WSREP_ON && WSREP(thd) && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) \ - goto error; + goto wsrep_error_label; -#define WSREP_TO_ISOLATION_END \ - if (WSREP_ON && (WSREP(thd) || (thd && thd->wsrep_exec_mode==TOTAL_ORDER))) \ +#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) \ + if (WSREP(thd) && wsrep_thd_is_local(thd) && \ + wsrep_to_isolation_begin(thd, db_, table_, \ + table_list_, alter_info_)) \ + goto wsrep_error_label; + +#define WSREP_TO_ISOLATION_END \ + if ((WSREP(thd) && wsrep_thd_is_local_toi(thd)) || \ + wsrep_thd_is_in_rsu(thd)) \ wsrep_to_isolation_end(thd); /* @@ -37,7 +44,7 @@ */ #define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) \ if (WSREP(thd) && !thd->lex->no_write_to_binlog \ - && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto error; + && wsrep_to_isolation_begin(thd, db_, table_, table_list_)) goto wsrep_error_label; #define WSREP_DEBUG(...) \ if (wsrep_debug) WSREP_LOG(sql_print_information, ##__VA_ARGS__) @@ -45,22 +52,26 @@ #define WSREP_WARN(...) WSREP_LOG(sql_print_warning, ##__VA_ARGS__) #define WSREP_ERROR(...) WSREP_LOG(sql_print_error, ##__VA_ARGS__) -#define WSREP_SYNC_WAIT(thd_, before_) \ - { if (WSREP_CLIENT(thd_) && \ - wsrep_sync_wait(thd_, before_)) goto error; } +#define WSREP_SYNC_WAIT(thd_, before_) \ + { if (WSREP_CLIENT(thd_) && \ + wsrep_sync_wait(thd_, before_)) goto wsrep_error_label; } + +#else /* !WITH_WSREP */ + +/* These macros are needed to compile MariaDB without WSREP support + * (e.g. embedded) */ -#else #define IF_WSREP(A,B) B -#define DBUG_ASSERT_IF_WSREP(A) +//#define DBUG_ASSERT_IF_WSREP(A) #define WSREP_DEBUG(...) -#define WSREP_INFO(...) -#define WSREP_WARN(...) +//#define WSREP_INFO(...) +//#define WSREP_WARN(...) #define WSREP_ERROR(...) -#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) +#define WSREP_TO_ISOLATION_BEGIN(db_, table_, table_list_) do { } while(0) +#define WSREP_TO_ISOLATION_BEGIN_ALTER(db_, table_, table_list_, alter_info_) #define WSREP_TO_ISOLATION_END #define WSREP_TO_ISOLATION_BEGIN_WRTCHK(db_, table_, table_list_) #define WSREP_SYNC_WAIT(thd_, before_) - #endif /* WITH_WSREP */ #endif /* WSREP_INCLUDED */ diff --git a/libmariadb b/libmariadb index 17d0e531760..beb9d5ea899 160000 --- a/libmariadb +++ b/libmariadb @@ -1 +1 @@ -Subproject commit 17d0e5317604718fc059ee1ad4bd2ea36494226b +Subproject commit beb9d5ea8994bb90361c4b9f3d926eee24055178 diff --git a/libmysqld/CMakeLists.txt b/libmysqld/CMakeLists.txt index 5936c4e43e3..782d28afb70 100644 --- a/libmysqld/CMakeLists.txt +++ b/libmysqld/CMakeLists.txt @@ -1,4 +1,5 @@ # Copyright (c) 2006, 2011, Oracle and/or its affiliates. +# Copyright (c) 2009, 2018, 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 @@ -118,7 +119,7 @@ SET(SQL_EMBEDDED_SOURCES emb_qcache.cc libmysqld.c lib_sql.cc ../sql/ha_sequence.cc ../sql/ha_sequence.h ../sql/temporary_tables.cc ../sql/session_tracker.cc - ../sql/proxy_protocol.cc + ../sql/proxy_protocol.cc ../sql/backup.cc ../sql/sql_tvc.cc ../sql/sql_tvc.h ../sql/opt_split.cc ../sql/item_vers.cc @@ -453,4 +454,3 @@ IF(NOT DISABLE_SHARED) ENDIF() ENDIF() ENDIF() - diff --git a/libmysqld/examples/CMakeLists.txt b/libmysqld/examples/CMakeLists.txt index d47638ad2f9..1eb07a2adf8 100644 --- a/libmysqld/examples/CMakeLists.txt +++ b/libmysqld/examples/CMakeLists.txt @@ -34,7 +34,7 @@ ENDIF(UNIX) MYSQL_ADD_EXECUTABLE(mysqltest_embedded ../../client/mysqltest.cc COMPONENT Test) -TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcre pcreposix) +TARGET_LINK_LIBRARIES(mysqltest_embedded mysqlserver pcreposix pcre) IF(CMAKE_GENERATOR MATCHES "Xcode") # It does not seem possible to tell Xcode the resulting target might need diff --git a/libmysqld/lib_sql.cc b/libmysqld/lib_sql.cc index 715f1dde5b5..305f6346c9e 100644 --- a/libmysqld/lib_sql.cc +++ b/libmysqld/lib_sql.cc @@ -432,11 +432,9 @@ int emb_unbuffered_fetch(MYSQL *mysql, char **row) static void emb_free_embedded_thd(MYSQL *mysql) { THD *thd= (THD*)mysql->thd; - mysql_mutex_lock(&LOCK_thread_count); + server_threads.erase(thd); thd->clear_data_list(); thd->store_globals(); - thd->unlink(); - mysql_mutex_unlock(&LOCK_thread_count); delete thd; my_pthread_setspecific_ptr(THR_THD, 0); mysql->thd=0; @@ -711,10 +709,7 @@ void *create_embedded_thd(int client_flag) thd->first_data= 0; thd->data_tail= &thd->first_data; bzero((char*) &thd->net, sizeof(thd->net)); - - mysql_mutex_lock(&LOCK_thread_count); - threads.append(thd); - mysql_mutex_unlock(&LOCK_thread_count); + server_threads.insert(thd); thd->mysys_var= 0; thd->reset_globals(); return thd; diff --git a/libmysqld/libmysql.c b/libmysqld/libmysql.c index b3ef96698ff..cd170b42b42 100644 --- a/libmysqld/libmysql.c +++ b/libmysqld/libmysql.c @@ -3215,7 +3215,8 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t { MYSQL_TIME *tm= (MYSQL_TIME *)buffer; MYSQL_TIME_STATUS status; - str_to_time(value, length, tm, 0, &status); + str_to_datetime_or_date_or_time(value, length, tm, 0, &status, + TIME_MAX_HOUR, UINT_MAX32); err= status.warnings; *param->error= MY_TEST(err); break; @@ -3226,7 +3227,7 @@ static void fetch_string_with_conversion(MYSQL_BIND *param, char *value, size_t { MYSQL_TIME *tm= (MYSQL_TIME *)buffer; MYSQL_TIME_STATUS status; - (void) str_to_datetime(value, length, tm, 0, &status); + (void) str_to_datetime_or_date(value, length, tm, 0, &status); err= status.warnings; *param->error= MY_TEST(err) && (param->buffer_type == MYSQL_TYPE_DATE && tm->time_type != MYSQL_TIMESTAMP_DATE); @@ -3350,7 +3351,7 @@ static void fetch_long_with_conversion(MYSQL_BIND *param, MYSQL_FIELD *field, case MYSQL_TYPE_DATETIME: { int error; - value= number_to_datetime(value, 0, (MYSQL_TIME *) buffer, 0, &error); + value= number_to_datetime_or_date(value, 0, (MYSQL_TIME *) buffer, 0, &error); *param->error= MY_TEST(error); break; } diff --git a/libservices/CMakeLists.txt b/libservices/CMakeLists.txt index e20be6d7a7c..b99be7106e1 100644 --- a/libservices/CMakeLists.txt +++ b/libservices/CMakeLists.txt @@ -37,6 +37,7 @@ SET(MYSQLSERVICES_SOURCES thd_timezone_service.c thd_wait_service.c wsrep_service.c + json_service.c ) ADD_CONVENIENCE_LIBRARY(mysqlservices ${MYSQLSERVICES_SOURCES}) diff --git a/libservices/json_service.c b/libservices/json_service.c new file mode 100644 index 00000000000..96b3b3fa532 --- /dev/null +++ b/libservices/json_service.c @@ -0,0 +1,19 @@ + +/* Copyright (c) 2018, Monty Program Ab + + 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-1301 USA +*/ + +#include +SERVICE_VERSION json_service= (void*)VERSION_json; diff --git a/man/CMakeLists.txt b/man/CMakeLists.txt index 9c34ede59c7..1ac4931fdf1 100644 --- a/man/CMakeLists.txt +++ b/man/CMakeLists.txt @@ -25,7 +25,6 @@ SET(MAN1_SERVER innochecksum.1 my_print_defaults.1 myisam_ftdump.1 myisamchk.1 resolveip.1 mariadb-service-convert.1 mysqld_safe_helper.1 tokuftdump.1 wsrep_sst_common.1 wsrep_sst_mysqldump.1 wsrep_sst_rsync.1 - wsrep_sst_xtrabackup-v2.1 wsrep_sst_xtrabackup.1 galera_recovery.1 galera_new_cluster.1 tokuft_logprint.1 mysql_ldb.1 wsrep_sst_mariabackup.1 mbstream.1 mariabackup.1 diff --git a/man/my_print_defaults.1 b/man/my_print_defaults.1 index b01d24b2e86..507250f8ca8 100644 --- a/man/my_print_defaults.1 +++ b/man/my_print_defaults.1 @@ -74,14 +74,14 @@ Display a help message and exit\&. .\} .\" my_print_defaults: config-file option .\" config-file option: my_print_defaults -\fB\-\-config\-file=\fR\fB\fIfile_name\fR\fR, +\fB .\" my_print_defaults: defaults-file option .\" defaults-file option: my_print_defaults \fB\-\-defaults\-file=\fR\fB\fIfile_name\fR\fR, \fB\-c \fR\fB\fIfile_name\fR\fR .sp Read only the given option file\&. If no extension is given, default extension(.ini or .cnf) will -be used\&. \fB\-\-config-file\fR is deprecated, use \fB\-\-defaults\-file\fR instead\&. If \fB\-\-defaults\-file\fR is +be used\&. If \fB\-\-defaults\-file\fR is the first option, then read this file only, do not read global or per\-user config files; should be the first option. .RE .sp @@ -118,11 +118,10 @@ string is \fB\-\-defaults\-extra\-file=\fR\fB\fIfile_name\fR\fR, .\" my_print_defaults: extra-file option .\" extra-file option: my_print_defaults -\fB\-\-extra\-file=\fR\fB\fIfile_name\fR\fR, \fB\-e \fR\fB\fIfile_name\fR\fR .sp Read this option file after the global option file but (on Unix) before the user option -file\&. Should be the first option\&. \fB\-\-extra\-file\fR is deprecated, use \fB\-\-defaults\-extra\-file\fR\&. +file\&. Should be the first option\&. .RE .sp .RS 4 diff --git a/man/wsrep_sst_xtrabackup-v2.1 b/man/wsrep_sst_xtrabackup-v2.1 deleted file mode 100644 index 3f95e3eef0d..00000000000 --- a/man/wsrep_sst_xtrabackup-v2.1 +++ /dev/null @@ -1,16 +0,0 @@ -'\" t -.\" -.TH "\FBWSREP_SST_XTRABACKUP-V2\FR" "1" "9 May 2017" "MariaDB 10\&.3" "MariaDB Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH NAME -wsrep_sst_xtrabackup-v2 \- xtrabackup\-based state snapshot transfer -.SH DESCRIPTION -Use: xtrabackup-based state snapshot transfer\. -.PP -For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/ diff --git a/man/wsrep_sst_xtrabackup.1 b/man/wsrep_sst_xtrabackup.1 deleted file mode 100644 index c171a7cf954..00000000000 --- a/man/wsrep_sst_xtrabackup.1 +++ /dev/null @@ -1,16 +0,0 @@ -'\" t -.\" -.TH "\FBWSREP_SST_XTRABACKUP\FR" "1" "9 May 2017" "MariaDB 10\&.3" "MariaDB Database System" -.\" ----------------------------------------------------------------- -.\" * set default formatting -.\" ----------------------------------------------------------------- -.\" disable hyphenation -.nh -.\" disable justification (adjust text to left margin only) -.ad l -.SH NAME -wsrep_sst_xtrabackup \- xtrabackup\-based state snapshot transfer -.SH DESCRIPTION -Use: xtrabackup-based state snapshot transfer\. -.PP -For more information, please refer to the MariaDB Knowledge Base, available online at https://mariadb.com/kb/ diff --git a/mysql-test/collections/10.0-compatible.list b/mysql-test/collections/10.0-compatible.list index 415c74ab00c..4778bde3b78 100644 --- a/mysql-test/collections/10.0-compatible.list +++ b/mysql-test/collections/10.0-compatible.list @@ -1,3 +1,5 @@ +# All lines which have a hash sign *anywhere* will be ignored + main.1st main.adddate_454 main.almost_full @@ -500,7 +502,8 @@ main.subselect-crash_15755 main.subselect_exists2in main.subselect_exists2in_costmat main.subselect_extra -main.subselect_extra_no_semijoin +# Disabled due to connect log output +# main.subselect_extra_no_semijoin main.subselect_gis main.subselect_innodb main.subselect_mat @@ -579,7 +582,8 @@ main.win_empty_over main.win_first_last_value main.win_insert_select main.win_i_s -main.win_lead_lag +# Disabled due to unknown SQL error name +# main.win_lead_lag main.win_min_max main.win_nth_value main.win_orderby diff --git a/mysql-test/dgcov.pl b/mysql-test/dgcov.pl index 27647eed056..05829c61bc8 100755 --- a/mysql-test/dgcov.pl +++ b/mysql-test/dgcov.pl @@ -14,7 +14,7 @@ # # 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA # Run gcov and report test coverage on only those code lines touched by # a given list of commits. diff --git a/mysql-test/include/add_anonymous_users.inc b/mysql-test/include/add_anonymous_users.inc index 635a80e3dee..86ce529d1e2 100644 --- a/mysql-test/include/add_anonymous_users.inc +++ b/mysql-test/include/add_anonymous_users.inc @@ -1,7 +1,7 @@ # Allow anonymous users to connect disable_warnings; disable_query_log; -INSERT IGNORE INTO mysql.user (host, user) VALUES ('localhost',''); +INSERT IGNORE INTO mysql.global_priv (host, user) VALUES ('localhost',''); FLUSH PRIVILEGES; enable_query_log; enable_warnings; diff --git a/mysql-test/include/check-testcase.test b/mysql-test/include/check-testcase.test index a9c8e13fa7c..39aa3d49d68 100644 --- a/mysql-test/include/check-testcase.test +++ b/mysql-test/include/check-testcase.test @@ -103,5 +103,56 @@ cat_file $datadir.tempfiles.txt; remove_file $datadir.tempfiles.txt; list_files $datadir/mysql #sql*; +# +# Check that SHOW ENGINE INNODB STATUS does not show any active transactions +# We do this only if wsrep provider is loaded, to avoid disturbing any non-Galera MTR tests +# +if (`SELECT COUNT(*)=1 FROM INFORMATION_SCHEMA.PLUGINS WHERE PLUGIN_NAME = 'wsrep' AND PLUGIN_STATUS='ACTIVE'`) { + if (`SELECT @@wsrep_on`) { + if (`SELECT COUNT(*) FROM information_schema.innodb_trx WHERE trx_mysql_thread_id != 0`) { + if ($before) { + --echo Before test start. + } + if (!$before) { + --echo After test end. + } + --echo There is one or more active InnoDB transaction(s) when there should be none. Dumping some diagnostics. + + --let $status_locks = `SELECT @@innodb_status_output_locks` + --let $status_output = `SELECT @@innodb_status_output` + --enable_query_log + SET GLOBAL innodb_status_output_locks=ON; + SHOW ENGINE INNODB STATUS; + --disable_query_log + --eval SET GLOBAL innodb_status_output_locks=$status_locks; + --eval SET GLOBAL innodb_status_output=$status_output; + --enable_query_log + + --vertical_results + if ($before) { + --replace_regex /$/ / + } + SELECT * FROM information_schema.processlist; + + if ($before) { + --replace_regex /$/ / + } + SELECT * FROM information_schema.innodb_trx; + + if ($before) { + --replace_regex /$/ / + } + SELECT * FROM information_schema.innodb_locks; + + if ($before) { + --replace_regex /$/ / + } + SELECT * FROM information_schema.innodb_lock_waits; + --horizontal_results + --disable_query_log + } + } +} + --enable_query_log diff --git a/mysql-test/include/check_ftwrl_incompatible.inc b/mysql-test/include/check_ftwrl_incompatible.inc index 4787a69ea9c..a7e87c3750b 100644 --- a/mysql-test/include/check_ftwrl_incompatible.inc +++ b/mysql-test/include/check_ftwrl_incompatible.inc @@ -68,8 +68,7 @@ connection $con_aux1; --enable_query_log let $wait_condition= select count(*) = 1 from information_schema.processlist - where (state = "Waiting for global read lock" or - state = "Waiting for commit lock") and + where state = "Waiting for backup lock" and info = "$statement"; --source include/wait_condition.inc --disable_result_log @@ -116,8 +115,7 @@ connection $con_aux2; --enable_query_log let $wait_condition= select count(*) = 1 from information_schema.processlist - where (state = "Waiting for global read lock" or - state = "Waiting for commit lock") and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc --disable_result_log diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf index 69a2b58288b..edae06ee7be 100644 --- a/mysql-test/include/default_mysqld.cnf +++ b/mysql-test/include/default_mysqld.cnf @@ -107,6 +107,7 @@ loose-performance-schema-consumer-thread-instrumentation=ON binlog-direct-non-transactional-updates default-storage-engine=myisam +use_stat_tables=preferably loose-ssl-ca=@ENV.MYSQL_TEST_DIR/std_data/cacert.pem loose-ssl-cert=@ENV.MYSQL_TEST_DIR/std_data/server-cert.pem diff --git a/mysql-test/include/diff_tables.inc b/mysql-test/include/diff_tables.inc index b5ee4db0e8f..a29156cfce9 100644 --- a/mysql-test/include/diff_tables.inc +++ b/mysql-test/include/diff_tables.inc @@ -167,7 +167,7 @@ while ($_dt_tables) # the table to a file. --let $_dt_outfile= `SELECT @@datadir` --let $_dt_outfile= $_dt_outfile/diff_table-$_dt_connection-$_dt_database-$_dt_table - eval SELECT * FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list` INTO OUTFILE '$_dt_outfile'; + eval SELECT * INTO OUTFILE '$_dt_outfile' FROM $_dt_database.$_dt_table ORDER BY `$_dt_column_list`; # Compare files. if ($_dt_prev_outfile) diff --git a/mysql-test/include/galera_cluster.inc b/mysql-test/include/galera_cluster.inc index c1834c3c26f..7f76ea59c7f 100644 --- a/mysql-test/include/galera_cluster.inc +++ b/mysql-test/include/galera_cluster.inc @@ -8,5 +8,11 @@ --let $galera_cluster_size = 2 --source include/galera_init.inc - --source include/have_innodb.inc +--source include/galera_wait_ready.inc + +--connection node_2 +--source include/galera_wait_ready.inc +--source include/have_innodb.inc + +--connection node_1 diff --git a/mysql-test/suite/galera/include/galera_have_debug_sync.inc b/mysql-test/include/galera_have_debug_sync.inc similarity index 100% rename from mysql-test/suite/galera/include/galera_have_debug_sync.inc rename to mysql-test/include/galera_have_debug_sync.inc diff --git a/mysql-test/suite/galera_3nodes/include/galera_suspend.inc b/mysql-test/include/galera_suspend.inc similarity index 86% rename from mysql-test/suite/galera_3nodes/include/galera_suspend.inc rename to mysql-test/include/galera_suspend.inc index 3495ad2342b..d4037d8958c 100644 --- a/mysql-test/suite/galera_3nodes/include/galera_suspend.inc +++ b/mysql-test/include/galera_suspend.inc @@ -9,6 +9,6 @@ my $pid_filename = $ENV{'_SUSPEND_NODE_PIDFILE'}; my $mysqld_pid = `cat $pid_filename`; chomp($mysqld_pid); - system("kill -19 $mysqld_pid"); + system("kill -SIGSTOP $mysqld_pid"); exit(0); EOF diff --git a/mysql-test/include/galera_wait_sync_point.inc b/mysql-test/include/galera_wait_sync_point.inc index cf3a4980186..c0951b220b4 100644 --- a/mysql-test/include/galera_wait_sync_point.inc +++ b/mysql-test/include/galera_wait_sync_point.inc @@ -1,6 +1,17 @@ --let $wait_timeout = 10 --let $wsrep_on_orig = `SELECT @@wsrep_on` SET SESSION wsrep_on = 0; + +# +# following is only for debugging purposes +# should be commented out when test wporks as planned +# +#--sleep 1 +# SHOW PROCESSLIST; +#SHOW STATUS LIKE 'wsrep_%'; +#--echo $galera_sync_point + --let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_debug_sync_waiters' AND VARIABLE_VALUE = '$galera_sync_point' --source include/wait_condition.inc --eval SET SESSION wsrep_on = $wsrep_on_orig + diff --git a/mysql-test/include/have_32bit.inc b/mysql-test/include/have_32bit.inc new file mode 100644 index 00000000000..d62093d8be4 --- /dev/null +++ b/mysql-test/include/have_32bit.inc @@ -0,0 +1,9 @@ +disable_query_log; +disable_warnings; +let $VERSION_COMPILE_64BIT= + `SELECT IF(@@version_compile_machine like '%64%', 1, 0)`; +enable_warnings; +enable_query_log; +if ($VERSION_COMPILE_64BIT) { + skip Need a 32 bit machine/binary; +} diff --git a/mysql-test/include/have_64bit.inc b/mysql-test/include/have_64bit.inc new file mode 100644 index 00000000000..38c11156a53 --- /dev/null +++ b/mysql-test/include/have_64bit.inc @@ -0,0 +1,9 @@ +disable_query_log; +disable_warnings; +let $VERSION_COMPILE_64BIT= + `SELECT IF(@@version_compile_machine like '%64%', 1, 0)`; +enable_warnings; +enable_query_log; +if (!$VERSION_COMPILE_64BIT) { + skip Need a 64 bit machine/binary; +} diff --git a/mysql-test/include/have_aria_used_for_temp_tables.inc b/mysql-test/include/have_aria_used_for_temp_tables.inc new file mode 100644 index 00000000000..c921ba91d22 --- /dev/null +++ b/mysql-test/include/have_aria_used_for_temp_tables.inc @@ -0,0 +1,4 @@ +if (!`SELECT @@aria_used_for_temp_tables`) +{ + skip Need Aria to be used for temporary tables; +} diff --git a/mysql-test/include/have_auth_named_pipe.inc b/mysql-test/include/have_auth_named_pipe.inc new file mode 100644 index 00000000000..4f4bf37f11e --- /dev/null +++ b/mysql-test/include/have_auth_named_pipe.inc @@ -0,0 +1,13 @@ +--source include/not_embedded.inc + +if (!$AUTH_NAMED_PIPE_SO) { + skip No auth_named_pipe plugin; +} + +if (!$USERNAME) { + skip USER variable is undefined; +} + +if (`SELECT count(*) <> 0 FROM mysql.user WHERE user = '$USERNAME'`) { + skip %USERNAME%=$USER which exists in mysql.user; +} diff --git a/mysql-test/include/have_openssl.inc b/mysql-test/include/have_openssl.inc index c9260123f9d..ee51ee4527a 100644 --- a/mysql-test/include/have_openssl.inc +++ b/mysql-test/include/have_openssl.inc @@ -1,7 +1,4 @@ --- source include/have_ssl_communication.inc -let $crllen=`select length(trim(coalesce(@@ssl_crl, ''))) + length(trim(coalesce(@@ssl_crlpath, '')))`; -if (!$crllen) -{ +if (`SELECT count(*) = 0 FROM information_schema.GLOBAL_VARIABLES WHERE + VARIABLE_NAME = 'have_openssl' AND VARIABLE_VALUE = 'YES'`){ skip Needs OpenSSL; } - diff --git a/mysql-test/include/have_wsrep_enabled.inc b/mysql-test/include/have_wsrep_enabled.inc index 9287369c87c..7eb8b4372cf 100644 --- a/mysql-test/include/have_wsrep_enabled.inc +++ b/mysql-test/include/have_wsrep_enabled.inc @@ -1,7 +1,6 @@ # To be used in a test which requires wsrep plugin to be ACTIVE and enabled # (i.e. wsrep_on=ON). It includes have_wsrep.inc. ---source include/have_wsrep.inc --source include/have_innodb.inc if (`SELECT COUNT(*)=0 FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME = 'wsrep_on' AND VARIABLE_VALUE='ON'`) diff --git a/mysql-test/include/innodb_encrypt_tables.combinations b/mysql-test/include/innodb_encrypt_tables.combinations new file mode 100644 index 00000000000..4ca9b672119 --- /dev/null +++ b/mysql-test/include/innodb_encrypt_tables.combinations @@ -0,0 +1,14 @@ +[crypt] +innodb_encrypt_tables=ON +plugin-load-add=$FILE_KEY_MANAGEMENT_SO +loose-file-key-management +loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt +file-key-management-encryption-algorithm=aes_cbc + +[clear] +innodb_encrypt_tables=OFF +plugin-load-add=$FILE_KEY_MANAGEMENT_SO +loose-file-key-management +loose-file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys.txt +file-key-management-encryption-algorithm=aes_cbc + diff --git a/mysql-test/include/innodb_encrypt_tables.inc b/mysql-test/include/innodb_encrypt_tables.inc new file mode 100644 index 00000000000..31ab7999aef --- /dev/null +++ b/mysql-test/include/innodb_encrypt_tables.inc @@ -0,0 +1,4 @@ +# The goal of including this file is to enable innodb_encrypt_tables combinations +# (see include/innodb_encrypt_tables.combinations) + +--source include/have_innodb.inc diff --git a/mysql-test/include/kill_galera.inc b/mysql-test/include/kill_galera.inc new file mode 100644 index 00000000000..d7f665df6c7 --- /dev/null +++ b/mysql-test/include/kill_galera.inc @@ -0,0 +1,20 @@ +--echo Killing server ... + +# Write file to make mysql-test-run.pl expect the crash, but don't start it +--let $_server_id= `SELECT @@server_id` +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect +--exec echo "wait" > $_expect_file_name + +# Kill the connected server +--disable_reconnect +--let KILL_NODE_PIDFILE = `SELECT @@pid_file` + +--perl + my $pid_filename = $ENV{'KILL_NODE_PIDFILE'}; + my $mysqld_pid = `cat $pid_filename`; + chomp($mysqld_pid); + system("kill -9 $mysqld_pid"); + exit(0); +EOF + +--source include/wait_until_disconnected.inc diff --git a/mysql-test/include/mtr_check.sql b/mysql-test/include/mtr_check.sql index 8548200f437..c4ffc292500 100644 --- a/mysql-test/include/mtr_check.sql +++ b/mysql-test/include/mtr_check.sql @@ -35,6 +35,7 @@ BEGIN AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' + AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; -- Dump all databases, there should be none @@ -95,7 +96,7 @@ BEGIN mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, - mysql.user; + mysql.global_priv; -- verify that no plugin changed its disabled/enabled state SELECT * FROM INFORMATION_SCHEMA.PLUGINS; diff --git a/mysql-test/include/mtr_warnings.sql b/mysql-test/include/mtr_warnings.sql index b7b2a316dfb..524ea0f4859 100644 --- a/mysql-test/include/mtr_warnings.sql +++ b/mysql-test/include/mtr_warnings.sql @@ -242,7 +242,7 @@ BEGIN DECLARE `pos` bigint unsigned; -- Don't write these queries to binlog - SET SQL_LOG_BIN=0; + SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; -- -- Remove mark from lines that are suppressed by global suppressions diff --git a/mysql-test/include/switch_to_mysql_global_priv.inc b/mysql-test/include/switch_to_mysql_global_priv.inc new file mode 100644 index 00000000000..78df6642760 --- /dev/null +++ b/mysql-test/include/switch_to_mysql_global_priv.inc @@ -0,0 +1,6 @@ +disable_query_log; +drop table mysql.user; +rename table mysql.user_bak to mysql.user; +rename table mysql.global_priv_bak to mysql.global_priv; +flush privileges; +enable_query_log; diff --git a/mysql-test/include/switch_to_mysql_user.inc b/mysql-test/include/switch_to_mysql_user.inc new file mode 100644 index 00000000000..f5801db6114 --- /dev/null +++ b/mysql-test/include/switch_to_mysql_user.inc @@ -0,0 +1,56 @@ +disable_query_log; +rename table mysql.user to mysql.user_bak; +CREATE TABLE mysql.user ( + Host char(60) binary DEFAULT '' NOT NULL, + User char(80) binary DEFAULT '' NOT NULL, + Password char(41) character set latin1 collate latin1_bin DEFAULT '' NOT NULL, + Select_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Insert_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Update_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Delete_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Create_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Drop_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Reload_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Shutdown_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Process_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + File_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Grant_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + References_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Index_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Alter_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Show_db_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Super_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Create_tmp_table_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Lock_tables_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Execute_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Repl_slave_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Repl_client_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Create_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Show_view_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Create_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Alter_routine_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Create_user_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Event_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Trigger_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Create_tablespace_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + Delete_history_priv enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + ssl_type enum('','ANY','X509','SPECIFIED') COLLATE utf8_general_ci DEFAULT '' NOT NULL, + ssl_cipher BLOB NOT NULL, + x509_issuer BLOB NOT NULL, + x509_subject BLOB NOT NULL, + max_questions int(11) unsigned DEFAULT 0 NOT NULL, + max_updates int(11) unsigned DEFAULT 0 NOT NULL, + max_connections int(11) unsigned DEFAULT 0 NOT NULL, + max_user_connections int(11) DEFAULT 0 NOT NULL, + plugin char(64) CHARACTER SET latin1 DEFAULT '' NOT NULL, + authentication_string TEXT NOT NULL, + password_expired ENUM('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + is_role enum('N','Y') COLLATE utf8_general_ci DEFAULT 'N' NOT NULL, + default_role char(80) binary DEFAULT '' NOT NULL, + max_statement_time decimal(12,6) DEFAULT 0 NOT NULL, + PRIMARY KEY Host (Host,User) +) engine=Aria transactional=1 CHARACTER SET utf8 COLLATE utf8_bin comment='Users and global privileges'; +insert mysql.user select * from mysql.user_bak; +rename table mysql.global_priv to mysql.global_priv_bak; +flush privileges; +enable_query_log; diff --git a/mysql-test/include/system_db_struct.inc b/mysql-test/include/system_db_struct.inc index 7dd7746459e..d043d209850 100644 --- a/mysql-test/include/system_db_struct.inc +++ b/mysql-test/include/system_db_struct.inc @@ -7,6 +7,7 @@ show tables; show create table db; show create table user; show create table func; +show create table global_priv; show create table tables_priv; show create table columns_priv; show create table procs_priv; diff --git a/mysql-test/include/wait_until_connected_again.inc b/mysql-test/include/wait_until_connected_again.inc index 26168d10558..15a1e5bf847 100644 --- a/mysql-test/include/wait_until_connected_again.inc +++ b/mysql-test/include/wait_until_connected_again.inc @@ -11,7 +11,7 @@ let $counter= 5000; let $mysql_errno= 9999; while ($mysql_errno) { - --error 0,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013 + --error 0,ER_ACCESS_DENIED_ERROR,ER_SERVER_SHUTDOWN,ER_CONNECTION_KILLED,ER_LOCK_WAIT_TIMEOUT,2002,2006,2013 show status; dec $counter; @@ -19,13 +19,18 @@ while ($mysql_errno) { --die Server failed to restart } + if (!$mysql_errno) + { + # WSREP: SHOW STATUS queries are allowed even if wsrep + # is not ready. Make sure wsrep is ready before + # returning from this script + source include/wait_wsrep_ready.inc; + } + if ($mysql_errno == 1045) + { + let $mysql_errno=0; + } --sleep 0.1 } --enable_query_log --enable_result_log - -# WSREP: SHOW STATUS queries are allowed even if wsrep -# is not ready. Make sure wsrep is ready before -# returning from this script - ---source include/wait_wsrep_ready.inc diff --git a/mysql-test/include/wsrep_wait_disconnect.inc b/mysql-test/include/wsrep_wait_disconnect.inc new file mode 100644 index 00000000000..740fc0d9426 --- /dev/null +++ b/mysql-test/include/wsrep_wait_disconnect.inc @@ -0,0 +1,20 @@ +let $wait_condition = SELECT 1 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME = 'wsrep_ready' AND VARIABLE_VALUE = 'OFF'; +# since this is called until AFTER provider disconnects,we need to allow +# queries in non-prim +# +# We are also forced to use a hard-coded value for wsrep_sync_wait here because +# we can not issue a SELECT query to obtain the original value and then restore +# it +disable_query_log; +SET SESSION wsrep_sync_wait = 7; +--let $restore_wsrep_on = `SHOW VARIABLES WHERE Variable_name = 'wsrep_on' AND Value = 'ON'` +SET SESSION wsrep_on = OFF; + +--source include/wait_condition.inc + +if ($restore_wsrep_on != "") +{ + --eval SET SESSION wsrep_on = ON +} +SET SESSION wsrep_sync_wait = 15; +enable_query_log; diff --git a/mysql-test/lib/My/Config.pm b/mysql-test/lib/My/Config.pm index a343a0ef688..4af59a178de 100644 --- a/mysql-test/lib/My/Config.pm +++ b/mysql-test/lib/My/Config.pm @@ -195,14 +195,10 @@ sub value { my ($self, $option_name)= @_; my $option= $self->option($option_name); - if (! defined($option) and defined $ENV{$option_name}) { + if (! defined($option)) { my $value= $ENV{$option_name}; $option= My::Config::Option->new($option_name, $value); } - - croak "No option named '$option_name' in group '$self->{name}'" - if ! defined($option); - return $option->value(); } diff --git a/mysql-test/lib/generate-ssl-certs.sh b/mysql-test/lib/generate-ssl-certs.sh index 8f15ba9d521..0894be3a299 100755 --- a/mysql-test/lib/generate-ssl-certs.sh +++ b/mysql-test/lib/generate-ssl-certs.sh @@ -10,30 +10,49 @@ rm -rf demoCA mkdir demoCA demoCA/newcerts touch demoCA/index.txt echo 01 > demoCA/serial +echo 01 > demoCA/crlnumber # CA certificate, self-signed openssl req -x509 -newkey rsa:2048 -keyout cakey.pem -out cacert.pem -days 7300 -nodes -subj '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' -text # server certificate signing request and private key. Note the very long subject (for MDEV-7859) -openssl req -newkey rsa:1024 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name' +openssl req -newkey rsa:2048 -keyout server-key.pem -out demoCA/server-req.pem -days 7300 -nodes -subj '/CN=localhost/C=FI/ST=state or province within country, in other certificates in this file it is the same as L/L=location, usually an address but often ambiguously used/OU=organizational unit name, a division name within an organization/O=organization name, typically a company name' # convert the key to yassl compatible format openssl rsa -in server-key.pem -out server-key.pem # sign the server certificate with CA certificate -openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -infiles demoCA/server-req.pem +openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server-cert.pem -in demoCA/server-req.pem +# server certificate with different validity period (MDEV-7598) +openssl req -newkey rsa:2048 -keyout server-new-key.pem -out demoCA/server-new-req.pem -days 7301 -nodes -subj '/CN=server-new/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' +openssl rsa -in server-new-key.pem -out server-new-key.pem +openssl ca -keyfile cakey.pem -days 7301 -batch -cert cacert.pem -policy policy_anything -out server-new-cert.pem -in demoCA/server-new-req.pem + +# 8K cert openssl req -newkey rsa:8192 -keyout server8k-key.pem -out demoCA/server8k-req.pem -days 7300 -nodes -subj '/CN=server8k/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' openssl rsa -in server8k-key.pem -out server8k-key.pem -openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -infiles demoCA/server8k-req.pem - -openssl req -newkey rsa:1024 -keyout client-key.pem -out demoCA/client-req.pem -days 7300 -nodes -subj '/CN=client/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB' -openssl rsa -in client-key.pem -out client-key.pem -openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out client-cert.pem -infiles demoCA/client-req.pem +openssl ca -keyfile cakey.pem -days 7300 -batch -cert cacert.pem -policy policy_anything -out server8k-cert.pem -in demoCA/server8k-req.pem # with SubjectAltName, only for OpenSSL 1.0.2+ cat > demoCA/sanext.conf < $skip_combinations{$filename} }); } else { return () if @::opt_combinations or not -f $filename; + return () if ::using_extern(); # Read combinations file in my.cnf format mtr_verbose("Read combinations file $filename"); my $config= My::Config->new($filename); diff --git a/mysql-test/lib/v1/mysql-test-run.pl b/mysql-test/lib/v1/mysql-test-run.pl index 386b50b2723..9c9bc0e02fb 100755 --- a/mysql-test/lib/v1/mysql-test-run.pl +++ b/mysql-test/lib/v1/mysql-test-run.pl @@ -23,7 +23,7 @@ # Tool used for executing a suite of .test file # # See the "MySQL Test framework manual" for more information -# http://dev.mysql.com/doc/mysqltest/en/index.html +# https://mariadb.com/kb/en/library/mysqltest/ # # Please keep the test framework tools identical in all versions! # diff --git a/mysql-test/main/1st.result b/mysql-test/main/1st.result index 2d49726c5f6..c630be1d61c 100644 --- a/mysql-test/main/1st.result +++ b/mysql-test/main/1st.result @@ -13,6 +13,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword diff --git a/mysql-test/main/alter_table.result b/mysql-test/main/alter_table.result index cb3783eca5a..92946b65e66 100644 --- a/mysql-test/main/alter_table.result +++ b/mysql-test/main/alter_table.result @@ -181,6 +181,7 @@ t1 0 a 2 b A 300 NULL NULL YES BTREE t1 1 b 1 b A 100 NULL NULL YES BTREE analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -751,12 +752,12 @@ create table t1(f1 int); alter table t1 add column f2 datetime not null, add column f21 date not null; insert into t1 values(1,'2000-01-01','2000-01-01'); alter table t1 add column f3 datetime not null; -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'f3' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`f3` at row 1 alter table t1 add column f3 date not null; -ERROR 22007: Incorrect date value: '0000-00-00' for column 'f3' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`f3` at row 1 alter table t1 add column f4 datetime not null default '2002-02-02', add column f41 date not null; -ERROR 22007: Incorrect date value: '0000-00-00' for column 'f41' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`f41` at row 1 alter table t1 add column f4 datetime not null default '2002-02-02', add column f41 date not null default '2002-02-02'; select * from t1; @@ -1411,6 +1412,59 @@ t1 CREATE TABLE `t1` ( `consultant_id` bigint(20) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8 DROP TABLE t1; +# +# BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS +# +SET GLOBAL max_allowed_packet=17825792; +connect con1, localhost, root,,; +CREATE TABLE t1 (t1_fld1 TEXT); +CREATE TABLE t2 (t2_fld1 MEDIUMTEXT); +CREATE TABLE t3 (t3_fld1 LONGTEXT); +INSERT INTO t1 VALUES (REPEAT('a',300)); +INSERT INTO t2 VALUES (REPEAT('b',65680)); +INSERT INTO t3 VALUES (REPEAT('c',16777300)); +SELECT LENGTH(t1_fld1) FROM t1; +LENGTH(t1_fld1) +300 +SELECT LENGTH(t2_fld1) FROM t2; +LENGTH(t2_fld1) +65680 +SELECT LENGTH(t3_fld1) FROM t3; +LENGTH(t3_fld1) +16777300 +# With strict mode +SET SQL_MODE='STRICT_ALL_TABLES'; +ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT; +ERROR 22001: Data too long for column 'my_t1_fld1' at row 1 +ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT; +ERROR 22001: Data too long for column 'my_t2_fld1' at row 1 +ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT; +ERROR 22001: Data too long for column 'my_t3_fld1' at row 1 +# With non-strict mode +SET SQL_MODE=''; +ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT; +Warnings: +Warning 1265 Data truncated for column 'my_t1_fld1' at row 1 +ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT; +Warnings: +Warning 1265 Data truncated for column 'my_t2_fld1' at row 1 +ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT; +Warnings: +Warning 1265 Data truncated for column 'my_t3_fld1' at row 1 +SELECT LENGTH(my_t1_fld1) FROM t1; +LENGTH(my_t1_fld1) +255 +SELECT LENGTH(my_t2_fld1) FROM t2; +LENGTH(my_t2_fld1) +65535 +SELECT LENGTH(my_t3_fld1) FROM t3; +LENGTH(my_t3_fld1) +16777215 +disconnect con1; +connection default; +DROP TABLE t1, t2, t3; +SET SQL_MODE=default; +SET GLOBAL max_allowed_packet=default; CREATE TABLE t1 ( id INT(11) NOT NULL, x_param INT(11) DEFAULT NULL, @@ -2416,3 +2470,24 @@ DROP TABLE t1; # # End of 10.2 tests # +# +# MDEV-17778: Alter table leads to a truncation warning with ANALYZE command +# +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables=PREFERABLY; +create table t1 (a int)engine=InnoDB; +insert into t1 values (1),(1),(2),(3); +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +alter table t1 change a b int; +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= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; diff --git a/mysql-test/main/alter_table.test b/mysql-test/main/alter_table.test index 5c218c26923..829f4013cb3 100644 --- a/mysql-test/main/alter_table.test +++ b/mysql-test/main/alter_table.test @@ -1292,6 +1292,56 @@ MODIFY COLUMN `consultant_id` BIGINT; SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # BUG#27788685: NO WARNING WHEN TRUNCATING A STRING WITH DATA LOSS +--echo # + +SET GLOBAL max_allowed_packet=17825792; + +--connect(con1, localhost, root,,) +CREATE TABLE t1 (t1_fld1 TEXT); +CREATE TABLE t2 (t2_fld1 MEDIUMTEXT); +CREATE TABLE t3 (t3_fld1 LONGTEXT); + +INSERT INTO t1 VALUES (REPEAT('a',300)); +INSERT INTO t2 VALUES (REPEAT('b',65680)); +INSERT INTO t3 VALUES (REPEAT('c',16777300)); + +SELECT LENGTH(t1_fld1) FROM t1; +SELECT LENGTH(t2_fld1) FROM t2; +SELECT LENGTH(t3_fld1) FROM t3; + +--echo # With strict mode +SET SQL_MODE='STRICT_ALL_TABLES'; + +--error ER_DATA_TOO_LONG +ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT; +--error ER_DATA_TOO_LONG +ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT; +--error ER_DATA_TOO_LONG +ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT; + +--echo # With non-strict mode +SET SQL_MODE=''; + +ALTER TABLE t1 CHANGE `t1_fld1` `my_t1_fld1` TINYTEXT; +ALTER TABLE t2 CHANGE `t2_fld1` `my_t2_fld1` TEXT; +ALTER TABLE t3 CHANGE `t3_fld1` `my_t3_fld1` MEDIUMTEXT; + +SELECT LENGTH(my_t1_fld1) FROM t1; +SELECT LENGTH(my_t2_fld1) FROM t2; +SELECT LENGTH(my_t3_fld1) FROM t3; + +# Cleanup +--disconnect con1 +--source include/wait_until_disconnected.inc + +--connection default +DROP TABLE t1, t2, t3; + +SET SQL_MODE=default; +SET GLOBAL max_allowed_packet=default; + # # Test of ALTER TABLE IF [NOT] EXISTS # @@ -1971,3 +2021,22 @@ DROP TABLE t1; --echo # --echo # End of 10.2 tests --echo # + +--echo # +--echo # MDEV-17778: Alter table leads to a truncation warning with ANALYZE command +--echo # + +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables=PREFERABLY; + +create table t1 (a int)engine=InnoDB; +insert into t1 values (1),(1),(2),(3); + +analyze table t1; +alter table t1 change a b int; +analyze table t1; +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; diff --git a/mysql-test/main/alter_table_errors.result b/mysql-test/main/alter_table_errors.result index 020a30304d0..b26409e3d05 100644 --- a/mysql-test/main/alter_table_errors.result +++ b/mysql-test/main/alter_table_errors.result @@ -8,3 +8,22 @@ t CREATE TABLE `t` ( `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL ) ENGINE=InnoDB DEFAULT CHARSET=latin1 drop table t; +create temporary table t1 (a int, v int as (a)); +alter table t1 change column a b int, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `a` int(11) DEFAULT NULL, + `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +create temporary table t2 (a int, v int as (a)); +lock table t2 write; +alter table t2 change column a b int, algorithm=inplace; +ERROR 0A000: ALGORITHM=INPLACE is not supported for this operation. Try ALGORITHM=COPY +show create table t2; +Table Create Table +t2 CREATE TEMPORARY TABLE `t2` ( + `a` int(11) DEFAULT NULL, + `v` int(11) GENERATED ALWAYS AS (`a`) VIRTUAL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 diff --git a/mysql-test/main/alter_table_errors.test b/mysql-test/main/alter_table_errors.test index d9982ac26f4..8fa65b0f330 100644 --- a/mysql-test/main/alter_table_errors.test +++ b/mysql-test/main/alter_table_errors.test @@ -8,3 +8,14 @@ create table t (a int, v int as (a)) engine=innodb; alter table t change column a b tinyint, algorithm=inplace; show create table t; drop table t; + +create temporary table t1 (a int, v int as (a)); +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t1 change column a b int, algorithm=inplace; +show create table t1; + +create temporary table t2 (a int, v int as (a)); +lock table t2 write; +--error ER_ALTER_OPERATION_NOT_SUPPORTED +alter table t2 change column a b int, algorithm=inplace; +show create table t2; diff --git a/mysql-test/main/alter_user.result b/mysql-test/main/alter_user.result index 76f811f18c7..cae864fa437 100644 --- a/mysql-test/main/alter_user.result +++ b/mysql-test/main/alter_user.result @@ -1,3 +1,4 @@ +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; select * from mysql.user where user = 'root' and host = 'localhost'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 N N 0.000000 @@ -7,19 +8,19 @@ localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y alter user CURRENT_USER; select * from mysql.user where user = 'root' and host = 'localhost'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 N N 0.000000 +localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 mysql_native_password N N 0.000000 alter user CURRENT_USER(); select * from mysql.user where user = 'root' and host = 'localhost'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 N N 0.000000 +localhost root Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y Y 0 0 0 0 mysql_native_password N N 0.000000 create user foo; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N N 0.000000 +% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 mysql_native_password N N 0.000000 alter user foo; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N N 0.000000 +% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 mysql_native_password N N 0.000000 # Test super privilege works correctly with a read only database. SET @start_read_only = @@global.read_only; SET GLOBAL read_only=1; @@ -51,37 +52,43 @@ Note 1396 Operation ALTER USER failed for 'boo' alter user foo identified by 'something'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 alter user foo identified by 'something2'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *9CD58369E930E28C8996A89DB18B63294E6DC10C N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 N N 0.000000 +% foo *9CD58369E930E28C8996A89DB18B63294E6DC10C N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *9CD58369E930E28C8996A89DB18B63294E6DC10C N N 0.000000 alter user foo identified by password '*88C89BE093D4ECF72D039F62EBB7477EA1FD4D63'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 alter user foo identified with 'somecoolplugin'; +ERROR HY000: Operation ALTER USER failed for 'foo'@'%' +show warnings; +Level Code Message +Error 1524 Plugin 'somecoolplugin' is not loaded +Error 1396 Operation ALTER USER failed for 'foo'@'%' +alter user foo identified with 'mysql_old_password'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 somecoolplugin N N 0.000000 -alter user foo identified with 'somecoolplugin' using 'somecoolpassphrase'; +% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_old_password N N 0.000000 +alter user foo identified with 'mysql_old_password' using '0123456789ABCDEF'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 somecoolplugin somecoolpassphrase N N 0.000000 +% foo 0123456789ABCDEF N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N 0 0 0 0 mysql_old_password 0123456789ABCDEF N N 0.000000 # Test ssl related altering. alter user foo identified by 'something' require SSL; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N ANY 0 0 0 0 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N ANY 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 alter user foo identified by 'something' require X509; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N X509 0 0 0 0 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N X509 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 alter user foo identified by 'something' require cipher 'text' issuer 'foo_issuer' subject 'foo_subject'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 0 0 0 0 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 0 0 0 0 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 # Test resource limits altering. alter user foo with MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 @@ -89,5 +96,6 @@ MAX_CONNECTIONS_PER_HOUR 30 MAX_USER_CONNECTIONS 40; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 N N 0.000000 +% foo *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N N N N N N N N N N N N N N Y N N N N N N N N N Y N N N N SPECIFIED text foo_issuer foo_subject 10 20 30 40 mysql_native_password *88C89BE093D4ECF72D039F62EBB7477EA1FD4D63 N N 0.000000 drop user foo; +update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/alter_user.test b/mysql-test/main/alter_user.test index ca444f70a70..9ea98615272 100644 --- a/mysql-test/main/alter_user.test +++ b/mysql-test/main/alter_user.test @@ -1,5 +1,7 @@ --source include/not_embedded.inc +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; + select * from mysql.user where user = 'root' and host = 'localhost'; --echo # Test syntax --echo # @@ -53,10 +55,14 @@ select * from mysql.user where user = 'foo'; alter user foo identified by password '*88C89BE093D4ECF72D039F62EBB7477EA1FD4D63'; select * from mysql.user where user = 'foo'; +--error ER_CANNOT_USER alter user foo identified with 'somecoolplugin'; +show warnings; + +alter user foo identified with 'mysql_old_password'; select * from mysql.user where user = 'foo'; -alter user foo identified with 'somecoolplugin' using 'somecoolpassphrase'; +alter user foo identified with 'mysql_old_password' using '0123456789ABCDEF'; select * from mysql.user where user = 'foo'; --echo # Test ssl related altering. @@ -77,3 +83,5 @@ alter user foo with MAX_QUERIES_PER_HOUR 10 MAX_USER_CONNECTIONS 40; select * from mysql.user where user = 'foo'; drop user foo; + +update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/analyze.result b/mysql-test/main/analyze.result index 9dff94ab08c..dd785abcd42 100644 --- a/mysql-test/main/analyze.result +++ b/mysql-test/main/analyze.result @@ -3,6 +3,7 @@ lock tables t1 write; insert into t1 values(0); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK unlock tables; check table t1; @@ -15,6 +16,7 @@ lock tables t1 write; delete from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK unlock tables; check table t1; @@ -25,6 +27,7 @@ create table t1 (a bigint); insert into t1 values(0); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK check table t1; Table Op Msg_type Msg_text @@ -34,9 +37,13 @@ create table t1 (a mediumtext, fulltext key key1(a)) charset utf8 collate utf8_g insert into t1 values ('hello'); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'a' test.t1 analyze status OK analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'a' test.t1 analyze status Table is already up to date drop table t1; CREATE TABLE t1 (a int); diff --git a/mysql-test/main/auth_rpl.result b/mysql-test/main/auth_rpl.result index a3da7985da1..56f5f5e8f2b 100644 --- a/mysql-test/main/auth_rpl.result +++ b/mysql-test/main/auth_rpl.result @@ -15,7 +15,7 @@ connection master; connection slave; # Slave in-sync with master now. SELECT user, plugin, authentication_string FROM mysql.user WHERE user LIKE 'plug_user'; -user plugin authentication_string +User plugin authentication_string plug_user test_plugin_server plug_user # Cleanup (on slave). include/stop_slave.inc diff --git a/mysql-test/main/auto_increment_ranges_innodb.result b/mysql-test/main/auto_increment_ranges_innodb.result index 1d827a5a166..0471a5a33ba 100644 --- a/mysql-test/main/auto_increment_ranges_innodb.result +++ b/mysql-test/main/auto_increment_ranges_innodb.result @@ -264,3 +264,17 @@ delete from t1 where a=32767; insert into t1 values(NULL); ERROR 22003: Out of range value for column 'a' at row 1 drop table t1; +create table t1 (pk int auto_increment primary key, f varchar(20)); +insert t1 (f) values ('a'), ('b'), ('c'), ('d'); +select null, f into outfile 'load.data' from t1 limit 1; +load data infile 'load.data' into table t1; +insert t1 (f) values ('<==='); +select * from t1; +pk f +1 a +2 b +3 c +4 d +5 a +6 <=== +drop table t1; diff --git a/mysql-test/main/auto_increment_ranges_innodb.test b/mysql-test/main/auto_increment_ranges_innodb.test index c2afee7ac66..016ca16bd91 100644 --- a/mysql-test/main/auto_increment_ranges_innodb.test +++ b/mysql-test/main/auto_increment_ranges_innodb.test @@ -5,3 +5,16 @@ --source include/have_innodb.inc set default_storage_engine=innodb; --source auto_increment_ranges.inc + +# +# MDEV-17377 invalid gap in auto-increment values after LOAD DATA +# +create table t1 (pk int auto_increment primary key, f varchar(20)); +insert t1 (f) values ('a'), ('b'), ('c'), ('d'); +select null, f into outfile 'load.data' from t1 limit 1; +load data infile 'load.data' into table t1; +insert t1 (f) values ('<==='); +select * from t1; +drop table t1; +--let $datadir=`select @@datadir` +--remove_file $datadir/test/load.data diff --git a/mysql-test/main/backup_aria.result b/mysql-test/main/backup_aria.result new file mode 100644 index 00000000000..d537711404f --- /dev/null +++ b/mysql-test/main/backup_aria.result @@ -0,0 +1,158 @@ +connect con1,localhost,root,,; +SET SESSION lock_wait_timeout = 1; +#----------------------------------------------------------------------- +# Single-threaded tests +#----------------------------------------------------------------------- +# Show the fate and impact of some SELECT /HANDLER ... READ +# sliding through the sequence. +CREATE TABLE t_permanent_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +INSERT INTO t_permanent_aria SET col1 = 1; +BACKUP STAGE START; +SELECT COUNT(*) FROM t_permanent_aria; +COUNT(*) +1 +HANDLER t_permanent_aria OPEN; +HANDLER t_permanent_aria READ FIRST; +col1 +1 +HANDLER t_permanent_aria CLOSE; +BACKUP STAGE FLUSH; +SELECT COUNT(*) FROM t_permanent_aria; +COUNT(*) +1 +HANDLER t_permanent_aria OPEN; +HANDLER t_permanent_aria READ FIRST; +col1 +1 +HANDLER t_permanent_aria CLOSE; +BACKUP STAGE BLOCK_DDL; +SELECT COUNT(*) FROM t_permanent_aria; +COUNT(*) +1 +HANDLER t_permanent_aria OPEN; +HANDLER t_permanent_aria READ FIRST; +col1 +1 +HANDLER t_permanent_aria CLOSE; +BACKUP STAGE BLOCK_COMMIT; +SELECT COUNT(*) FROM t_permanent_aria; +COUNT(*) +1 +HANDLER t_permanent_aria OPEN; +HANDLER t_permanent_aria READ FIRST; +col1 +1 +HANDLER t_permanent_aria CLOSE; +BACKUP STAGE END; +# In case the backup lock is taken by the current connection than +# - DML modifying some permanent table is not allowed +BACKUP STAGE START; +SET AUTOCOMMIT = 0; +INSERT INTO t_permanent_aria SET col1 = 1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +SET AUTOCOMMIT = 1; +INSERT INTO t_permanent_aria SET col1 = 1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +# - DDL creating or renaming a permanent table or a procedure is not +# allowed. +# The latter tries to modify a permanent system table. +CREATE TABLE throw_away (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +RENAME TABLE t_permanent_aria To throw_away; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +# - DDL creating a temporary table is allowed. +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +# - DML modifying that temporary table is allowed. +INSERT INTO t_temporary_aria SET col1 = 1; +SELECT COUNT(*) FROM t_temporary_aria; +COUNT(*) +1 +BACKUP STAGE END; +# Show the fate and impact of some auto committed INSERT into temporary +# table sliding through the sequence. +SET AUTOCOMMIT = 1; +BACKUP STAGE START; +INSERT INTO t_temporary_aria SET col1 = 1; +BACKUP STAGE FLUSH; +INSERT INTO t_temporary_aria SET col1 = 1; +BACKUP STAGE BLOCK_DDL; +INSERT INTO t_temporary_aria SET col1 = 1; +BACKUP STAGE BLOCK_COMMIT; +INSERT INTO t_temporary_aria SET col1 = 1; +BACKUP STAGE END; +SELECT COUNT(*) FROM t_temporary_aria; +COUNT(*) +5 +# Show the fate and impact of some DROP/CREATE TEMPORARY TABLE sliding +# through the sequence. +SET AUTOCOMMIT = 1; +BACKUP STAGE START; +DROP TEMPORARY TABLE t_temporary_aria; +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +BACKUP STAGE FLUSH; +DROP TEMPORARY TABLE t_temporary_aria; +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +BACKUP STAGE BLOCK_DDL; +DROP TEMPORARY TABLE t_temporary_aria; +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +BACKUP STAGE BLOCK_COMMIT; +DROP TEMPORARY TABLE t_temporary_aria; +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +BACKUP STAGE END; +# Show that even more DDL on the temporary table is allowed. +BACKUP STAGE START; +TRUNCATE t_temporary_aria; +ALTER TABLE t_temporary_aria ADD COLUMN col2 INT; +ALTER TABLE t_temporary_aria ADD KEY idx(col2); +BACKUP STAGE END; +DROP TABLE t_permanent_aria; +#----------------------------------------------------------------------- +# Show that non transactional tables locks with BACKUP STAGE FLUSH +#----------------------------------------------------------------------- +set session lock_wait_timeout=default; +create table t1 (a int) engine=aria transactional=0; +insert into t1 values (1), (2); +connection con1; +backup stage start; +backup stage flush; +connection default; +select * from t1; +a +1 +2 +SET STATEMENT lock_wait_timeout=0 FOR INSERT INTO t1 values (3); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +INSERT INTO t1 values (4); +connection con1; +backup stage end; +connection default; +select * from t1; +a +1 +2 +4 +drop table t1; +#----------------------------------------------------------------------- +# Show that transactional tables doesn't lock with BACKUP STAGE FLUSH +#----------------------------------------------------------------------- +set session lock_wait_timeout=default; +create table t1 (a int) engine=aria transactional=1 page_checksum=1; +insert into t1 values (1), (2); +connection con1; +backup stage start; +backup stage flush; +connection default; +INSERT INTO t1 values (4); +connection con1; +backup stage end; +connection default; +select * from t1; +a +1 +2 +4 +drop table t1; +# +# Cleanup +# +disconnect con1; diff --git a/mysql-test/main/backup_aria.test b/mysql-test/main/backup_aria.test new file mode 100644 index 00000000000..7b741b829a1 --- /dev/null +++ b/mysql-test/main/backup_aria.test @@ -0,0 +1,157 @@ +######################################################################## +# Tests for Implement LOCK FOR BACKUP (MDEV-5336) +######################################################################## +# Check a non transactional table per ENGINE = Aria TRANSACTIONAL = 0. +# + +--source include/not_embedded.inc +# As non transactional engine we use Aria with TRANSACTIONAL = 0 +--source include/have_aria.inc + +# Following connections are used in a few of the following tests +connect (con1,localhost,root,,); + +SET SESSION lock_wait_timeout = 1; + +--echo #----------------------------------------------------------------------- +--echo # Single-threaded tests +--echo #----------------------------------------------------------------------- + +--echo # Show the fate and impact of some SELECT /HANDLER ... READ +--echo # sliding through the sequence. +CREATE TABLE t_permanent_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +INSERT INTO t_permanent_aria SET col1 = 1; +BACKUP STAGE START; +SELECT COUNT(*) FROM t_permanent_aria; +HANDLER t_permanent_aria OPEN; +HANDLER t_permanent_aria READ FIRST; +HANDLER t_permanent_aria CLOSE; +BACKUP STAGE FLUSH; +SELECT COUNT(*) FROM t_permanent_aria; +HANDLER t_permanent_aria OPEN; +HANDLER t_permanent_aria READ FIRST; +HANDLER t_permanent_aria CLOSE; +BACKUP STAGE BLOCK_DDL; +SELECT COUNT(*) FROM t_permanent_aria; +HANDLER t_permanent_aria OPEN; +HANDLER t_permanent_aria READ FIRST; +HANDLER t_permanent_aria CLOSE; +BACKUP STAGE BLOCK_COMMIT; +SELECT COUNT(*) FROM t_permanent_aria; +HANDLER t_permanent_aria OPEN; +HANDLER t_permanent_aria READ FIRST; +HANDLER t_permanent_aria CLOSE; +BACKUP STAGE END; + +--echo # In case the backup lock is taken by the current connection than +--echo # - DML modifying some permanent table is not allowed +BACKUP STAGE START; +SET AUTOCOMMIT = 0; +--error ER_BACKUP_LOCK_IS_ACTIVE +INSERT INTO t_permanent_aria SET col1 = 1; +SET AUTOCOMMIT = 1; +--error ER_BACKUP_LOCK_IS_ACTIVE +INSERT INTO t_permanent_aria SET col1 = 1; + +--echo # - DDL creating or renaming a permanent table or a procedure is not +--echo # allowed. +--echo # The latter tries to modify a permanent system table. + +--error ER_BACKUP_LOCK_IS_ACTIVE +CREATE TABLE throw_away (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +--error ER_BACKUP_LOCK_IS_ACTIVE +RENAME TABLE t_permanent_aria To throw_away; +--echo # - DDL creating a temporary table is allowed. +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +--echo # - DML modifying that temporary table is allowed. +INSERT INTO t_temporary_aria SET col1 = 1; +SELECT COUNT(*) FROM t_temporary_aria; +BACKUP STAGE END; + +--echo # Show the fate and impact of some auto committed INSERT into temporary +--echo # table sliding through the sequence. +SET AUTOCOMMIT = 1; +BACKUP STAGE START; +INSERT INTO t_temporary_aria SET col1 = 1; +BACKUP STAGE FLUSH; +INSERT INTO t_temporary_aria SET col1 = 1; +BACKUP STAGE BLOCK_DDL; +INSERT INTO t_temporary_aria SET col1 = 1; +BACKUP STAGE BLOCK_COMMIT; +INSERT INTO t_temporary_aria SET col1 = 1; +BACKUP STAGE END; +SELECT COUNT(*) FROM t_temporary_aria; + +--echo # Show the fate and impact of some DROP/CREATE TEMPORARY TABLE sliding +--echo # through the sequence. + +SET AUTOCOMMIT = 1; +BACKUP STAGE START; +DROP TEMPORARY TABLE t_temporary_aria; +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +BACKUP STAGE FLUSH; +DROP TEMPORARY TABLE t_temporary_aria; +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +BACKUP STAGE BLOCK_DDL; +DROP TEMPORARY TABLE t_temporary_aria; +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +BACKUP STAGE BLOCK_COMMIT; +DROP TEMPORARY TABLE t_temporary_aria; +CREATE TEMPORARY TABLE t_temporary_aria (col1 INT) ENGINE = Aria TRANSACTIONAL = 0; +BACKUP STAGE END; +--echo # Show that even more DDL on the temporary table is allowed. +BACKUP STAGE START; +TRUNCATE t_temporary_aria; +ALTER TABLE t_temporary_aria ADD COLUMN col2 INT; +ALTER TABLE t_temporary_aria ADD KEY idx(col2); +BACKUP STAGE END; + +DROP TABLE t_permanent_aria; + +--echo #----------------------------------------------------------------------- +--echo # Show that non transactional tables locks with BACKUP STAGE FLUSH +--echo #----------------------------------------------------------------------- + +set session lock_wait_timeout=default; +create table t1 (a int) engine=aria transactional=0; +insert into t1 values (1), (2); + +connection con1; +backup stage start; +backup stage flush; +connection default; +select * from t1; +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR INSERT INTO t1 values (3); +--send INSERT INTO t1 values (4) +connection con1; +backup stage end; +connection default; +--reap # send +select * from t1; +drop table t1; + +--echo #----------------------------------------------------------------------- +--echo # Show that transactional tables doesn't lock with BACKUP STAGE FLUSH +--echo #----------------------------------------------------------------------- + +set session lock_wait_timeout=default; +create table t1 (a int) engine=aria transactional=1 page_checksum=1; +insert into t1 values (1), (2); + +connection con1; +backup stage start; +backup stage flush; +connection default; +INSERT INTO t1 values (4); +connection con1; +backup stage end; +connection default; +select * from t1; +drop table t1; + +--echo # +--echo # Cleanup +--echo # + +disconnect con1; diff --git a/mysql-test/main/backup_interaction.result b/mysql-test/main/backup_interaction.result new file mode 100644 index 00000000000..20ba8fa0811 --- /dev/null +++ b/mysql-test/main/backup_interaction.result @@ -0,0 +1,520 @@ +# +# Check backup and FTWRL +# +flush tables with read lock; +backup stage start; +ERROR HY000: Can't execute the query because you have a conflicting read lock +unlock tables; +backup stage start; +flush tables with read lock; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +backup stage end; +# +# Check backup and FLUSH TABLES +# +flush tables; +backup stage start; +flush tables; +backup stage end; +# +# Check BACKUP STAGE under lock tables +# +create table t1 (a int); +lock table t1 write; +backup stage start; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +backup stage end; +ERROR HY000: You must start backup with "BACKUP STAGE START" +unlock tables; +lock table t1 read; +backup stage start; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +backup stage end; +ERROR HY000: You must start backup with "BACKUP STAGE START" +unlock tables; +# +# Check lock tables under BACKUP STAGE +# +backup stage start; +unlock tables; +select lock_mode from information_schema.metadata_lock_info; +lock_mode +MDL_BACKUP_START +lock table t1 write; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +lock table t1 read; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +unlock tables; +backup stage end; +drop table t1; +# +# Check setting readonly under BACKUP STAGE +# +backup stage start; +set @@global.read_only=1; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +backup stage end; +# also make sure going back from read-only mode is not allowed +set @@global.read_only=1; +backup stage start; +set @@global.read_only=0; +ERROR HY000: Can't execute the given command because you have active locked tables or an active transaction +backup stage end; +set @@global.read_only=0; +# +# Check BACKUP STAGE under read_only +# +set @@global.read_only=1; +backup stage start; +backup stage end; +set @@global.read_only=0; +# +# Check that we can't create tables during backup +# +backup stage start; +create table t1 (a int); +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +backup stage end; +# also make sure we can't write to a table during backup +create table t1(a INT); +backup stage start; +insert into t1 values(1); +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +insert delayed into t1 values(1); +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +update t1 set a=1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +delete from t1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +truncate table t1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +drop table t1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +backup stage end; +drop table t1; +# +# BACKUP STAGE performs implicit commits +# +create table t1(a int) engine=InnoDB; +begin; +insert into t1 values(1); +select lock_mode from information_schema.metadata_lock_info; +lock_mode +MDL_SHARED_WRITE +backup stage start; +select lock_mode from information_schema.metadata_lock_info; +lock_mode +MDL_BACKUP_START +backup stage block_commit; +commit; +backup stage end; +drop table t1; +# Ensure that BACKUP STAGE ... does AUTOCOMMIT like most DDL. +# Sideeffect: +# Show the impact of not yet committed INSERT before sequence start +# and ROLLBACK sliding through the sequence. +CREATE TABLE t1 (col1 INT) ENGINE = InnoDB; +SET AUTOCOMMIT = 0; +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +ROLLBACK; +BACKUP STAGE END; +#---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +ROLLBACK; +BACKUP STAGE END; +#---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +ROLLBACK; +BACKUP STAGE END; +#---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +ROLLBACK; +BACKUP STAGE END; +#---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +ROLLBACK; +SELECT COUNT(*) = 5 AS expect_1 FROM t1; +expect_1 +1 +# Show the impact of not yet committed INSERT before sequence start +# and a COMMIT sliding through the sequence. +SET AUTOCOMMIT = 0; +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +COMMIT; +BACKUP STAGE END; +#---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +COMMIT; +BACKUP STAGE END; +#---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +COMMIT; +BACKUP STAGE END; +#---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +COMMIT; +BACKUP STAGE END; +#---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +COMMIT; +SELECT COUNT(*) = 10 AS expect_1 FROM t1; +expect_1 +1 +DELETE FROM t1; +COMMIT; +drop table t1; +# +# CHECK: RO transaction under BACKUP STAGE is a potential deadlock +# OTOH we most probably allow them under FTWRL as well +# +CREATE TABLE t1 (col1 INT) ENGINE = InnoDB; +insert into t1 values (1); +backup stage start; +backup stage block_commit; +begin; +select * from t1; +col1 +1 +select lock_mode from information_schema.metadata_lock_info; +lock_mode +MDL_BACKUP_WAIT_COMMIT +MDL_SHARED_READ +backup stage end; +select lock_mode from information_schema.metadata_lock_info; +lock_mode +drop table t1; +# +# Check that handler are closed by backup stage block_ddl +# +create table t1 (a int, key a (a)); +insert into t1 (a) values (1), (2), (3), (4), (5); +handler t1 open; +handler t1 read a prev; +a +5 +backup stage start; +handler t1 read a prev; +a +4 +backup stage flush; +backup stage block_ddl; +handler t1 read a prev; +a +5 +backup stage block_commit; +handler t1 read a prev; +a +4 +backup stage end; +handler t1 close; +drop table t1; +# Show the fate and impact of some SELECT /HANDLER ... READ +# sliding through the sequence. +CREATE TABLE t1_innodb (col1 INT) ENGINE = InnoDB; +INSERT INTO t1_innodb values (1),(2),(3); +COMMIT; +CREATE TABLE t1_myisam (col1 INT) ENGINE = MyISAM; +INSERT INTO t1_myisam values (1),(2),(3); +BACKUP STAGE START; +SELECT COUNT(*) FROM t1_innodb; +COUNT(*) +3 +SELECT * FROM t1_innodb; +col1 +1 +2 +3 +HANDLER t1_innodb OPEN; +HANDLER t1_innodb READ FIRST; +col1 +1 +HANDLER t1_innodb CLOSE; +SELECT COUNT(*) FROM t1_myisam; +COUNT(*) +3 +HANDLER t1_myisam OPEN; +HANDLER t1_myisam READ FIRST; +col1 +1 +HANDLER t1_myisam CLOSE; +BACKUP STAGE FLUSH; +SELECT COUNT(*) FROM t1_innodb; +COUNT(*) +3 +HANDLER t1_innodb OPEN; +HANDLER t1_innodb READ FIRST; +col1 +1 +HANDLER t1_innodb CLOSE; +SELECT COUNT(*) FROM t1_myisam; +COUNT(*) +3 +HANDLER t1_myisam OPEN; +HANDLER t1_myisam READ FIRST; +col1 +1 +HANDLER t1_myisam CLOSE; +BACKUP STAGE BLOCK_DDL; +SELECT COUNT(*) FROM t1_innodb; +COUNT(*) +3 +HANDLER t1_innodb OPEN; +HANDLER t1_innodb READ FIRST; +col1 +1 +HANDLER t1_innodb CLOSE; +SELECT COUNT(*) FROM t1_myisam; +COUNT(*) +3 +HANDLER t1_myisam OPEN; +HANDLER t1_myisam READ FIRST; +col1 +1 +HANDLER t1_myisam CLOSE; +BACKUP STAGE BLOCK_COMMIT; +SELECT COUNT(*) FROM t1_innodb; +COUNT(*) +3 +HANDLER t1_innodb OPEN; +HANDLER t1_innodb READ FIRST; +col1 +1 +HANDLER t1_innodb CLOSE; +SELECT COUNT(*) FROM t1_myisam; +COUNT(*) +3 +HANDLER t1_myisam OPEN; +HANDLER t1_myisam READ FIRST; +col1 +1 +HANDLER t1_myisam CLOSE; +BACKUP STAGE END; +drop table t1_innodb,t1_myisam; +# Show the fate and impact of some SET GLOBAL tx_read_only = 1/0 +# sliding through the sequence. +BACKUP STAGE START; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +BACKUP STAGE FLUSH; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +BACKUP STAGE BLOCK_DDL; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +BACKUP STAGE BLOCK_COMMIT; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +BACKUP STAGE END; +# Show the fate and impact of some SET SESSION sql_log_bin = 0/1 +# sliding through the sequence. +COMMIT; +SET SESSION sql_log_bin = 1; +BACKUP STAGE START; +SET SESSION sql_log_bin = 0; +SET SESSION sql_log_bin = 1; +BACKUP STAGE FLUSH; +SET SESSION sql_log_bin = 0; +SET SESSION sql_log_bin = 1; +BACKUP STAGE BLOCK_DDL; +SET SESSION sql_log_bin = 0; +SET SESSION sql_log_bin = 1; +BACKUP STAGE BLOCK_COMMIT; +SET SESSION sql_log_bin = 0; +SET SESSION sql_log_bin = 1; +BACKUP STAGE END; +#---- +SET SESSION sql_log_bin = 0; +BACKUP STAGE START; +SET SESSION sql_log_bin = 1; +SET SESSION sql_log_bin = 0; +BACKUP STAGE FLUSH; +SET SESSION sql_log_bin = 1; +SET SESSION sql_log_bin = 0; +BACKUP STAGE BLOCK_DDL; +SET SESSION sql_log_bin = 1; +SET SESSION sql_log_bin = 0; +BACKUP STAGE BLOCK_COMMIT; +SET SESSION sql_log_bin = 1; +SET SESSION sql_log_bin = 0; +BACKUP STAGE END; +SET SESSION sql_log_bin = 1; +#----------------------------------------------------------------------- +# BACKUP STAGE statements are not allowed in stored routines +#----------------------------------------------------------------------- +CREATE TABLE t1 (col1 INT); +CREATE PROCEDURE p1() +BEGIN +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +END| +ERROR 0A000: BACKUP STAGE is not allowed in stored procedures +CREATE FUNCTION f1 (s CHAR(20)) RETURNS INT DETERMINISTIC +BEGIN +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +RETURN 1; +END| +ERROR 0A000: BACKUP STAGE is not allowed in stored procedures +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +END| +ERROR 0A000: BACKUP STAGE is not allowed in stored procedures +DROP TABLE t1; +#----------------------------------------------------------------------- +# Check BACKUP status variables +#----------------------------------------------------------------------- +SET SESSION lock_wait_timeout = 1; +FLUSH STATUS; +# Show how the status variable 'Com_backup' changes after BACKUP STAGE .. +SHOW STATUS LIKE 'Com_backup'; +Variable_name Value +Com_backup 0 +BACKUP STAGE START; +SHOW STATUS LIKE 'Com_backup'; +Variable_name Value +Com_backup 1 +BACKUP STAGE START; +ERROR HY000: Backup stage 'START' is same or before current backup stage 'START' +SHOW STATUS LIKE 'Com_backup'; +Variable_name Value +Com_backup 2 +BACKUP STAGE FLUSH; +SHOW STATUS LIKE 'Com_backup'; +Variable_name Value +Com_backup 3 +BACKUP STAGE BLOCK_DDL; +SHOW STATUS LIKE 'Com_backup'; +Variable_name Value +Com_backup 4 +BACKUP STAGE BLOCK_COMMIT; +SHOW STATUS LIKE 'Com_backup'; +Variable_name Value +Com_backup 5 +BACKUP STAGE END; +# In case the backup lock is taken by the current connection than +# - DML modifying some permanent table is not allowed +CREATE TABLE t1_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t1_myisam (col1 INT) ENGINE = MyISAM; +BACKUP STAGE START; +SET AUTOCOMMIT = 0; +INSERT INTO t1_innodb SET col1 = 1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +SET AUTOCOMMIT = 1; +INSERT INTO t1_innodb SET col1 = 1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +INSERT INTO t1_myisam SET col1 = 1; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +# - DDL creating or renaming a permanent table or a procedure etc. +# is not allowed. +CREATE TABLE throw_away (col1 INT) ENGINE = InnoDB; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +RENAME TABLE t1_innodb To throw_away; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +CREATE PROCEDURE p1() SELECT 13; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +CREATE PROCEDURE p1() SELECT 13; +ERROR HY000: Can't execute the command as you have a BACKUP STAGE active +BACKUP STAGE END; +DROP TABLE t1_innodb; +DROP TABLE t1_myisam; +# +# Creating and modifying TEMPORARY TABLES are allowed +# +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +CREATE TEMPORARY TABLE tmp (col1 INT); +DROP TEMPORARY TABLE tmp; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +CREATE TEMPORARY TABLE t_temporary_myisam (col1 INT) ENGINE = MyISAM; +# - DML modifying that temporary table is allowed. +INSERT INTO t_temporary_innodb SET col1 = 1; +SELECT COUNT(*) FROM t_temporary_innodb; +COUNT(*) +1 +INSERT INTO t_temporary_myisam SET col1 = 1; +SELECT COUNT(*) FROM t_temporary_myisam; +COUNT(*) +1 +BACKUP STAGE END; +# Show the fate and impact of some auto committed INSERT into temporary +# table sliding through the sequence. +SET AUTOCOMMIT = 1; +BACKUP STAGE START; +INSERT INTO t_temporary_innodb SET col1 = 1; +INSERT INTO t_temporary_myisam SET col1 = 1; +BACKUP STAGE FLUSH; +INSERT INTO t_temporary_innodb SET col1 = 1; +INSERT INTO t_temporary_myisam SET col1 = 1; +BACKUP STAGE BLOCK_DDL; +INSERT INTO t_temporary_innodb SET col1 = 1; +INSERT INTO t_temporary_myisam SET col1 = 1; +BACKUP STAGE BLOCK_COMMIT; +INSERT INTO t_temporary_innodb SET col1 = 1; +INSERT INTO t_temporary_myisam SET col1 = 1; +BACKUP STAGE END; +SELECT COUNT(*) FROM t_temporary_innodb; +COUNT(*) +5 +# Show the fate and impact of some DROP/CREATE TEMPORARY TABLE sliding +# through the sequence. +SET AUTOCOMMIT = 1; +BACKUP STAGE START; +DROP TEMPORARY TABLE t_temporary_innodb; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +BACKUP STAGE FLUSH; +DROP TEMPORARY TABLE t_temporary_innodb; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +BACKUP STAGE BLOCK_DDL; +DROP TEMPORARY TABLE t_temporary_innodb; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +BACKUP STAGE BLOCK_COMMIT; +DROP TEMPORARY TABLE t_temporary_innodb; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +BACKUP STAGE END; +# Show that even more DDL on the temporary table is allowed. +BACKUP STAGE START; +TRUNCATE t_temporary_innodb; +ALTER TABLE t_temporary_innodb ADD COLUMN col2 INT; +ALTER TABLE t_temporary_innodb ADD KEY idx(col2); +BACKUP STAGE END; diff --git a/mysql-test/main/backup_interaction.test b/mysql-test/main/backup_interaction.test new file mode 100644 index 00000000000..f5362417c98 --- /dev/null +++ b/mysql-test/main/backup_interaction.test @@ -0,0 +1,503 @@ +######################################################################## +# Tests how BACKUP STAGE interacts with other commands (MDEV-5336) +######################################################################## + +--source include/have_innodb.inc +--source include/have_metadata_lock_info.inc + +--echo # +--echo # Check backup and FTWRL +--echo # + +flush tables with read lock; +--error ER_CANT_UPDATE_WITH_READLOCK +backup stage start; +unlock tables; +backup stage start; +--error ER_BACKUP_LOCK_IS_ACTIVE +flush tables with read lock; +backup stage end; + +--echo # +--echo # Check backup and FLUSH TABLES +--echo # + +flush tables; +backup stage start; +flush tables; +backup stage end; + +--echo # +--echo # Check BACKUP STAGE under lock tables +--echo # + +create table t1 (a int); +lock table t1 write; +--error ER_LOCK_OR_ACTIVE_TRANSACTION +backup stage start; +--error ER_BACKUP_NOT_RUNNING +backup stage end; +unlock tables; + +lock table t1 read; +--error ER_LOCK_OR_ACTIVE_TRANSACTION +backup stage start; +--error ER_BACKUP_NOT_RUNNING +backup stage end; +unlock tables; + + +--echo # +--echo # Check lock tables under BACKUP STAGE +--echo # +backup stage start; +unlock tables; +select lock_mode from information_schema.metadata_lock_info; + +--error ER_BACKUP_LOCK_IS_ACTIVE +lock table t1 write; +--error ER_BACKUP_LOCK_IS_ACTIVE +lock table t1 read; +unlock tables; +backup stage end; +drop table t1; + + +--echo # +--echo # Check setting readonly under BACKUP STAGE +--echo # +backup stage start; +--error ER_LOCK_OR_ACTIVE_TRANSACTION +set @@global.read_only=1; +backup stage end; + +--echo # also make sure going back from read-only mode is not allowed +set @@global.read_only=1; +backup stage start; +--error ER_LOCK_OR_ACTIVE_TRANSACTION +set @@global.read_only=0; +backup stage end; +set @@global.read_only=0; + +--echo # +--echo # Check BACKUP STAGE under read_only +--echo # + +set @@global.read_only=1; +backup stage start; +backup stage end; +set @@global.read_only=0; + +--echo # +--echo # Check that we can't create tables during backup +--echo # + +backup stage start; +--error ER_BACKUP_LOCK_IS_ACTIVE +create table t1 (a int); +backup stage end; + +--echo # also make sure we can't write to a table during backup +create table t1(a INT); +backup stage start; +--error ER_BACKUP_LOCK_IS_ACTIVE +insert into t1 values(1); +--error ER_BACKUP_LOCK_IS_ACTIVE +insert delayed into t1 values(1); +--error ER_BACKUP_LOCK_IS_ACTIVE +update t1 set a=1; +--error ER_BACKUP_LOCK_IS_ACTIVE +delete from t1; +--error ER_BACKUP_LOCK_IS_ACTIVE +truncate table t1; +--error ER_BACKUP_LOCK_IS_ACTIVE +drop table t1; +backup stage end; +drop table t1; + +--echo # +--echo # BACKUP STAGE performs implicit commits +--echo # +create table t1(a int) engine=InnoDB; +begin; +insert into t1 values(1); +select lock_mode from information_schema.metadata_lock_info; +backup stage start; +select lock_mode from information_schema.metadata_lock_info; +backup stage block_commit; +commit; +backup stage end; +drop table t1; + +--echo # Ensure that BACKUP STAGE ... does AUTOCOMMIT like most DDL. +--echo # Sideeffect: +--echo # Show the impact of not yet committed INSERT before sequence start +--echo # and ROLLBACK sliding through the sequence. + +CREATE TABLE t1 (col1 INT) ENGINE = InnoDB; +SET AUTOCOMMIT = 0; +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +ROLLBACK; +BACKUP STAGE END; +--echo #---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +ROLLBACK; +BACKUP STAGE END; +--echo #---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +ROLLBACK; +BACKUP STAGE END; +--echo #---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +ROLLBACK; +BACKUP STAGE END; +--echo #---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +ROLLBACK; +SELECT COUNT(*) = 5 AS expect_1 FROM t1; + +--echo # Show the impact of not yet committed INSERT before sequence start +--echo # and a COMMIT sliding through the sequence. + +SET AUTOCOMMIT = 0; +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +COMMIT; +BACKUP STAGE END; +--echo #---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +COMMIT; +BACKUP STAGE END; +--echo #---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +COMMIT; +BACKUP STAGE END; +--echo #---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +COMMIT; +BACKUP STAGE END; +--echo #---- +INSERT INTO t1 SET col1 = 1; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +COMMIT; +SELECT COUNT(*) = 10 AS expect_1 FROM t1; +DELETE FROM t1; +COMMIT; +drop table t1; + +--echo # +--echo # CHECK: RO transaction under BACKUP STAGE is a potential deadlock +--echo # OTOH we most probably allow them under FTWRL as well +--echo # + +CREATE TABLE t1 (col1 INT) ENGINE = InnoDB; +insert into t1 values (1); +backup stage start; +backup stage block_commit; +begin; +select * from t1; +select lock_mode from information_schema.metadata_lock_info; +backup stage end; +select lock_mode from information_schema.metadata_lock_info; +drop table t1; + +--echo # +--echo # Check that handler are closed by backup stage block_ddl +--echo # + +create table t1 (a int, key a (a)); +insert into t1 (a) values (1), (2), (3), (4), (5); +handler t1 open; +handler t1 read a prev; +backup stage start; +handler t1 read a prev; +backup stage flush; +backup stage block_ddl; +handler t1 read a prev; +backup stage block_commit; +handler t1 read a prev; +backup stage end; +handler t1 close; +drop table t1; + +--echo # Show the fate and impact of some SELECT /HANDLER ... READ +--echo # sliding through the sequence. + +CREATE TABLE t1_innodb (col1 INT) ENGINE = InnoDB; +INSERT INTO t1_innodb values (1),(2),(3); +COMMIT; +CREATE TABLE t1_myisam (col1 INT) ENGINE = MyISAM; +INSERT INTO t1_myisam values (1),(2),(3); +BACKUP STAGE START; +SELECT COUNT(*) FROM t1_innodb; +SELECT * FROM t1_innodb; +HANDLER t1_innodb OPEN; +HANDLER t1_innodb READ FIRST; +HANDLER t1_innodb CLOSE; +SELECT COUNT(*) FROM t1_myisam; +HANDLER t1_myisam OPEN; +HANDLER t1_myisam READ FIRST; +HANDLER t1_myisam CLOSE; +BACKUP STAGE FLUSH; +SELECT COUNT(*) FROM t1_innodb; +HANDLER t1_innodb OPEN; +HANDLER t1_innodb READ FIRST; +HANDLER t1_innodb CLOSE; +SELECT COUNT(*) FROM t1_myisam; +HANDLER t1_myisam OPEN; +HANDLER t1_myisam READ FIRST; +HANDLER t1_myisam CLOSE; +BACKUP STAGE BLOCK_DDL; +SELECT COUNT(*) FROM t1_innodb; +HANDLER t1_innodb OPEN; +HANDLER t1_innodb READ FIRST; +HANDLER t1_innodb CLOSE; +SELECT COUNT(*) FROM t1_myisam; +HANDLER t1_myisam OPEN; +HANDLER t1_myisam READ FIRST; +HANDLER t1_myisam CLOSE; +BACKUP STAGE BLOCK_COMMIT; +SELECT COUNT(*) FROM t1_innodb; +HANDLER t1_innodb OPEN; +HANDLER t1_innodb READ FIRST; +HANDLER t1_innodb CLOSE; +SELECT COUNT(*) FROM t1_myisam; +HANDLER t1_myisam OPEN; +HANDLER t1_myisam READ FIRST; +HANDLER t1_myisam CLOSE; +BACKUP STAGE END; +drop table t1_innodb,t1_myisam; + +--echo # Show the fate and impact of some SET GLOBAL tx_read_only = 1/0 +--echo # sliding through the sequence. + +BACKUP STAGE START; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +BACKUP STAGE FLUSH; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +BACKUP STAGE BLOCK_DDL; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +BACKUP STAGE BLOCK_COMMIT; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +BACKUP STAGE END; + +--echo # Show the fate and impact of some SET SESSION sql_log_bin = 0/1 +--echo # sliding through the sequence. +COMMIT; +SET SESSION sql_log_bin = 1; +BACKUP STAGE START; +SET SESSION sql_log_bin = 0; +SET SESSION sql_log_bin = 1; +BACKUP STAGE FLUSH; +SET SESSION sql_log_bin = 0; +SET SESSION sql_log_bin = 1; +BACKUP STAGE BLOCK_DDL; +SET SESSION sql_log_bin = 0; +SET SESSION sql_log_bin = 1; +BACKUP STAGE BLOCK_COMMIT; +SET SESSION sql_log_bin = 0; +SET SESSION sql_log_bin = 1; +BACKUP STAGE END; + +--echo #---- +SET SESSION sql_log_bin = 0; +BACKUP STAGE START; +SET SESSION sql_log_bin = 1; +SET SESSION sql_log_bin = 0; +BACKUP STAGE FLUSH; +SET SESSION sql_log_bin = 1; +SET SESSION sql_log_bin = 0; +BACKUP STAGE BLOCK_DDL; +SET SESSION sql_log_bin = 1; +SET SESSION sql_log_bin = 0; +BACKUP STAGE BLOCK_COMMIT; +SET SESSION sql_log_bin = 1; +SET SESSION sql_log_bin = 0; +BACKUP STAGE END; +SET SESSION sql_log_bin = 1; + +--echo #----------------------------------------------------------------------- +--echo # BACKUP STAGE statements are not allowed in stored routines +--echo #----------------------------------------------------------------------- + +CREATE TABLE t1 (col1 INT); + +delimiter |; +--error ER_SP_BADSTATEMENT +CREATE PROCEDURE p1() +BEGIN + BACKUP STAGE START; + BACKUP STAGE FLUSH; + BACKUP STAGE BLOCK_DDL; + BACKUP STAGE BLOCK_COMMIT; + BACKUP STAGE END; +END| + +--error ER_SP_BADSTATEMENT +CREATE FUNCTION f1 (s CHAR(20)) RETURNS INT DETERMINISTIC +BEGIN + BACKUP STAGE START; + BACKUP STAGE FLUSH; + BACKUP STAGE BLOCK_DDL; + BACKUP STAGE BLOCK_COMMIT; + BACKUP STAGE END; + RETURN 1; +END| + +--error ER_SP_BADSTATEMENT +CREATE TRIGGER tr1 BEFORE INSERT ON t1 FOR EACH ROW +BEGIN + BACKUP STAGE START; + BACKUP STAGE FLUSH; + BACKUP STAGE BLOCK_DDL; + BACKUP STAGE BLOCK_COMMIT; + BACKUP STAGE END; +END| + +delimiter ;| +DROP TABLE t1; + +--echo #----------------------------------------------------------------------- +--echo # Check BACKUP status variables +--echo #----------------------------------------------------------------------- + +SET SESSION lock_wait_timeout = 1; + +FLUSH STATUS; + +# MDEV-5336 introduces the status variable Com_backup +--echo # Show how the status variable 'Com_backup' changes after BACKUP STAGE .. + +SHOW STATUS LIKE 'Com_backup'; +BACKUP STAGE START; +SHOW STATUS LIKE 'Com_backup'; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE START; +SHOW STATUS LIKE 'Com_backup'; +BACKUP STAGE FLUSH; +SHOW STATUS LIKE 'Com_backup'; +BACKUP STAGE BLOCK_DDL; +SHOW STATUS LIKE 'Com_backup'; +BACKUP STAGE BLOCK_COMMIT; +SHOW STATUS LIKE 'Com_backup'; +BACKUP STAGE END; + +--echo # In case the backup lock is taken by the current connection than +--echo # - DML modifying some permanent table is not allowed + +CREATE TABLE t1_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t1_myisam (col1 INT) ENGINE = MyISAM; + +BACKUP STAGE START; +SET AUTOCOMMIT = 0; +--error ER_BACKUP_LOCK_IS_ACTIVE +INSERT INTO t1_innodb SET col1 = 1; +SET AUTOCOMMIT = 1; +--error ER_BACKUP_LOCK_IS_ACTIVE +INSERT INTO t1_innodb SET col1 = 1; +--error ER_BACKUP_LOCK_IS_ACTIVE +INSERT INTO t1_myisam SET col1 = 1; +--echo # - DDL creating or renaming a permanent table or a procedure etc. +--echo # is not allowed. +--error ER_BACKUP_LOCK_IS_ACTIVE +CREATE TABLE throw_away (col1 INT) ENGINE = InnoDB; +--error ER_BACKUP_LOCK_IS_ACTIVE +RENAME TABLE t1_innodb To throw_away; +--error ER_BACKUP_LOCK_IS_ACTIVE +CREATE PROCEDURE p1() SELECT 13; +--error ER_BACKUP_LOCK_IS_ACTIVE +CREATE PROCEDURE p1() SELECT 13; +BACKUP STAGE END; +DROP TABLE t1_innodb; +DROP TABLE t1_myisam; + +--echo # +--echo # Creating and modifying TEMPORARY TABLES are allowed +--echo # + +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +CREATE TEMPORARY TABLE tmp (col1 INT); +DROP TEMPORARY TABLE tmp; + +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +CREATE TEMPORARY TABLE t_temporary_myisam (col1 INT) ENGINE = MyISAM; +--echo # - DML modifying that temporary table is allowed. +INSERT INTO t_temporary_innodb SET col1 = 1; +SELECT COUNT(*) FROM t_temporary_innodb; +INSERT INTO t_temporary_myisam SET col1 = 1; +SELECT COUNT(*) FROM t_temporary_myisam; +BACKUP STAGE END; + +--echo # Show the fate and impact of some auto committed INSERT into temporary +--echo # table sliding through the sequence. +SET AUTOCOMMIT = 1; +BACKUP STAGE START; +INSERT INTO t_temporary_innodb SET col1 = 1; +INSERT INTO t_temporary_myisam SET col1 = 1; +BACKUP STAGE FLUSH; +INSERT INTO t_temporary_innodb SET col1 = 1; +INSERT INTO t_temporary_myisam SET col1 = 1; +BACKUP STAGE BLOCK_DDL; +INSERT INTO t_temporary_innodb SET col1 = 1; +INSERT INTO t_temporary_myisam SET col1 = 1; +BACKUP STAGE BLOCK_COMMIT; +INSERT INTO t_temporary_innodb SET col1 = 1; +INSERT INTO t_temporary_myisam SET col1 = 1; +BACKUP STAGE END; +SELECT COUNT(*) FROM t_temporary_innodb; + +--echo # Show the fate and impact of some DROP/CREATE TEMPORARY TABLE sliding +--echo # through the sequence. +SET AUTOCOMMIT = 1; +BACKUP STAGE START; +DROP TEMPORARY TABLE t_temporary_innodb; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +BACKUP STAGE FLUSH; +DROP TEMPORARY TABLE t_temporary_innodb; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +BACKUP STAGE BLOCK_DDL; +DROP TEMPORARY TABLE t_temporary_innodb; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +BACKUP STAGE BLOCK_COMMIT; +DROP TEMPORARY TABLE t_temporary_innodb; +CREATE TEMPORARY TABLE t_temporary_innodb (col1 INT) ENGINE = InnoDB; +BACKUP STAGE END; +--echo # Show that even more DDL on the temporary table is allowed. +BACKUP STAGE START; +TRUNCATE t_temporary_innodb; +ALTER TABLE t_temporary_innodb ADD COLUMN col2 INT; +ALTER TABLE t_temporary_innodb ADD KEY idx(col2); +BACKUP STAGE END; diff --git a/mysql-test/main/backup_lock.result b/mysql-test/main/backup_lock.result new file mode 100644 index 00000000000..95b2f520d90 --- /dev/null +++ b/mysql-test/main/backup_lock.result @@ -0,0 +1,219 @@ +# +# Testing which locks we get from all stages +# +BACKUP STAGE START; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_START Backup lock +BACKUP STAGE FLUSH; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_FLUSH Backup lock +BACKUP STAGE BLOCK_DDL; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_WAIT_DDL Backup lock +BACKUP STAGE BLOCK_COMMIT; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_WAIT_COMMIT Backup lock +BACKUP STAGE END; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# +# testing BACKUP STAGE LOCK's +# +connect con1,localhost,root,,; +connect con2,localhost,root,,; +connection default; +# +# testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE +# +create table t1 (a int) engine=innodb; +start transaction; +insert into t1 values (1); +connection con1; +alter table t1 add column (j int), algorithm copy; +connection con2; +backup stage start; +backup stage flush; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_FLUSH Backup lock +MDL_SHARED_WRITE Table metadata lock test t1 +MDL_SHARED_UPGRADABLE Table metadata lock test t1 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +SET STATEMENT max_statement_time=1 FOR backup stage block_ddl; +ERROR 70100: Query execution was interrupted (max_statement_time exceeded) +backup stage block_ddl; +connection default; +commit; +SELECT * FROM t1; +a +1 +SET STATEMENT lock_wait_timeout=0 FOR INSERT INTO t1 values (2); +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +INSERT INTO t1 values (2,0);; +connection con2; +backup stage end; +connection con1; +connection default; +select * from t1; +a j +1 NULL +2 0 +drop table t1; +# Test with inline alter table, which doesn't block block_commit +create table t1 (a int) engine=innodb; +start transaction; +insert into t1 values (1); +connection con1; +alter table t1 add column (j int); +connection con2; +backup stage start; +backup stage flush; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_ALTER_COPY Backup lock +MDL_BACKUP_FLUSH Backup lock +MDL_SHARED_WRITE Table metadata lock test t1 +MDL_SHARED_UPGRADABLE Table metadata lock test t1 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +backup stage block_ddl; +backup stage block_commit; +connection default; +SELECT * FROM t1; +a +1 +commit; +connection con2; +backup stage end; +connection con1; +connection default; +drop table t1; +# +# testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE +# +create table t1 (a int) engine=innodb; +start transaction; +insert into t1 values (1); +connection con1; +SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DROP TABLE t1; +connection con2; +backup stage start; +backup stage flush; +SET STATEMENT lock_wait_timeout=0 FOR SELECT * FROM t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +backup stage block_ddl; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_WAIT_DDL Backup lock +MDL_SHARED_WRITE Table metadata lock test t1 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +backup stage end; +connection default; +commit; +connection con1; +connection default; +# +# Check if backup stage block_dll + concurrent drop table blocks select +# +create table t1 (a int) engine=innodb; +backup stage start; +backup stage block_ddl; +connection con1; +DROP TABLE t1; +connection con2; +connection con2; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_WAIT_DDL Backup lock +SELECT * FROM t1; +a +connection default; +backup stage end; +connection con1; +connection default; +# +# Check if backup stage block_dll overrides ddl lock for drop table +# +create table t1 (a int) engine=innodb; +start transaction; +insert into t1 values (1); +connection con1; +SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DROP TABLE t1; +connection con2; +backup stage start; +backup stage flush; +backup stage block_ddl; +connection default; +commit; +connection con2; +backup stage end; +connection con1; +connection default; +# +# Check if BACKUP STAGE BLOCK_COMMIT blocks commit +# +create table t1 (a int) engine=innodb; +start transaction; +insert into t1 values (1); +connection con1; +backup stage start; +backup stage block_commit; +connection default; +commit; +connection con1; +backup stage end; +connection default; +select * from t1; +a +1 +drop table t1; +disconnect con1; +disconnect con2; +# +# Test backup stage and flush tables +# +BACKUP STAGE START ; +BACKUP STAGE BLOCK_DDL ; +FLUSH TABLES; +CREATE TEMPORARY TABLE t12345678_tmp (col1 INT); +drop table t12345678_tmp; +BACKUP STAGE END; +# +# Test BACKUP STAGES with lock timeouts +# +SET GLOBAL lock_wait_timeout=0; +CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM; +INSERT INTO t_permanent_innodb SET col1 = 1; +INSERT INTO t_permanent_myisam SET col1 = 1; +CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t_con1_myisam (col1 INT) ENGINE = MyISAM; +connect con1,localhost,root,,; +SET AUTOCOMMIT = 0; +connection default; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +connection con1; +UPDATE t_permanent_innodb SET col1 = 8; +UPDATE t_permanent_myisam SET col1 = 8; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DROP TABLE t_con1_innodb; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DROP TABLE t_con1_myisam; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection default; +BACKUP STAGE END; +DROP TABLE t_permanent_myisam, t_permanent_innodb; +DROP TABLE t_con1_innodb, t_con1_myisam; +disconnect con1; +set global lock_wait_timeout=default; diff --git a/mysql-test/main/backup_lock.test b/mysql-test/main/backup_lock.test new file mode 100644 index 00000000000..d6db7a6364e --- /dev/null +++ b/mysql-test/main/backup_lock.test @@ -0,0 +1,284 @@ +######################################################################## +# Tests BACKUP STAGE locking +######################################################################## + +--source include/have_innodb.inc +--source include/have_metadata_lock_info.inc +--source include/not_embedded.inc + +--echo # +--echo # Testing which locks we get from all stages +--echo # + +BACKUP STAGE START; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP STAGE FLUSH; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP STAGE BLOCK_DDL; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP STAGE BLOCK_COMMIT; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP STAGE END; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; + +--echo # +--echo # testing BACKUP STAGE LOCK's +--echo # + +# Following connections are used in a few of the following tests +connect (con1,localhost,root,,); +connect (con2,localhost,root,,); +connection default; + +--echo # +--echo # testing if BACKUP STAGE FLUSH causes deadlocks with ALTER TABLE +--echo # + +create table t1 (a int) engine=innodb; + +start transaction; +# Acquires MDL lock +insert into t1 values (1); + +connection con1; +# Waits on MDL +--send alter table t1 add column (j int), algorithm copy + +connection con2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock"; +--source include/wait_condition.inc +backup stage start; +backup stage flush; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +# +# Do first test with max_statement_time, other tests later are done with +# lock_wait_timeout. This is mostly to ensure that both methods works +# +--error ER_STATEMENT_TIMEOUT +SET STATEMENT max_statement_time=1 FOR backup stage block_ddl; +--send backup stage block_ddl + +connection default; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for backup lock"; +--source include/wait_condition.inc +commit; +# The following select works because alter table is waiting for DDL lock +SELECT * FROM t1; +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR INSERT INTO t1 values (2); +--send INSERT INTO t1 values (2,0); +connection con2; +--reap # BLOCK_DDL +backup stage end; +connection con1; +--reap # ALTER TABLE +connection default; +--reap # INSERT +select * from t1; +drop table t1; + +--echo # Test with inline alter table, which doesn't block block_commit + +create table t1 (a int) engine=innodb; + +start transaction; +# Acquires MDL lock +insert into t1 values (1); + +connection con1; +# Waits on MDL +--send alter table t1 add column (j int) + +connection con2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock"; +--source include/wait_condition.inc +backup stage start; +backup stage flush; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +backup stage block_ddl; +backup stage block_commit; +connection default; +SELECT * FROM t1; +--send commit +connection con2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for backup lock"; +backup stage end; +connection con1; +--reap # ALTER TABLE +connection default; +--reap # commit +drop table t1; + +--echo # +--echo # testing if BACKUP STAGE FLUSH causes deadlocks with DROP TABLE +--echo # + +create table t1 (a int) engine=innodb; +start transaction; +# Acquires MDL lock +insert into t1 values (1); + +connection con1; +# Waits on MDL +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1; +--send DROP TABLE t1 + +connection con2; +backup stage start; +backup stage flush; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock"; +--source include/wait_condition.inc +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR SELECT * FROM t1; + +backup stage block_ddl; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +backup stage end; + +connection default; +commit; +connection con1; +--reap # DROP TABLE +connection default; + +--echo # +--echo # Check if backup stage block_dll + concurrent drop table blocks select +--echo # + +create table t1 (a int) engine=innodb; +backup stage start; +backup stage block_ddl; +connection con1; +--send DROP TABLE t1 +connection con2; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for backup lock"; +--source include/wait_condition.inc +connection con2; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +# Check that select's are not blocked +SELECT * FROM t1; +connection default; +backup stage end; +connection con1; +--reap +connection default; + +--echo # +--echo # Check if backup stage block_dll overrides ddl lock for drop table +--echo # + +create table t1 (a int) engine=innodb; +start transaction; +# Acquires MDL lock +insert into t1 values (1); + +connection con1; +# Waits on MDL +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR DROP TABLE t1; +--send DROP TABLE t1 + +connection con2; +backup stage start; +backup stage flush; +backup stage block_ddl; +connection default; +commit; +connection con2; +backup stage end; +connection con1; +--reap # DROP TABLE +connection default; + +--echo # +--echo # Check if BACKUP STAGE BLOCK_COMMIT blocks commit +--echo # + +create table t1 (a int) engine=innodb; +start transaction; +# Acquires MDL lock +insert into t1 values (1); + +connection con1; +backup stage start; +backup stage block_commit; +connection default; +--send commit +connection con1; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for backup lock"; +backup stage end; +connection default; +--reap # commit +select * from t1; +drop table t1; + +# +# End of tests using con1 and con2 +# +disconnect con1; +disconnect con2; + +--echo # +--echo # Test backup stage and flush tables +--echo # + +BACKUP STAGE START ; +BACKUP STAGE BLOCK_DDL ; +FLUSH TABLES; +CREATE TEMPORARY TABLE t12345678_tmp (col1 INT); +drop table t12345678_tmp; +BACKUP STAGE END; + +--echo # +--echo # Test BACKUP STAGES with lock timeouts +--echo # + +SET GLOBAL lock_wait_timeout=0; +CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM; +INSERT INTO t_permanent_innodb SET col1 = 1; + +INSERT INTO t_permanent_myisam SET col1 = 1; +CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t_con1_myisam (col1 INT) ENGINE = MyISAM; + +--connect(con1,localhost,root,,) +SET AUTOCOMMIT = 0; + +--connection default +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; + +--connection con1 +UPDATE t_permanent_innodb SET col1 = 8; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t_permanent_myisam SET col1 = 8; +--error ER_LOCK_WAIT_TIMEOUT +DROP TABLE t_con1_innodb; + +--error ER_LOCK_WAIT_TIMEOUT +DROP TABLE t_con1_myisam; + +--connection default +BACKUP STAGE END; +DROP TABLE t_permanent_myisam, t_permanent_innodb; +DROP TABLE t_con1_innodb, t_con1_myisam; +--disconnect con1 +set global lock_wait_timeout=default; diff --git a/mysql-test/main/backup_lock_debug.result b/mysql-test/main/backup_lock_debug.result new file mode 100644 index 00000000000..8832d9cd3e7 --- /dev/null +++ b/mysql-test/main/backup_lock_debug.result @@ -0,0 +1,28 @@ +# +# Make sure pending LOCK TABLES doesn't block BACKUP STAGE +# +CREATE TABLE t1(a INT); +LOCK TABLE t1 READ; +# +connect con1,localhost,root,,; +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready'; +LOCK TABLE t1 WRITE; +# +connect con2,localhost,root,,; +SET DEBUG_SYNC= 'now WAIT_FOR ready'; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +disconnect con2; +# +connection default; +UNLOCK TABLES; +# +connection con1; +UNLOCK TABLES; +disconnect con1; +# +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/backup_lock_debug.test b/mysql-test/main/backup_lock_debug.test new file mode 100644 index 00000000000..8cf492b3404 --- /dev/null +++ b/mysql-test/main/backup_lock_debug.test @@ -0,0 +1,40 @@ +######################################################################## +# Tests for BACKUP STAGE locking that requires debug. +######################################################################## + +--source include/have_debug_sync.inc + +--echo # +--echo # Make sure pending LOCK TABLES doesn't block BACKUP STAGE +--echo # +CREATE TABLE t1(a INT); +LOCK TABLE t1 READ; + +--echo # +connect (con1,localhost,root,,); +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready'; +--send LOCK TABLE t1 WRITE + +--echo # +connect (con2,localhost,root,,); +SET DEBUG_SYNC= 'now WAIT_FOR ready'; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +disconnect con2; + +--echo # +connection default; +UNLOCK TABLES; + +--echo # +connection con1; +reap; +UNLOCK TABLES; +disconnect con1; + +--echo # +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/backup_locks.result b/mysql-test/main/backup_locks.result new file mode 100644 index 00000000000..a3a66937cf9 --- /dev/null +++ b/mysql-test/main/backup_locks.result @@ -0,0 +1,46 @@ +# +# Test lock taken +# +BACKUP LOCK test.t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_SHARED_HIGH_PRIO Table metadata lock test t1 +BACKUP UNLOCK; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +BACKUP LOCK t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_SHARED_HIGH_PRIO Table metadata lock test t1 +BACKUP UNLOCK; +BACKUP LOCK non_existing.t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_SHARED_HIGH_PRIO Table metadata lock non_existing t1 +BACKUP UNLOCK; +# +# Test that backup lock protects against ddl +# +connect con1,localhost,root,,; +connection default; +create table t1 (a int) engine=innodb; +insert into t1 values (1); +backup lock t1; +select * from t1; +a +1 +connection con1; +drop table t1; +connection default; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_SHARED_HIGH_PRIO Table metadata lock test t1 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +select * from t1; +ERROR 40001: Deadlock found when trying to get lock; try restarting transaction +backup unlock; +connection con1; +connection default; +disconnect con1; +show tables; +Tables_in_test diff --git a/mysql-test/main/backup_locks.test b/mysql-test/main/backup_locks.test new file mode 100644 index 00000000000..21b67100506 --- /dev/null +++ b/mysql-test/main/backup_locks.test @@ -0,0 +1,50 @@ +######################################################################## +# Tests BACKUP STAGE locking +######################################################################## + +--source include/have_innodb.inc +--source include/have_metadata_lock_info.inc +--source include/not_embedded.inc + +--echo # +--echo # Test lock taken +--echo # + +BACKUP LOCK test.t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP UNLOCK; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP LOCK t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP UNLOCK; +BACKUP LOCK non_existing.t1; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +BACKUP UNLOCK; + +--echo # +--echo # Test that backup lock protects against ddl +--echo # + +connect (con1,localhost,root,,); + +connection default; +create table t1 (a int) engine=innodb; +insert into t1 values (1); +backup lock t1; +select * from t1; +connection con1; +--send drop table t1 +connection default; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock"; +--source include/wait_condition.inc +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +--error ER_LOCK_DEADLOCK +select * from t1; +backup unlock; +connection con1; +--reap +connection default; +disconnect con1; +show tables; diff --git a/mysql-test/main/backup_priv.result b/mysql-test/main/backup_priv.result new file mode 100644 index 00000000000..4169f58f40f --- /dev/null +++ b/mysql-test/main/backup_priv.result @@ -0,0 +1,40 @@ +# +# Test privileges for BACKUP STAGES +# +set sql_mode=""; +GRANT RELOAD ON *.* TO user1@localhost; +GRANT CREATE, DROP ON *.* TO user2@localhost; +connect con1, localhost, user1; +BACKUP STAGE START; +BACKUP STAGE END; +# change_user must release backup lock +BACKUP STAGE START; +BACKUP STAGE FLUSH; +SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock'; +lock_mode +MDL_BACKUP_FLUSH +SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock'; +lock_mode +disconnect con1; +connection default; +# A very low privileged user (-> con4) cannot acquire the backup lock +connect con1, localhost, user2; +BACKUP STAGE START; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +BACKUP STAGE FLUSH; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +BACKUP STAGE BLOCK_DDL; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +BACKUP STAGE BLOCK_COMMIT; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +BACKUP STAGE END; +ERROR 42000: Access denied; you need (at least one of) the RELOAD privilege(s) for this operation +disconnect con1; +connection default; +DROP USER user1@localhost, user2@localhost; +# +# Test using BACKUP STAGES in a SP +# +create procedure foo42() +BACKUP STAGE START; +ERROR 0A000: BACKUP STAGE is not allowed in stored procedures diff --git a/mysql-test/main/backup_priv.test b/mysql-test/main/backup_priv.test new file mode 100644 index 00000000000..93b69af0b67 --- /dev/null +++ b/mysql-test/main/backup_priv.test @@ -0,0 +1,52 @@ +--source include/have_innodb.inc +--source include/not_embedded.inc +--source include/have_metadata_lock_info.inc + +--echo # +--echo # Test privileges for BACKUP STAGES +--echo # + +set sql_mode=""; + +GRANT RELOAD ON *.* TO user1@localhost; +GRANT CREATE, DROP ON *.* TO user2@localhost; + +--connect(con1, localhost, user1) +BACKUP STAGE START; +BACKUP STAGE END; +--echo # change_user must release backup lock +BACKUP STAGE START; +BACKUP STAGE FLUSH; +SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock'; +change_user user2; +SELECT lock_mode FROM information_schema.metadata_lock_info WHERE lock_type='Backup lock'; +--disconnect con1 +--source include/wait_until_disconnected.inc +--connection default + +--echo # A very low privileged user (-> con4) cannot acquire the backup lock + +--connect(con1, localhost, user2) +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +BACKUP STAGE START; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +BACKUP STAGE FLUSH; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +BACKUP STAGE BLOCK_DDL; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +BACKUP STAGE BLOCK_COMMIT; +--error ER_SPECIFIC_ACCESS_DENIED_ERROR +BACKUP STAGE END; +--disconnect con1 +--source include/wait_until_disconnected.inc + +--connection default +DROP USER user1@localhost, user2@localhost; + +--echo # +--echo # Test using BACKUP STAGES in a SP +--echo # + +--error ER_SP_BADSTATEMENT +create procedure foo42() + BACKUP STAGE START; diff --git a/mysql-test/main/backup_stages.result b/mysql-test/main/backup_stages.result new file mode 100644 index 00000000000..caea1fda0b9 --- /dev/null +++ b/mysql-test/main/backup_stages.result @@ -0,0 +1,335 @@ +#----------------------------------------------------------------------- +# Multi-threaded tests +#----------------------------------------------------------------------- +# Show that only one connection can hold the backup lock. +connection default; +BACKUP STAGE START; +connect con1,localhost,root,,; +SET STATEMENT lock_wait_timeout=0 FOR BACKUP STAGE START; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +BACKUP STAGE START; +connection default; +# Show that the connection con1 has to wait for the backup lock and the +# corresponding representation within the processlist. +SET @con1_id = ; +SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY +FROM information_schema.processlist WHERE id = @con1_id; +ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY + root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START +BACKUP STAGE END; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_START Backup lock +connection con1; +# The connection default has removed the backup lock. +# And so the current connection con1 can reap for its BACKUP STAGE START +connect con2,localhost,root,,; +# The connection con2 cannot continue the work of con1 by setting the +# next BACKUP STAGE FLUSH. +BACKUP STAGE FLUSH; +ERROR HY000: You must start backup with "BACKUP STAGE START" +BACKUP STAGE START; +connection default; +SET @con2_id = ; +# Connection con2 waits for the backup lock held by con1. +SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY +FROM information_schema.processlist WHERE id = @con2_id; +ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY + root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START +disconnect con1; +connection con2; +# Connection con1 frees the backup lock held by disconnecting. +# So connection con2 gets the backup lock. +connect con3,localhost,root,,; +BACKUP STAGE START; +connection default; +SET @con3_id = ; +# Connection con3 waits for the backup lock held by con2. +SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY +FROM information_schema.processlist WHERE id = @con3_id; +ID USER COMMAND STATE INFO STAGE MAX_STAGE INFO_BINARY + root Query Waiting for backup lock BACKUP STAGE START 0 0 BACKUP STAGE START +KILL CONNECTION @con2_id; +connection con3; +# Connection con2 frees the backup lock held by getting killed. +# So connection con3 gets the backup lock. +BACKUP STAGE END; +disconnect con3; +connection default; +CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB; +INSERT INTO t_permanent_innodb SET col1 = 1; +CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM; +INSERT INTO t_permanent_myisam SET col1 = 1; +connect backup,localhost,root,,; +connect con11,localhost,root,,; +SET AUTOCOMMIT = 0; +set session lock_wait_timeout=0; +connect con12,localhost,root,,; +SET AUTOCOMMIT = 1; +# Between (connection default) BACKUP STAGE START and FLUSH +# no restrictions for concurrent sessions regarding DDL or DML +# affecting transactional/non transactional permanent tables. +connection backup; +BACKUP STAGE START; +connection con11; +UPDATE t_permanent_innodb SET col1 = 2; +UPDATE t_permanent_myisam SET col1 = 2; +SELECT COUNT(*) FROM t_permanent_innodb; +COUNT(*) +1 +HANDLER t_permanent_innodb OPEN; +HANDLER t_permanent_innodb READ FIRST; +col1 +2 +HANDLER t_permanent_innodb CLOSE; +SELECT COUNT(*) FROM t_permanent_myisam; +COUNT(*) +1 +HANDLER t_permanent_myisam OPEN; +HANDLER t_permanent_myisam READ FIRST; +col1 +2 +HANDLER t_permanent_myisam CLOSE; +CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t_con1_myisam (col1 INT) ENGINE = InnoDB; +ALTER TABLE t_permanent_innodb ADD COLUMN col2 INT; +ALTER TABLE t_permanent_myisam ADD COLUMN col2 INT; +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb; +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam; +connection con12; +UPDATE t_permanent_innodb SET col1 = 3; +UPDATE t_permanent_myisam SET col1 = 3; +# Between (connection default) BACKUP STAGE FLUSH and BLOCK_DDL +# concurrent sessions +# - can change transactional permanent tables with DDL and DML +# - can run DROP/CREATE transactional/non transactional TABLE +# - cannot modify non transactional permanent tables with DDL or DML +connection backup; +BACKUP STAGE FLUSH; +connection con11; +UPDATE t_permanent_innodb SET col1 = 4; +SET STATEMENT lock_wait_timeout=0 FOR UPDATE t_permanent_myisam SET col1 = 4; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT COUNT(*) FROM t_permanent_innodb; +COUNT(*) +1 +HANDLER t_permanent_innodb OPEN; +HANDLER t_permanent_innodb READ FIRST; +col1 col2 +4 NULL +HANDLER t_permanent_innodb CLOSE; +SELECT COUNT(*) FROM t_permanent_myisam; +COUNT(*) +1 +HANDLER t_permanent_myisam OPEN; +HANDLER t_permanent_myisam READ FIRST; +col1 col2 +3 NULL +HANDLER t_permanent_myisam CLOSE; +DROP TABLE t_con1_innodb; +DROP TABLE t_con1_myisam; +CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t_con1_myisam (col1 INT) ENGINE = InnoDB; +ALTER TABLE t_permanent_innodb ADD COLUMN col3 INT; +SET STATEMENT lock_wait_timeout=0 FOR ALTER TABLE t_permanent_myisam ADD COLUMN col3 INT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb; +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam; +connection con12; +UPDATE t_permanent_innodb SET col1 = 5; +# Between (connection default) BACKUP STAGE BLOCK_DDL and BLOCK_COMMIT +# concurrent sessions +# - can change transactional permanent tables with DML +# - cannot run DDL +# - cannot change non transactional permanent tables with DML +connection backup; +BACKUP STAGE BLOCK_DDL; +connection con11; +UPDATE t_permanent_innodb SET col1 = 6; +UPDATE t_permanent_myisam SET col1 = 6; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT COUNT(*) FROM t_permanent_innodb; +COUNT(*) +1 +HANDLER t_permanent_innodb OPEN; +HANDLER t_permanent_innodb READ FIRST; +col1 col2 col3 +6 NULL NULL +HANDLER t_permanent_innodb CLOSE; +SELECT COUNT(*) FROM t_permanent_myisam; +COUNT(*) +1 +HANDLER t_permanent_myisam OPEN; +HANDLER t_permanent_myisam READ FIRST; +col1 col2 +3 NULL +HANDLER t_permanent_myisam CLOSE; +DROP TABLE t_con1_innodb; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +CREATE TABLE throw_away (col1 INT) ENGINE = InnoDB; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +ALTER TABLE t_permanent_innodb ADD COLUMN col4 INT; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con12; +UPDATE t_permanent_innodb SET col1 = 7; +# Between (connection default) BACKUP STAGE BLOCK_COMMIT and END +# concurrent sessions +# - can change transactional permanent tables with DML +# - cannot run DDL +# - cannot change non transactional permanent tables with DML +connection backup; +BACKUP STAGE BLOCK_COMMIT; +connection con11; +UPDATE t_permanent_innodb SET col1 = 8; +UPDATE t_permanent_myisam SET col1 = 8; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +SELECT COUNT(*) FROM t_permanent_innodb; +COUNT(*) +1 +HANDLER t_permanent_innodb OPEN; +HANDLER t_permanent_innodb READ FIRST; +col1 col2 col3 +8 NULL NULL +HANDLER t_permanent_innodb CLOSE; +SELECT COUNT(*) FROM t_permanent_myisam; +COUNT(*) +1 +HANDLER t_permanent_myisam OPEN; +HANDLER t_permanent_myisam READ FIRST; +col1 col2 +3 NULL +HANDLER t_permanent_myisam CLOSE; +DROP TABLE t_con1_innodb; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +DROP TABLE t_con1_myisam; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection con12; +SET STATEMENT lock_wait_timeout=0 FOR UPDATE t_permanent_innodb SET col1 = 9; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +connection backup; +BACKUP STAGE END; +connection con11; +COMMIT; +SELECT * FROM t_permanent_innodb ORDER BY col1; +col1 col2 col3 +7 NULL NULL +SELECT * FROM t_permanent_myisam ORDER BY col1; +col1 col2 +3 NULL +SET AUTOCOMMIT = 0; +SET GLOBAL tx_read_only = 1; +connection con12; +BACKUP STAGE START; +BACKUP STAGE END; +SET GLOBAL tx_read_only = 0; +DROP VIEW v_some_view; +DROP TABLE t_con1_innodb; +DROP TABLE t_con1_myisam; +# Connection backup holds the backup log and is on some stage. +# Connection con11 tries to LOCK TABLEs or to set read_only. +connection backup; +BACKUP STAGE START; +connection con11; +# Between BACKUP STAGE START and FLUSH: +# No restrictions for other connection around LOCK TABLES or read-only. +LOCK TABLES t_permanent_innodb READ; +LOCK TABLES t_permanent_myisam READ; +LOCK TABLES t_permanent_innodb WRITE; +LOCK TABLES t_permanent_myisam WRITE; +UNLOCK TABLES; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +connection backup; +BACKUP STAGE FLUSH; +connection con11; +# Between BACKUP STAGE FLUSH and BLOCK_COMMIT: +# Connection con11 not holding the backup lock cannot +# LOCK WRITE non transactional table. +LOCK TABLES t_permanent_innodb READ; +LOCK TABLES t_permanent_myisam READ; +LOCK TABLES t_permanent_innodb WRITE; +LOCK TABLES t_permanent_myisam WRITE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UNLOCK TABLES; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +connection backup; +BACKUP STAGE BLOCK_DDL; +connection con11; +# Between BACKUP STAGE FLUSH and BLOCK_COMMIT: +# Connection con11 not holding the backup lock cannot +# LOCK WRITE transactional or non transactional table. +LOCK TABLES t_permanent_innodb READ; +LOCK TABLES t_permanent_myisam READ; +LOCK TABLES t_permanent_innodb WRITE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +LOCK TABLES t_permanent_myisam WRITE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UNLOCK TABLES; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +connection backup; +BACKUP STAGE BLOCK_COMMIT; +connection con11; +# Between BACKUP BLOCK_COMMIT FLUSH and END: +# Connection con11 not holding the backup lock cannot +# LOCK WRITE transactional or non transactional table. +LOCK TABLES t_permanent_innodb READ; +LOCK TABLES t_permanent_myisam READ; +LOCK TABLES t_permanent_innodb WRITE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +LOCK TABLES t_permanent_myisam WRITE; +ERROR HY000: Lock wait timeout exceeded; try restarting transaction +UNLOCK TABLES; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +connection backup; +BACKUP STAGE END; +DROP TABLE t_permanent_innodb; +DROP TABLE t_permanent_myisam; +# +# Log tables +# +connection backup; +SET @old_general_log = @@general_log; +SET @old_slow_query_log = @@slow_query_log; +SET @old_log_output = @@log_output; +SET GLOBAL log_output = 'TABLE'; +SET GLOBAL general_log = ON; +SET GLOBAL slow_query_log = ON; +connection con11; +SET @old_long_query_time = @@SESSION.long_query_time; +SET SESSION long_query_time = 0; +connection backup; +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +connection con11; +SELECT 1; +1 +1 +connection backup; +SELECT 1; +1 +1 +connection con11; +SET SESSION long_query_time = @old_long_query_time; +connection backup; +BACKUP STAGE END; +SET GLOBAL log_output = @old_log_output; +SET GLOBAL slow_query_log = @old_slow_query_log; +SET GLOBAL general_log = @old_general_log; +#----------------------------------------------------------------------- +# Cleanup +#----------------------------------------------------------------------- +SET GLOBAL lock_wait_timeout = ; +disconnect con2; +disconnect con11; +disconnect con12; +disconnect backup; +connection default; diff --git a/mysql-test/main/backup_stages.test b/mysql-test/main/backup_stages.test new file mode 100644 index 00000000000..ba9c15a1d7e --- /dev/null +++ b/mysql-test/main/backup_stages.test @@ -0,0 +1,385 @@ +######################################################################## +# Test what is locked in each stage for LOCK FOR BACKUP (MDEV-5336) +######################################################################## + +--source include/not_embedded.inc +# A transactional engine +--source include/have_innodb.inc +--source include/have_metadata_lock_info.inc +# As non transactional engine we have MyISAM anyway. + +# Save the initial number of concurrent sessions. +--source include/count_sessions.inc + +let $old_lock_wait_timeout = `SELECT @@global.lock_wait_timeout`; + +--echo #----------------------------------------------------------------------- +--echo # Multi-threaded tests +--echo #----------------------------------------------------------------------- +--echo # Show that only one connection can hold the backup lock. + +--connection default +let $default_id= `SELECT CONNECTION_ID()`; +BACKUP STAGE START; + +# con1, root high privileged user +--connect(con1,localhost,root,,) +let $con1_id= `SELECT CONNECTION_ID()`; +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR BACKUP STAGE START; +send BACKUP STAGE START; +--connection default + +--echo # Show that the connection con1 has to wait for the backup lock and the +--echo # corresponding representation within the processlist. + +--replace_result $con1_id + +eval SET @con1_id = $con1_id; +# Output expected here is +# ID USER COMMAND STATE INFO INFO_BINARY +# root Query Waiting for backup lock BACKUP STAGE START BACKUP STAGE START +let $wait_condition= + SELECT COUNT(*) = 1 FROM INFORMATION_SCHEMA.PROCESSLIST + WHERE STATE = "Waiting for backup lock" and INFO = "BACKUP STAGE START"; +--source include/wait_condition.inc +--replace_column 1 +eval +SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY +FROM information_schema.processlist WHERE id = @con1_id; +# con1 uses @@global.lock_wait_timeout + +BACKUP STAGE END; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; + +--connection con1 +--echo # The connection default has removed the backup lock. +--echo # And so the current connection con1 can reap for its BACKUP STAGE START +--reap + +# con2, root high privileged user +--connect(con2,localhost,root,,) +let $con2_id= `SELECT CONNECTION_ID()`; +--echo # The connection con2 cannot continue the work of con1 by setting the +--echo # next BACKUP STAGE FLUSH. +--error ER_BACKUP_NOT_RUNNING +BACKUP STAGE FLUSH; +send +BACKUP STAGE START; + +--connection default +--replace_result $con2_id +eval SET @con2_id = $con2_id; +--echo # Connection con2 waits for the backup lock held by con1. +--source include/wait_condition.inc +--replace_column 1 +eval +SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY +FROM information_schema.processlist WHERE id = @con2_id; + +--disconnect con1 + +--connection con2 +--echo # Connection con1 frees the backup lock held by disconnecting. +--echo # So connection con2 gets the backup lock. +--reap + +--connect(con3,localhost,root,,) +let $con3_id= `SELECT CONNECTION_ID()`; +send +BACKUP STAGE START; + +--connection default +--replace_result $con3_id +eval SET @con3_id = $con3_id; +--echo # Connection con3 waits for the backup lock held by con2. +--source include/wait_condition.inc +--replace_column 1 +eval +SELECT ID, USER, COMMAND, STATE, INFO, STAGE, MAX_STAGE, INFO_BINARY +FROM information_schema.processlist WHERE id = @con3_id; +KILL CONNECTION @con2_id; + +--connection con3 +--echo # Connection con2 frees the backup lock held by getting killed. +--echo # So connection con3 gets the backup lock. +--reap +BACKUP STAGE END; +disconnect con3; +--connection default + +CREATE TABLE t_permanent_innodb (col1 INT) ENGINE = InnoDB; +INSERT INTO t_permanent_innodb SET col1 = 1; +CREATE TABLE t_permanent_myisam (col1 INT) ENGINE = MyISAM; +INSERT INTO t_permanent_myisam SET col1 = 1; + +# backup : Try the BACKUP STAGE sequence +# con11 : Try DDL + DML with AUTOCOMMIT = 0 +# con12 : Try DML with AUTOCOMMIT = 1 +--connect(backup,localhost,root,,) +--connect(con11,localhost,root,,) +SET AUTOCOMMIT = 0; +set session lock_wait_timeout=0; +--connect(con12,localhost,root,,) +SET AUTOCOMMIT = 1; + +--echo # Between (connection default) BACKUP STAGE START and FLUSH +--echo # no restrictions for concurrent sessions regarding DDL or DML +--echo # affecting transactional/non transactional permanent tables. + +--connection backup +BACKUP STAGE START; +--connection con11 +UPDATE t_permanent_innodb SET col1 = 2; +UPDATE t_permanent_myisam SET col1 = 2; +SELECT COUNT(*) FROM t_permanent_innodb; +HANDLER t_permanent_innodb OPEN; +HANDLER t_permanent_innodb READ FIRST; +HANDLER t_permanent_innodb CLOSE; +SELECT COUNT(*) FROM t_permanent_myisam; +HANDLER t_permanent_myisam OPEN; +HANDLER t_permanent_myisam READ FIRST; +HANDLER t_permanent_myisam CLOSE; +CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t_con1_myisam (col1 INT) ENGINE = InnoDB; +ALTER TABLE t_permanent_innodb ADD COLUMN col2 INT; +ALTER TABLE t_permanent_myisam ADD COLUMN col2 INT; +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb; +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam; +--connection con12 +UPDATE t_permanent_innodb SET col1 = 3; +UPDATE t_permanent_myisam SET col1 = 3; + +--echo # Between (connection default) BACKUP STAGE FLUSH and BLOCK_DDL +--echo # concurrent sessions +--echo # - can change transactional permanent tables with DDL and DML +--echo # - can run DROP/CREATE transactional/non transactional TABLE +--echo # - cannot modify non transactional permanent tables with DDL or DML + +--connection backup +BACKUP STAGE FLUSH; +--connection con11 +UPDATE t_permanent_innodb SET col1 = 4; +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR UPDATE t_permanent_myisam SET col1 = 4; +SELECT COUNT(*) FROM t_permanent_innodb; +HANDLER t_permanent_innodb OPEN; +HANDLER t_permanent_innodb READ FIRST; +HANDLER t_permanent_innodb CLOSE; +SELECT COUNT(*) FROM t_permanent_myisam; +HANDLER t_permanent_myisam OPEN; +HANDLER t_permanent_myisam READ FIRST; +HANDLER t_permanent_myisam CLOSE; +DROP TABLE t_con1_innodb; +DROP TABLE t_con1_myisam; +CREATE TABLE t_con1_innodb (col1 INT) ENGINE = InnoDB; +CREATE TABLE t_con1_myisam (col1 INT) ENGINE = InnoDB; +ALTER TABLE t_permanent_innodb ADD COLUMN col3 INT; +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR ALTER TABLE t_permanent_myisam ADD COLUMN col3 INT; +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb; +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam; +--connection con12 +UPDATE t_permanent_innodb SET col1 = 5; + + +--echo # Between (connection default) BACKUP STAGE BLOCK_DDL and BLOCK_COMMIT +--echo # concurrent sessions +--echo # - can change transactional permanent tables with DML +--echo # - cannot run DDL +--echo # - cannot change non transactional permanent tables with DML + +--connection backup +BACKUP STAGE BLOCK_DDL; +--connection con11 + +UPDATE t_permanent_innodb SET col1 = 6; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t_permanent_myisam SET col1 = 6; +SELECT COUNT(*) FROM t_permanent_innodb; +HANDLER t_permanent_innodb OPEN; +HANDLER t_permanent_innodb READ FIRST; +HANDLER t_permanent_innodb CLOSE; +SELECT COUNT(*) FROM t_permanent_myisam; +HANDLER t_permanent_myisam OPEN; +HANDLER t_permanent_myisam READ FIRST; +HANDLER t_permanent_myisam CLOSE; +--error ER_LOCK_WAIT_TIMEOUT +DROP TABLE t_con1_innodb; +--error ER_LOCK_WAIT_TIMEOUT +CREATE TABLE throw_away (col1 INT) ENGINE = InnoDB; +--error ER_LOCK_WAIT_TIMEOUT +ALTER TABLE t_permanent_innodb ADD COLUMN col4 INT; +--error ER_LOCK_WAIT_TIMEOUT +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_innodb; +--error ER_LOCK_WAIT_TIMEOUT +CREATE OR REPLACE VIEW v_some_view AS SELECT * FROM t_permanent_myisam; +--connection con12 +UPDATE t_permanent_innodb SET col1 = 7; + + +--echo # Between (connection default) BACKUP STAGE BLOCK_COMMIT and END +--echo # concurrent sessions +--echo # - can change transactional permanent tables with DML +--echo # - cannot run DDL +--echo # - cannot change non transactional permanent tables with DML + +--connection backup +BACKUP STAGE BLOCK_COMMIT; +--connection con11 +UPDATE t_permanent_innodb SET col1 = 8; +--error ER_LOCK_WAIT_TIMEOUT +UPDATE t_permanent_myisam SET col1 = 8; +SELECT COUNT(*) FROM t_permanent_innodb; +HANDLER t_permanent_innodb OPEN; +HANDLER t_permanent_innodb READ FIRST; +HANDLER t_permanent_innodb CLOSE; +SELECT COUNT(*) FROM t_permanent_myisam; +HANDLER t_permanent_myisam OPEN; +HANDLER t_permanent_myisam READ FIRST; +HANDLER t_permanent_myisam CLOSE; +--error ER_LOCK_WAIT_TIMEOUT +DROP TABLE t_con1_innodb; +--error ER_LOCK_WAIT_TIMEOUT +DROP TABLE t_con1_myisam; +--connection con12 +--error ER_LOCK_WAIT_TIMEOUT +SET STATEMENT lock_wait_timeout=0 FOR UPDATE t_permanent_innodb SET col1 = 9; + +--connection backup +BACKUP STAGE END; +--connection con11 +COMMIT; +SELECT * FROM t_permanent_innodb ORDER BY col1; +SELECT * FROM t_permanent_myisam ORDER BY col1; +SET AUTOCOMMIT = 0; +SET GLOBAL tx_read_only = 1; +--connection con12 +BACKUP STAGE START; +BACKUP STAGE END; +SET GLOBAL tx_read_only = 0; +DROP VIEW v_some_view; +DROP TABLE t_con1_innodb; +DROP TABLE t_con1_myisam; + +--echo # Connection backup holds the backup log and is on some stage. +--echo # Connection con11 tries to LOCK TABLEs or to set read_only. + +--connection backup +BACKUP STAGE START; +--connection con11 +--echo # Between BACKUP STAGE START and FLUSH: +--echo # No restrictions for other connection around LOCK TABLES or read-only. +LOCK TABLES t_permanent_innodb READ; +LOCK TABLES t_permanent_myisam READ; +LOCK TABLES t_permanent_innodb WRITE; +LOCK TABLES t_permanent_myisam WRITE; +UNLOCK TABLES; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +--connection backup +BACKUP STAGE FLUSH; +--connection con11 +--echo # Between BACKUP STAGE FLUSH and BLOCK_COMMIT: +--echo # Connection con11 not holding the backup lock cannot +--echo # LOCK WRITE non transactional table. +LOCK TABLES t_permanent_innodb READ; +LOCK TABLES t_permanent_myisam READ; +LOCK TABLES t_permanent_innodb WRITE; +--error ER_LOCK_WAIT_TIMEOUT +LOCK TABLES t_permanent_myisam WRITE; +UNLOCK TABLES; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +--connection backup +BACKUP STAGE BLOCK_DDL; +--connection con11 +--echo # Between BACKUP STAGE FLUSH and BLOCK_COMMIT: +--echo # Connection con11 not holding the backup lock cannot +--echo # LOCK WRITE transactional or non transactional table. +LOCK TABLES t_permanent_innodb READ; +LOCK TABLES t_permanent_myisam READ; +--error ER_LOCK_WAIT_TIMEOUT +LOCK TABLES t_permanent_innodb WRITE; +--error ER_LOCK_WAIT_TIMEOUT +LOCK TABLES t_permanent_myisam WRITE; +UNLOCK TABLES; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +--connection backup +BACKUP STAGE BLOCK_COMMIT; +--connection con11 +--echo # Between BACKUP BLOCK_COMMIT FLUSH and END: +--echo # Connection con11 not holding the backup lock cannot +--echo # LOCK WRITE transactional or non transactional table. +LOCK TABLES t_permanent_innodb READ; +LOCK TABLES t_permanent_myisam READ; +--error ER_LOCK_WAIT_TIMEOUT +LOCK TABLES t_permanent_innodb WRITE; +--error ER_LOCK_WAIT_TIMEOUT +LOCK TABLES t_permanent_myisam WRITE; +UNLOCK TABLES; +SET GLOBAL tx_read_only = 1; +SET GLOBAL tx_read_only = 0; +--connection backup +BACKUP STAGE END; + +DROP TABLE t_permanent_innodb; +DROP TABLE t_permanent_myisam; + +--echo # +--echo # Log tables +--echo # + +--connection backup + +SET @old_general_log = @@general_log; +SET @old_slow_query_log = @@slow_query_log; +SET @old_log_output = @@log_output; + +SET GLOBAL log_output = 'TABLE'; +SET GLOBAL general_log = ON; +SET GLOBAL slow_query_log = ON; + + +--connection con11 +SET @old_long_query_time = @@SESSION.long_query_time; +SET SESSION long_query_time = 0; + +--connection backup +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; + +--connection con11 +SELECT 1; + +--connection backup +SELECT 1; + +--connection con11 +SET SESSION long_query_time = @old_long_query_time; + +--connection backup +BACKUP STAGE END; + +SET GLOBAL log_output = @old_log_output; +SET GLOBAL slow_query_log = @old_slow_query_log; +SET GLOBAL general_log = @old_general_log; + +--echo #----------------------------------------------------------------------- +--echo # Cleanup +--echo #----------------------------------------------------------------------- + +--replace_result $old_lock_wait_timeout +eval +SET GLOBAL lock_wait_timeout = $old_lock_wait_timeout; + +--disconnect con2 +--disconnect con11 +--disconnect con12 +--disconnect backup + +--connection default +--source include/wait_until_count_sessions.inc diff --git a/mysql-test/main/backup_syntax.result b/mysql-test/main/backup_syntax.result new file mode 100644 index 00000000000..4b8e74edd57 --- /dev/null +++ b/mysql-test/main/backup_syntax.result @@ -0,0 +1,163 @@ +#----------------------------------------------------------------------- +# Basic syntax checks +#----------------------------------------------------------------------- +# Check existing BACKUP STAGE statements in the sequence to be used. +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +# Check invalid variants of BACKUP .... syntax. +BACKUP LOG; +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 'LOG' at line 1 +BACKUP LOCK; +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 '' at line 1 +BACKUP STAGE; +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 '' at line 1 +BACKUP STAGE LOCK; +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 'LOCK' at line 1 +BACKUP STAGE not_existing; +ERROR HY000: Unknown backup stage: 'not_existing'. Stage should be one of START, FLUSH, BLOCK_DDL, BLOCK_COMMIT or END +#----------------------------------------------------------------------- +# BACKUP STAGE statements in various orders. +#----------------------------------------------------------------------- +# All BACKUP STAGE statements != 'BACKUP STAGE START' expect that a +# backup lock (generated by BACKUP STAGE START) already exists. +# +backup stage start; +backup stage flush; +backup stage start; +ERROR HY000: Backup stage 'START' is same or before current backup stage 'FLUSH' +backup stage start; +ERROR HY000: Backup stage 'START' is same or before current backup stage 'FLUSH' +backup stage block_commit; +backup stage flush; +ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_COMMIT' +backup stage flush; +ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_COMMIT' +backup stage end; +backup stage flush; +ERROR HY000: You must start backup with "BACKUP STAGE START" +BACKUP STAGE END; +ERROR HY000: You must start backup with "BACKUP STAGE START" +BACKUP STAGE BLOCK_COMMIT; +ERROR HY000: You must start backup with "BACKUP STAGE START" +BACKUP STAGE BLOCK_DDL; +ERROR HY000: You must start backup with "BACKUP STAGE START" +BACKUP STAGE FLUSH; +ERROR HY000: You must start backup with "BACKUP STAGE START" +# Ordered "give up" with 'BACKUP STAGE END' because of whatever reason. +# Some existing backup lock assumed a 'BACKUP STAGE END' is allowed in +# every situation. +BACKUP STAGE START; +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +# Orders with BACKUP STAGE FLUSH omitted. +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +# Orders with BACKUP STAGE BLOCK_DDL omitted. +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +# Orders with BACKUP STAGE BLOCK_COMMIT omitted. +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +# Orders with doubled BACKUP STAGE statements. +# We get an error but that seems to have no bad impact on the state. +# And so we are allowed to go on with BACKUP STAGE statements. +BACKUP STAGE START; +BACKUP STAGE START; +ERROR HY000: Backup stage 'START' is same or before current backup stage 'START' +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE FLUSH; +ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'FLUSH' +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_DDL; +ERROR HY000: Backup stage 'BLOCK_DDL' is same or before current backup stage 'BLOCK_DDL' +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE BLOCK_COMMIT; +ERROR HY000: Backup stage 'BLOCK_COMMIT' is same or before current backup stage 'BLOCK_COMMIT' +BACKUP STAGE END; +# Scrambled orders. +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE START; +ERROR HY000: Backup stage 'START' is same or before current backup stage 'FLUSH' +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE START; +ERROR HY000: Backup stage 'START' is same or before current backup stage 'BLOCK_DDL' +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE START; +ERROR HY000: Backup stage 'START' is same or before current backup stage 'BLOCK_COMMIT' +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE FLUSH; +ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_DDL' +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE FLUSH; +ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_COMMIT' +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE BLOCK_DDL; +ERROR HY000: Backup stage 'BLOCK_DDL' is same or before current backup stage 'BLOCK_COMMIT' +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE FLUSH; +ERROR HY000: Backup stage 'FLUSH' is same or before current backup stage 'BLOCK_DDL' +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +#---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE BLOCK_DDL; +ERROR HY000: Backup stage 'BLOCK_DDL' is same or before current backup stage 'BLOCK_COMMIT' +BACKUP STAGE END; +# +# Check Oracle syntax +# +set SQL_MODE=Oracle; +backup stage start; +backup stage end; +set SQL_MODE=default; diff --git a/mysql-test/main/backup_syntax.test b/mysql-test/main/backup_syntax.test new file mode 100644 index 00000000000..f02c69bdd85 --- /dev/null +++ b/mysql-test/main/backup_syntax.test @@ -0,0 +1,181 @@ +######################################################################## +# Tests things releated to syntax of BACKUP STAGE (MDEV-5336) +######################################################################## + +--source include/have_innodb.inc +--source include/have_metadata_lock_info.inc + +--echo #----------------------------------------------------------------------- +--echo # Basic syntax checks +--echo #----------------------------------------------------------------------- + +--echo # Check existing BACKUP STAGE statements in the sequence to be used. +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; + +--echo # Check invalid variants of BACKUP .... syntax. +--error ER_PARSE_ERROR +BACKUP LOG; +--error ER_PARSE_ERROR +BACKUP LOCK; +--error ER_PARSE_ERROR +BACKUP STAGE; +--error ER_PARSE_ERROR +BACKUP STAGE LOCK; +--error ER_BACKUP_UNKNOWN_STAGE +BACKUP STAGE not_existing; + +--echo #----------------------------------------------------------------------- +--echo # BACKUP STAGE statements in various orders. +--echo #----------------------------------------------------------------------- +--echo # All BACKUP STAGE statements != 'BACKUP STAGE START' expect that a +--echo # backup lock (generated by BACKUP STAGE START) already exists. +--echo # + +backup stage start; +backup stage flush; +--error ER_BACKUP_WRONG_STAGE +backup stage start; +--error ER_BACKUP_WRONG_STAGE +backup stage start; +backup stage block_commit; +--error ER_BACKUP_WRONG_STAGE +backup stage flush; +--error ER_BACKUP_WRONG_STAGE +backup stage flush; +backup stage end; +--error ER_BACKUP_NOT_RUNNING +backup stage flush; +--error ER_BACKUP_NOT_RUNNING +BACKUP STAGE END; +--error ER_BACKUP_NOT_RUNNING +BACKUP STAGE BLOCK_COMMIT; +--error ER_BACKUP_NOT_RUNNING +BACKUP STAGE BLOCK_DDL; +--error ER_BACKUP_NOT_RUNNING +BACKUP STAGE FLUSH; + +--echo # Ordered "give up" with 'BACKUP STAGE END' because of whatever reason. +--echo # Some existing backup lock assumed a 'BACKUP STAGE END' is allowed in +--echo # every situation. + +BACKUP STAGE START; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +--echo # Orders with BACKUP STAGE FLUSH omitted. +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +--echo # Orders with BACKUP STAGE BLOCK_DDL omitted. +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +--echo # Orders with BACKUP STAGE BLOCK_COMMIT omitted. +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; + +--echo # Orders with doubled BACKUP STAGE statements. +--echo # We get an error but that seems to have no bad impact on the state. +--echo # And so we are allowed to go on with BACKUP STAGE statements. + +BACKUP STAGE START; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE FLUSH; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; + +--echo # Scrambled orders. +BACKUP STAGE START; +BACKUP STAGE FLUSH; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE START; +BACKUP STAGE BLOCK_COMMIT; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE START; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_COMMIT; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE FLUSH; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE BLOCK_COMMIT; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE BLOCK_DDL; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_COMMIT; +BACKUP STAGE END; +--echo #---- +BACKUP STAGE START; +BACKUP STAGE FLUSH; +BACKUP STAGE BLOCK_COMMIT; +--error ER_BACKUP_WRONG_STAGE +BACKUP STAGE BLOCK_DDL; +BACKUP STAGE END; + +--echo # +--echo # Check Oracle syntax +--echo # + +set SQL_MODE=Oracle; +backup stage start; +backup stage end; +set SQL_MODE=default; diff --git a/mysql-test/main/bigint.result b/mysql-test/main/bigint.result index 8f4b287ab21..6e0384182fe 100644 --- a/mysql-test/main/bigint.result +++ b/mysql-test/main/bigint.result @@ -510,3 +510,14 @@ DROP TABLE t1; SELECT 100 BETWEEN 1 AND 9223372036854775808; 100 BETWEEN 1 AND 9223372036854775808 1 +# +# MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615 +# +CREATE TABLE t1 (c1 bigint(20) unsigned NOT NULL); +INSERT INTO t1 VALUES (0),(101),(255); +SELECT * FROM t1 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1; +c1 +0 +101 +255 +DROP TABLE t1; diff --git a/mysql-test/main/bigint.test b/mysql-test/main/bigint.test index ae325c7d7de..68ffcd9230e 100644 --- a/mysql-test/main/bigint.test +++ b/mysql-test/main/bigint.test @@ -416,3 +416,12 @@ DROP TABLE t1; --echo # MDEV-9372 select 100 between 1 and 9223372036854775808 returns false --echo # SELECT 100 BETWEEN 1 AND 9223372036854775808; + +--echo # +--echo # MDEV-17724 Wrong result for BETWEEN 0 AND 18446744073709551615 +--echo # + +CREATE TABLE t1 (c1 bigint(20) unsigned NOT NULL); +INSERT INTO t1 VALUES (0),(101),(255); +SELECT * FROM t1 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1; +DROP TABLE t1; diff --git a/mysql-test/main/brackets.result b/mysql-test/main/brackets.result index 479b74b69e4..e789cdeff76 100644 --- a/mysql-test/main/brackets.result +++ b/mysql-test/main/brackets.result @@ -219,4 +219,28 @@ select 1 union select 1 union select 1; ((select 1) union (select 1) union (select 1)); 1 1 +# +# MDEV-16357: union in brackets with tail +# union with tail in brackets +# +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES(1),(2),(3),(4); +CREATE TABLE t2 (a int); +INSERT INTO t2 VALUES (4),(5),(6),(7); +(SELECT a FROM t1 UNION SELECT a FROM t2) LIMIT 1; +a +1 +(SELECT a FROM t1 UNION SELECT a FROM t2) ORDER BY a DESC; +a +7 +6 +5 +4 +3 +2 +1 +(SELECT a FROM t1 UNION SELECT a FROM t2 LIMIT 1); +a +1 +DROP TABLE t1,t2; # End of 10.4 tests diff --git a/mysql-test/main/brackets.test b/mysql-test/main/brackets.test index 699c70a900f..0eaa3bfc0a2 100644 --- a/mysql-test/main/brackets.test +++ b/mysql-test/main/brackets.test @@ -88,5 +88,23 @@ select 1 union select 1 union select 1; (select 1 union select 1 union select 1); ((select 1) union (select 1) union (select 1)); +--echo # +--echo # MDEV-16357: union in brackets with tail +--echo # union with tail in brackets +--echo # + +CREATE TABLE t1 (a int); +INSERT INTO t1 VALUES(1),(2),(3),(4); + +CREATE TABLE t2 (a int); +INSERT INTO t2 VALUES (4),(5),(6),(7); + +(SELECT a FROM t1 UNION SELECT a FROM t2) LIMIT 1; +(SELECT a FROM t1 UNION SELECT a FROM t2) ORDER BY a DESC; + +(SELECT a FROM t1 UNION SELECT a FROM t2 LIMIT 1); + +DROP TABLE t1,t2; + --echo # End of 10.4 tests diff --git a/mysql-test/main/case.result b/mysql-test/main/case.result index 1fd1ad86a8e..926ac000eb0 100644 --- a/mysql-test/main/case.result +++ b/mysql-test/main/case.result @@ -546,5 +546,32 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'a' DROP TABLE t1; # +# MDEV-17411 Wrong WHERE optimization with simple CASE and searched CASE +# +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 VALUES (1,1),(2,2),(3,3); +SELECT * FROM t1 WHERE CASE a WHEN b THEN 1 END=1; +a b +1 1 +2 2 +3 3 +SELECT * FROM t1 WHERE CASE WHEN a THEN b ELSE 1 END=3; +a b +3 3 +SELECT * FROM t1 WHERE +CASE a WHEN b THEN 1 END=1 AND +CASE WHEN a THEN b ELSE 1 END=3; +a b +3 3 +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE +CASE a WHEN b THEN 1 END=1 AND +CASE WHEN a THEN b ELSE 1 END=3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (case `test`.`t1`.`a` when `test`.`t1`.`b` then 1 end) = 1 and (case when `test`.`t1`.`a` then `test`.`t1`.`b` else 1 end) = 3 +DROP TABLE t1; +# # End of 10.3 test # diff --git a/mysql-test/main/case.test b/mysql-test/main/case.test index d7dac112b3b..78d5b3a5951 100644 --- a/mysql-test/main/case.test +++ b/mysql-test/main/case.test @@ -390,6 +390,28 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='a' AND CASE 'a' WHEN 'a' THEN 'a' ELS DROP TABLE t1; + +--echo # +--echo # MDEV-17411 Wrong WHERE optimization with simple CASE and searched CASE +--echo # + +CREATE TABLE t1 (a INT, b INT, KEY(a)); +INSERT INTO t1 VALUES (1,1),(2,2),(3,3); +SELECT * FROM t1 WHERE CASE a WHEN b THEN 1 END=1; +SELECT * FROM t1 WHERE CASE WHEN a THEN b ELSE 1 END=3; + +SELECT * FROM t1 WHERE + CASE a WHEN b THEN 1 END=1 AND + CASE WHEN a THEN b ELSE 1 END=3; + +EXPLAIN EXTENDED +SELECT * FROM t1 WHERE + CASE a WHEN b THEN 1 END=1 AND + CASE WHEN a THEN b ELSE 1 END=3; + +DROP TABLE t1; + + --echo # --echo # End of 10.3 test --echo # diff --git a/mysql-test/main/cast.result b/mysql-test/main/cast.result index ca314573581..f1e7eb7b502 100644 --- a/mysql-test/main/cast.result +++ b/mysql-test/main/cast.result @@ -313,7 +313,7 @@ select cast('' as time); cast('' as time) NULL Warnings: -Warning 1292 Truncated incorrect time value: '' +Warning 1292 Incorrect time value: '' select cast(NULL as DATE); cast(NULL as DATE) NULL diff --git a/mysql-test/main/check.result b/mysql-test/main/check.result index e3dcda773f4..e882a4cdbe6 100644 --- a/mysql-test/main/check.result +++ b/mysql-test/main/check.result @@ -85,3 +85,13 @@ t1 CREATE TABLE `t1` ( `c` int(11) DEFAULT NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; +create temporary table t1 ( +id int not null auto_increment primary key, +f int not null default 0 +); +insert into t1 () values (); +alter ignore table t1 add constraint check (f > 0); +Warnings: +Warning 4025 CONSTRAINT `CONSTRAINT_1` failed for `test`.`t1` +alter table t1; +drop table t1; diff --git a/mysql-test/main/check.test b/mysql-test/main/check.test index cce8fd34c9c..475a7996a09 100644 --- a/mysql-test/main/check.test +++ b/mysql-test/main/check.test @@ -103,3 +103,15 @@ CREATE OR REPLACE TABLE t1 (a INT, b INT, c INT, CHECK (a+b>0)) ENGINE=MyISAM; ALTER TABLE t1 DROP COLUMN b, DROP CONSTRAINT `CONSTRAINT_1`; SHOW CREATE TABLE t1; DROP TABLE t1; + +# +# MDEV-16903 Assertion `!auto_increment_field_not_null' failed in TABLE::init after unsuccessful attempt to add CHECK constraint on temporary table +# +create temporary table t1 ( + id int not null auto_increment primary key, + f int not null default 0 +); +insert into t1 () values (); +alter ignore table t1 add constraint check (f > 0); +alter table t1; +drop table t1; diff --git a/mysql-test/main/column_compression_parts.result b/mysql-test/main/column_compression_parts.result index e0b54aec20c..bc3028826ee 100644 --- a/mysql-test/main/column_compression_parts.result +++ b/mysql-test/main/column_compression_parts.result @@ -12,6 +12,7 @@ INSERT INTO t1 VALUES (1,REPEAT('a',100)),(2,REPEAT('v',200)),(3,REPEAT('r',300) INSERT INTO t1 VALUES (5,REPEAT('k',500)),(6,'April'),(7,7),(8,""),(9,"M"),(10,DEFAULT); ALTER TABLE t1 ANALYZE PARTITION p1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK ALTER TABLE t1 CHECK PARTITION p2; Table Op Msg_type Msg_text diff --git a/mysql-test/main/column_compression_parts.test b/mysql-test/main/column_compression_parts.test index 9a6f63d0cde..4c77a7308f7 100644 --- a/mysql-test/main/column_compression_parts.test +++ b/mysql-test/main/column_compression_parts.test @@ -179,4 +179,4 @@ ALTER TABLE t1 REORGANIZE PARTITION p2 INTO (PARTITION p22 VALUES LESS THAN (MAX SHOW CREATE TABLE t1; ALTER TABLE t1 REBUILD PARTITION p22; -DROP TABLE t1; \ No newline at end of file +DROP TABLE t1; diff --git a/mysql-test/main/connect.result b/mysql-test/main/connect.result index dccd9e7dc10..89e10d221d2 100644 --- a/mysql-test/main/connect.result +++ b/mysql-test/main/connect.result @@ -1,5 +1,4 @@ SET global secure_auth=0; -drop table if exists t1,t2; connect con1,localhost,root,,mysql; show tables; Tables_in_mysql @@ -9,6 +8,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -56,6 +56,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -98,11 +99,18 @@ ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET); connect fail_con,localhost,test,zorro,; ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) -update mysql.user set password=old_password("gambling2") where user=_binary"test"; +update mysql.user set plugin="", authentication_string="", password=old_password("gambling2") where user=_binary"test"; flush privileges; +show grants for test@localhost; +Grants for test@localhost +GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '2f27438961437573' +update mysql.user set plugin='mysql_old_password' where user='test'; +flush privileges; +show grants for test@localhost; +Grants for test@localhost +GRANT ALL PRIVILEGES ON *.* TO 'test'@'localhost' IDENTIFIED BY PASSWORD '2f27438961437573' connect con10,localhost,test,gambling2,; connect con5,localhost,test,gambling2,mysql; -connection con5; set password=""; set password='gambling3'; ERROR HY000: Password hash should be a 41-digit hexadecimal number @@ -115,6 +123,7 @@ db event func general_log +global_priv_bak gtid_slave_pos help_category help_keyword @@ -139,6 +148,7 @@ time_zone_transition time_zone_transition_type transaction_registry user +user_bak connect con6,localhost,test,gambling3,test; show tables; Tables_in_test @@ -159,9 +169,7 @@ connect(localhost,test,zorro,test,MASTER_PORT,MASTER_SOCKET); connect fail_con,localhost,test,zorro,; ERROR 28000: Access denied for user 'test'@'localhost' (using password: YES) delete from mysql.user where user=_binary"test"; -flush privileges; connect con7,localhost,root,,test; -connection con7; create table t1 (id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key); set @id := 1; @@ -302,12 +310,10 @@ SET GLOBAL event_scheduler = OFF; # -- End of Bug#35074. connect extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,; -connection extracon; SELECT 'Connection on extra port ok'; Connection on extra port ok Connection on extra port ok connect extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,; -connection extracon2; SELECT 'Connection on extra port 2 ok'; Connection on extra port 2 ok Connection on extra port 2 ok @@ -338,7 +344,6 @@ connect(localhost,mysqltest_up1,foo,test,MASTER_PORT,MASTER_SOCKET); connect pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,; ERROR 28000: Access denied for user 'mysqltest_up1'@'localhost' (using password: YES) connect pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,; -connection pcon2; select user(), current_user(); user() current_user() mysqltest_up1@localhost mysqltest_up1@% @@ -347,7 +352,6 @@ connect(localhost,mysqltest_up2,newpw,test,MASTER_PORT,MASTER_SOCKET); connect pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,; ERROR 28000: Access denied for user 'mysqltest_up2'@'localhost' (using password: YES) connect pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,; -connection pcon4; select user(), current_user(); user() current_user() mysqltest_up2@localhost mysqltest_up2@% @@ -364,17 +368,15 @@ update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2'; select user, password, plugin, authentication_string from mysql.user where user like 'mysqltest_up_'; user password plugin authentication_string -mysqltest_up1 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password -mysqltest_up2 09301740536db389 mysql_old_password +mysqltest_up1 *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB mysql_native_password *E8D46CE25265E545D225A8A6F1BAF642FEBEE5CB +mysqltest_up2 09301740536db389 mysql_old_password 09301740536db389 flush privileges; connect pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,; -connection pcon6; select user(), current_user(); user() current_user() mysqltest_up1@localhost mysqltest_up1@% disconnect pcon6; connect pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,; -connection pcon7; select user(), current_user(); user() current_user() mysqltest_up2@localhost mysqltest_up2@% @@ -383,7 +385,7 @@ connection default; DROP USER mysqltest_up1@'%'; DROP USER mysqltest_up2@'%'; # -# BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore +# BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore # create table t1 (via int); alter table t1 add key(via); @@ -391,7 +393,6 @@ drop table t1; create table t1 (col1 int); alter table t1 add via int not null; drop table t1; -drop procedure if exists p1; create procedure p1(x int) foo: loop if x = 0 then diff --git a/mysql-test/main/connect.test b/mysql-test/main/connect.test index c2d44c08e22..b0461a5afac 100644 --- a/mysql-test/main/connect.test +++ b/mysql-test/main/connect.test @@ -14,10 +14,6 @@ SET global secure_auth=0; ---disable_warnings -drop table if exists t1,t2; ---enable_warnings - #connect (con1,localhost,root,,""); #show tables; connect (con1,localhost,root,,mysql); @@ -66,12 +62,16 @@ connect (fail_con,localhost,test,zorro,test2); connect (fail_con,localhost,test,zorro,); # check if old password version also works -update mysql.user set password=old_password("gambling2") where user=_binary"test"; +source include/switch_to_mysql_user.inc; +update mysql.user set plugin="", authentication_string="", password=old_password("gambling2") where user=_binary"test"; flush privileges; +show grants for test@localhost; +update mysql.user set plugin='mysql_old_password' where user='test'; +flush privileges; +show grants for test@localhost; connect (con10,localhost,test,gambling2,); connect (con5,localhost,test,gambling2,mysql); -connection con5; set password=""; --error ER_PASSWD_LENGTH set password='gambling3'; @@ -98,17 +98,15 @@ connect (fail_con,localhost,test,zorro,test2); --error ER_ACCESS_DENIED_ERROR connect (fail_con,localhost,test,zorro,); - +source include/switch_to_mysql_global_priv.inc; # remove user 'test' so that other tests which may use 'test' # do not depend on this test. delete from mysql.user where user=_binary"test"; -flush privileges; # # Bug#12517 Clear user variables and replication events before # closing temp tables in thread cleanup. connect (con7,localhost,root,,test); -connection con7; let $connection_id= `select connection_id()`; create table t1 (id integer not null auto_increment primary key); create temporary table t2(id integer not null auto_increment primary key); @@ -253,11 +251,8 @@ let $wait_condition = --echo --echo # -- Waiting for connections to close... -let $wait_condition = - SELECT COUNT(*) = 1 - FROM information_schema.processlist - WHERE db = 'test'; ---source include/wait_condition.inc +let $count_sessions=1; +--source include/wait_until_count_sessions.inc --echo DROP USER mysqltest_u1@localhost; @@ -314,11 +309,9 @@ SET GLOBAL event_scheduler = OFF; # Test connections to the extra port. connect(extracon,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); -connection extracon; SELECT 'Connection on extra port ok'; connect(extracon2,127.0.0.1,root,,test,$MASTER_EXTRA_PORT,); -connection extracon2; SELECT 'Connection on extra port 2 ok'; --disable_abort_on_error @@ -349,7 +342,6 @@ GRANT ALL ON test.* TO 'O1234567890123456789012345678901234567890123456789012345 FLUSH PRIVILEGES; ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT connect (con1,localhost,O1234567890123456789012345678901234567890123456789012345678901234567890123456789x,test123,test); disconnect con1; @@ -380,18 +372,14 @@ CREATE USER mysqltest_up2 IDENTIFIED VIA mysql_old_password using '09301740536db --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR connect(pcon1,localhost,mysqltest_up1,foo,,$MASTER_MYPORT,); ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT connect(pcon2,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,); -connection pcon2; select user(), current_user(); disconnect pcon2; --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR connect(pcon3,localhost,mysqltest_up2,newpw,,$MASTER_MYPORT,); ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT connect(pcon4,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,); -connection pcon4; select user(), current_user(); disconnect pcon4; @@ -415,34 +403,32 @@ connection default; # # cannot connect when password is set and plugin=mysql_native_password # +source include/switch_to_mysql_user.inc; update mysql.user set plugin='mysql_native_password' where user = 'mysqltest_up1'; update mysql.user set plugin='mysql_old_password' where user = 'mysqltest_up2'; select user, password, plugin, authentication_string from mysql.user where user like 'mysqltest_up_'; -flush privileges; +flush privileges; ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT connect(pcon6,localhost,mysqltest_up1,bar,,$MASTER_MYPORT,); -connection pcon6; select user(), current_user(); disconnect pcon6; ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT connect(pcon7,localhost,mysqltest_up2,oldpw,,$MASTER_MYPORT,); -connection pcon7; select user(), current_user(); disconnect pcon7; connection default; +source include/switch_to_mysql_global_priv.inc; + DROP USER mysqltest_up1@'%'; DROP USER mysqltest_up2@'%'; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc - --echo # ---echo # BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore +--echo # BUG#1010351: New "via" keyword in 5.2+ can't be used as identifier anymore --echo # create table t1 (via int); alter table t1 add key(via); @@ -452,10 +438,6 @@ create table t1 (col1 int); alter table t1 add via int not null; drop table t1; ---disable_warnings -drop procedure if exists p1; ---enable_warnings - delimiter |; create procedure p1(x int) foo: loop @@ -470,6 +452,4 @@ delimiter ;| call p1(2); drop procedure p1; - - SET global secure_auth=default; diff --git a/mysql-test/main/constraints.result b/mysql-test/main/constraints.result index 57cfbfb3d37..3c061989fd3 100644 --- a/mysql-test/main/constraints.result +++ b/mysql-test/main/constraints.result @@ -74,3 +74,40 @@ CREATE TABLE t_illegal (col_1 INT CHECK something (whatever)); 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 'something (whatever))' at line 1 CREATE TABLE t_illegal (col_1 INT CHECK something); 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 'something)' at line 1 +CREATE TABLE long_enough_name ( +pk int(11) NOT NULL, +f1 int(11) DEFAULT NULL, +f2 int(11) NOT NULL, +f3 int(11) DEFAULT NULL, +f4 timestamp NOT NULL DEFAULT current_timestamp(), +f5 varchar(32) COLLATE utf8_bin NOT NULL DEFAULT 'foo', +f6 smallint(6) NOT NULL DEFAULT 1, +f7 int(11) DEFAULT NULL, +PRIMARY KEY (pk), +KEY idx1 (f7), +KEY idx2 (f1), +KEY idx3 (f2), +KEY idx4 (f3), +CONSTRAINT constr CHECK (f6 >= 0) +); +SELECT * FROM long_enough_name AS tbl; +pk f1 f2 f3 f4 f5 f6 f7 +SHOW CREATE TABLE long_enough_name; +Table Create Table +long_enough_name CREATE TABLE `long_enough_name` ( + `pk` int(11) NOT NULL, + `f1` int(11) DEFAULT NULL, + `f2` int(11) NOT NULL, + `f3` int(11) DEFAULT NULL, + `f4` timestamp NOT NULL DEFAULT current_timestamp(), + `f5` varchar(32) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT 'foo', + `f6` smallint(6) NOT NULL DEFAULT 1, + `f7` int(11) DEFAULT NULL, + PRIMARY KEY (`pk`), + KEY `idx1` (`f7`), + KEY `idx2` (`f1`), + KEY `idx3` (`f2`), + KEY `idx4` (`f3`), + CONSTRAINT `constr` CHECK (`f6` >= 0) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE long_enough_name; diff --git a/mysql-test/main/constraints.test b/mysql-test/main/constraints.test index 1997c23bfa9..fe51e5060dc 100644 --- a/mysql-test/main/constraints.test +++ b/mysql-test/main/constraints.test @@ -77,3 +77,28 @@ CREATE TABLE t_illegal (col_1 INT CHECK something (whatever)); --error ER_PARSE_ERROR CREATE TABLE t_illegal (col_1 INT CHECK something); +# +# MDEV-17065 Crash on SHOW CREATE TABLE with CHECK CONSTRAINT +# + +CREATE TABLE long_enough_name ( +pk int(11) NOT NULL, +f1 int(11) DEFAULT NULL, +f2 int(11) NOT NULL, +f3 int(11) DEFAULT NULL, +f4 timestamp NOT NULL DEFAULT current_timestamp(), +f5 varchar(32) COLLATE utf8_bin NOT NULL DEFAULT 'foo', +f6 smallint(6) NOT NULL DEFAULT 1, +f7 int(11) DEFAULT NULL, +PRIMARY KEY (pk), +KEY idx1 (f7), +KEY idx2 (f1), +KEY idx3 (f2), +KEY idx4 (f3), +CONSTRAINT constr CHECK (f6 >= 0) +); + +SELECT * FROM long_enough_name AS tbl; +SHOW CREATE TABLE long_enough_name; + +DROP TABLE long_enough_name; diff --git a/mysql-test/main/contributors.result b/mysql-test/main/contributors.result index 36d033f4cb3..3e4bf5f0d43 100644 --- a/mysql-test/main/contributors.result +++ b/mysql-test/main/contributors.result @@ -8,12 +8,14 @@ MariaDB Corporation https://mariadb.com Founding member, Platinum Sponsor of the Visma https://visma.com Gold Sponsor of the MariaDB Foundation DBS https://dbs.com Gold Sponsor of the MariaDB Foundation IBM https://www.ibm.com Gold Sponsor of the MariaDB Foundation +Tencent Games http://game.qq.com/ Gold Sponsor of the MariaDB Foundation Nexedi https://www.nexedi.com Silver Sponsor of the MariaDB Foundation -Acronis http://www.acronis.com Silver Sponsor of the MariaDB Foundation +Acronis https://www.acronis.com Silver Sponsor of the MariaDB Foundation Verkkokauppa.com https://www.verkkokauppa.com Bronze Sponsor of the MariaDB Foundation Virtuozzo https://virtuozzo.com Bronze Sponsor of the MariaDB Foundation Tencent Game DBA http://tencentdba.com/about Bronze Sponsor of the MariaDB Foundation Tencent TDSQL http://tdsql.org Bronze Sponsor of the MariaDB Foundation +Percona https://www.percona.com/ Bronze Sponsor of the MariaDB Foundation Google USA Sponsoring encryption, parallel replication and GTID Facebook USA Sponsoring non-blocking API, LIMIT ROWS EXAMINED etc Ronald Bradford Brisbane, Australia EFF contribution for UC2006 Auction diff --git a/mysql-test/main/create-big.result b/mysql-test/main/create-big.result index d041419443e..fc29b08ffb8 100644 --- a/mysql-test/main/create-big.result +++ b/mysql-test/main/create-big.result @@ -237,11 +237,11 @@ select @a; @a 0 drop table t1; -set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go'; -create table if not exists t1 select 1 as i;; +set debug_sync='create_table_before_check_if_exists SIGNAL parked WAIT_FOR go'; +create table if not exists t1 select 1 as i; connection addconroot1; set debug_sync='now WAIT_FOR parked'; -drop table t1;; +drop table t1; connection addconroot2; set debug_sync='now SIGNAL go'; connection default; @@ -249,11 +249,11 @@ connection addconroot1; connection default; create table t1 (i int); set @a:=0; -set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go'; -create table if not exists t1 select 1 as i;; +set debug_sync='create_table_before_check_if_exists SIGNAL parked WAIT_FOR go'; +create table if not exists t1 select 1 as i; connection addconroot1; set debug_sync='now WAIT_FOR parked'; -create trigger t1_bi before insert on t1 for each row set @a:=1;; +create trigger t1_bi before insert on t1 for each row set @a:=1; connection addconroot2; set debug_sync='now SIGNAL go'; connection default; diff --git a/mysql-test/main/create-big.test b/mysql-test/main/create-big.test index 7f20a8b42af..82a4dd82a32 100644 --- a/mysql-test/main/create-big.test +++ b/mysql-test/main/create-big.test @@ -395,11 +395,11 @@ select @a; drop table t1; # Concurrent DROP TABLE -set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go'; ---send create table if not exists t1 select 1 as i; +set debug_sync='create_table_before_check_if_exists SIGNAL parked WAIT_FOR go'; +--send create table if not exists t1 select 1 as i connection addconroot1; set debug_sync='now WAIT_FOR parked'; ---send drop table t1; +--send drop table t1 connection addconroot2; # Wait until the above DROP TABLE is blocked due to CREATE TABLE let $wait_condition= @@ -417,11 +417,11 @@ connection default; # Concurrent CREATE TRIGGER create table t1 (i int); set @a:=0; -set debug_sync='create_table_select_before_check_if_exists SIGNAL parked WAIT_FOR go'; ---send create table if not exists t1 select 1 as i; +set debug_sync='create_table_before_check_if_exists SIGNAL parked WAIT_FOR go'; +--send create table if not exists t1 select 1 as i connection addconroot1; set debug_sync='now WAIT_FOR parked'; ---send create trigger t1_bi before insert on t1 for each row set @a:=1; +--send create trigger t1_bi before insert on t1 for each row set @a:=1 connection addconroot2; # Wait until the above DROP TABLE is blocked due to CREATE TABLE let $wait_condition= diff --git a/mysql-test/main/create.result b/mysql-test/main/create.result index dc34185ad2e..ea9014498e0 100644 --- a/mysql-test/main/create.result +++ b/mysql-test/main/create.result @@ -404,7 +404,7 @@ create table t3 like mysqltest.t3; ERROR 42S01: Table 't3' already exists create table non_existing_database.t1 like t1; ERROR 42000: Unknown database 'non_existing_database' -create table t3 like non_existing_table; +create table t4 like non_existing_table; ERROR 42S02: Table 'test.non_existing_table' doesn't exist create temporary table t3 like t1; ERROR 42S01: Table 't3' already exists @@ -914,8 +914,12 @@ unlock tables; lock table t1 read, t2 read; create table t2 select * from t1; ERROR HY000: Table 't2' was locked with a READ lock and can't be updated +create table t3 select * from t1; +ERROR HY000: Table 't3' was not locked with LOCK TABLES create table if not exists t2 select * from t1; ERROR HY000: Table 't2' was locked with a READ lock and can't be updated +create table if not exists t3 select * from t1; +ERROR HY000: Table 't3' was not locked with LOCK TABLES unlock tables; lock table t1 read, t2 write; create table t2 select * from t1; @@ -1053,95 +1057,6 @@ USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; ERROR 42000: Incorrect database name 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' -set names utf8; -create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; -use имя_базы_в_кодировке_утф8_длиной_больше_чем_45; -select database(); -database() -имя_базы_в_кодировке_утф8_длиной_больше_чем_45 -use test; -select SCHEMA_NAME from information_schema.schemata -where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45'; -SCHEMA_NAME -имя_базы_в_кодировке_утф8_длиной_больше_чем_45 -drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; -create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 -( -имя_поля_в_кодировке_утф8_длиной_больше_чем_45 int, -index имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 (имя_поля_в_кодировке_утф8_длиной_больше_чем_45) -); -create view имя_вью_кодировке_утф8_длиной_больше_чем_42 as -select имя_поля_в_кодировке_утф8_длиной_больше_чем_45 -from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; -select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; -имя_поля_в_кодировке_утф8_длиной_больше_чем_45 -select TABLE_NAME from information_schema.tables where -table_schema='test'; -TABLE_NAME -имя_вью_кодировке_утф8_длиной_больше_чем_42 -имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 -select COLUMN_NAME from information_schema.columns where -table_schema='test'; -COLUMN_NAME -имя_поля_в_кодировке_утф8_длиной_больше_чем_45 -имя_поля_в_кодировке_утф8_длиной_больше_чем_45 -select INDEX_NAME from information_schema.statistics where -table_schema='test'; -INDEX_NAME -имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 -select TABLE_NAME from information_schema.views where -table_schema='test'; -TABLE_NAME -имя_вью_кодировке_утф8_длиной_больше_чем_42 -show create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; -Table Create Table -имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 CREATE TABLE `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48` ( - `имя_поля_в_кодировке_утф8_длиной_больше_чем_45` int(11) DEFAULT NULL, - KEY `имя_индекса_в_кодировке_утф8_длиной_больше_чем_48` (`имя_поля_в_кодировке_утф8_длиной_больше_чем_45`) -) ENGINE=MyISAM DEFAULT CHARSET=latin1 -show create view имя_вью_кодировке_утф8_длиной_больше_чем_42; -View Create View character_set_client collation_connection -имя_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имя_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имя_поля_в_кодировке_утф8_длиной_больше_чем_45` AS `имя_поля_в_кодировке_утф8_длиной_больше_чем_45` from `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48` utf8 utf8_general_ci -create trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49 -before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; -select TRIGGER_NAME from information_schema.triggers where -trigger_schema='test'; -TRIGGER_NAME -имя_триггера_в_кодировке_утф8_длиной_больше_чем_49 -drop trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49; -create trigger -очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66 -before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; -ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long -drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66; -ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long -create procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50() -begin -end; -select ROUTINE_NAME from information_schema.routines where -routine_schema='test'; -ROUTINE_NAME -имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50 -drop procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50; -create procedure очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66() -begin -end; -ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long -create function имя_функции_в_кодировке_утф8_длиной_больше_чем_49() -returns int -return 0; -select ROUTINE_NAME from information_schema.routines where -routine_schema='test'; -ROUTINE_NAME -имя_функции_в_кодировке_утф8_длиной_больше_чем_49 -drop function имя_функции_в_кодировке_утф8_длиной_больше_чем_49; -create function очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66() -returns int -return 0; -ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long -drop view имя_вью_кодировке_утф8_длиной_больше_чем_42; -drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; -set names default; drop table if exists t1,t2,t3; drop function if exists f1; create function f1() returns int @@ -1249,7 +1164,7 @@ INSERT INTO t3 VALUES (0); SET sql_mode = TRADITIONAL; ALTER TABLE t3 ADD INDEX(c1); -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'c1' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t3`.`c1` at row 1 # -- Cleanup. SET sql_mode = ''; @@ -1807,12 +1722,12 @@ NULL 0000-00-00 0000-00-00 drop table t1; set @@session.sql_mode='STRICT_ALL_TABLES'; create table if not exists t1 (a int, b date, c date) select 1 as b, 2 as c; -ERROR 22007: Incorrect date value: '1' for column 'b' at row 1 +ERROR 22007: Incorrect date value: '1' for column `test`.`t1`.`b` at row 1 select * from t1; ERROR 42S02: Table 'test.t1' doesn't exist create table if not exists t1 (a int, b date, c date) replace select 1 as b, 2 as c; -ERROR 22007: Incorrect date value: '1' for column 'b' at row 1 +ERROR 22007: Incorrect date value: '1' for column `test`.`t1`.`b` at row 1 select * from t1; ERROR 42S02: Table 'test.t1' doesn't exist create table if not exists t1 (a int, b date, c date) diff --git a/mysql-test/main/create.test b/mysql-test/main/create.test index af5c427852c..4bf6ce99504 100644 --- a/mysql-test/main/create.test +++ b/mysql-test/main/create.test @@ -323,7 +323,7 @@ create table t3 like mysqltest.t3; --error 1049 create table non_existing_database.t1 like t1; --error ER_NO_SUCH_TABLE -create table t3 like non_existing_table; +create table t4 like non_existing_table; --error 1050 create temporary table t3 like t1; drop table t1, t2, t3; @@ -768,7 +768,6 @@ drop table t1; --error ER_CANT_AGGREGATE_2COLLATIONS create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1_bin); - # Base vs temporary tables dillema (a.k.a. bug#24508 "Inconsistent # results of CREATE TABLE ... SELECT when temporary table exists"). # In this situation we either have to create non-temporary table and @@ -776,6 +775,7 @@ create table t1 select coalesce('a' collate latin1_swedish_ci,'b' collate latin1 # permanent table. After patch for Bug#47418, we create the base table and # instert data into it, even though a temporary table exists with the same # name. + create temporary table t1 (j int); create table if not exists t1 select 1; select * from t1; @@ -783,7 +783,6 @@ drop temporary table t1; select * from t1; drop table t1; - # # CREATE TABLE ... SELECT and LOCK TABLES # @@ -792,6 +791,7 @@ drop table t1; # the server doesn't crash, hang and produces sensible errors. # Includes test for bug #20662 "Infinite loop in CREATE TABLE # IF NOT EXISTS ... SELECT with locked tables". + create table t1 (i int); insert into t1 values (1), (2); lock tables t1 read; @@ -812,8 +812,12 @@ unlock tables; lock table t1 read, t2 read; --error ER_TABLE_NOT_LOCKED_FOR_WRITE create table t2 select * from t1; +--error ER_TABLE_NOT_LOCKED +create table t3 select * from t1; --error ER_TABLE_NOT_LOCKED_FOR_WRITE create table if not exists t2 select * from t1; +--error ER_TABLE_NOT_LOCKED +create table if not exists t3 select * from t1; unlock tables; lock table t1 read, t2 write; --error ER_TABLE_EXISTS_ERROR @@ -990,87 +994,6 @@ USE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa --error 1102 SHOW CREATE DATABASE aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa; -# -# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte -# -set names utf8; - -create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; -use имя_базы_в_кодировке_утф8_длиной_больше_чем_45; -select database(); -use test; - -select SCHEMA_NAME from information_schema.schemata -where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45'; - -drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; -create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 -( - имя_поля_в_кодировке_утф8_длиной_больше_чем_45 int, - index имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 (имя_поля_в_кодировке_утф8_длиной_больше_чем_45) -); - -create view имя_вью_кодировке_утф8_длиной_больше_чем_42 as -select имя_поля_в_кодировке_утф8_длиной_больше_чем_45 -from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; - -# database, table, field, key, view -select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; - ---sorted_result -select TABLE_NAME from information_schema.tables where -table_schema='test'; - -select COLUMN_NAME from information_schema.columns where -table_schema='test'; - -select INDEX_NAME from information_schema.statistics where -table_schema='test'; - -select TABLE_NAME from information_schema.views where -table_schema='test'; - -show create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; -show create view имя_вью_кодировке_утф8_длиной_больше_чем_42; - -create trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49 -before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; -select TRIGGER_NAME from information_schema.triggers where -trigger_schema='test'; -drop trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49; ---error 1059 -create trigger -очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66 -before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; ---error 1059 -drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66; - -create procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50() -begin -end; -select ROUTINE_NAME from information_schema.routines where -routine_schema='test'; -drop procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50; ---error 1059 -create procedure очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66() -begin -end; - -create function имя_функции_в_кодировке_утф8_длиной_больше_чем_49() - returns int -return 0; -select ROUTINE_NAME from information_schema.routines where -routine_schema='test'; -drop function имя_функции_в_кодировке_утф8_длиной_больше_чем_49; ---error 1059 -create function очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66() - returns int -return 0; - -drop view имя_вью_кодировке_утф8_длиной_больше_чем_42; -drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; -set names default; - # # Bug#21136 CREATE TABLE SELECT within CREATE TABLE SELECT causes server crash # diff --git a/mysql-test/main/create_drop_binlog.result b/mysql-test/main/create_drop_binlog.result index be40fcc140a..b8f8b61c359 100644 --- a/mysql-test/main/create_drop_binlog.result +++ b/mysql-test/main/create_drop_binlog.result @@ -322,8 +322,6 @@ Log_name Pos Event_type Server_id End_log_pos Info # # Gtid 1 # GTID #-#-# # # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT) # # Gtid 1 # GTID #-#-# -# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT) -# # Gtid 1 # GTID #-#-# # # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a) # # Gtid 1 # GTID #-#-# # # Query 1 # use `test`; CREATE OR REPLACE INDEX i1 ON t1(a) @@ -377,8 +375,6 @@ Log_name Pos Event_type Server_id End_log_pos Info # # Gtid 1 # GTID #-#-# # # Query 1 # use `test`; CREATE TABLE t1(a INT, b INT) # # Gtid 1 # GTID #-#-# -# # Query 1 # use `test`; CREATE TABLE IF NOT EXISTS t1(a INT, b INT) -# # Gtid 1 # GTID #-#-# # # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a) # # Gtid 1 # GTID #-#-# # # Query 1 # use `test`; CREATE INDEX IF NOT EXISTS i1 ON t1(a) diff --git a/mysql-test/main/create_drop_user.result b/mysql-test/main/create_drop_user.result index dd75d1c257a..67717f3e4e0 100644 --- a/mysql-test/main/create_drop_user.result +++ b/mysql-test/main/create_drop_user.result @@ -1,22 +1,22 @@ CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw1'; -SELECT password FROM mysql.user WHERE user='u1'; -password -*2B602296A79E0A8784ACC5C88D92E46588CCA3C3 +SELECT plugin,authentication_string FROM mysql.user WHERE user='u1'; +plugin authentication_string +mysql_native_password *2B602296A79E0A8784ACC5C88D92E46588CCA3C3 CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw2'; Warnings: Note 1973 Can't create user 'u1'@'localhost'; it already exists -SELECT password FROM mysql.user WHERE user='u1'; -password -*2B602296A79E0A8784ACC5C88D92E46588CCA3C3 +SELECT plugin,authentication_string FROM mysql.user WHERE user='u1'; +plugin authentication_string +mysql_native_password *2B602296A79E0A8784ACC5C88D92E46588CCA3C3 CREATE OR REPLACE USER u1@localhost IDENTIFIED BY 'pw3'; -SELECT password FROM mysql.user WHERE user='u1'; -password -*77B4A70CEFD76DB9415F36D291E74C110D2738E0 +SELECT plugin,authentication_string FROM mysql.user WHERE user='u1'; +plugin authentication_string +mysql_native_password *77B4A70CEFD76DB9415F36D291E74C110D2738E0 CREATE OR REPLACE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw4'; ERROR HY000: Incorrect usage of OR REPLACE and IF NOT EXISTS -SELECT password FROM mysql.user WHERE user='u1'; -password -*77B4A70CEFD76DB9415F36D291E74C110D2738E0 +SELECT plugin,authentication_string FROM mysql.user WHERE user='u1'; +plugin authentication_string +mysql_native_password *77B4A70CEFD76DB9415F36D291E74C110D2738E0 DROP USER IF EXISTS u1@localhost; DROP USER IF EXISTS u1@localhost; Warnings: diff --git a/mysql-test/main/create_drop_user.test b/mysql-test/main/create_drop_user.test index 949782a2daf..234383fb4ca 100644 --- a/mysql-test/main/create_drop_user.test +++ b/mysql-test/main/create_drop_user.test @@ -1,17 +1,17 @@ --source include/not_embedded.inc CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw1'; -SELECT password FROM mysql.user WHERE user='u1'; +SELECT plugin,authentication_string FROM mysql.user WHERE user='u1'; CREATE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw2'; -SELECT password FROM mysql.user WHERE user='u1'; +SELECT plugin,authentication_string FROM mysql.user WHERE user='u1'; CREATE OR REPLACE USER u1@localhost IDENTIFIED BY 'pw3'; -SELECT password FROM mysql.user WHERE user='u1'; +SELECT plugin,authentication_string FROM mysql.user WHERE user='u1'; --error ER_WRONG_USAGE CREATE OR REPLACE USER IF NOT EXISTS u1@localhost IDENTIFIED BY 'pw4'; -SELECT password FROM mysql.user WHERE user='u1'; +SELECT plugin,authentication_string FROM mysql.user WHERE user='u1'; DROP USER IF EXISTS u1@localhost; DROP USER IF EXISTS u1@localhost; diff --git a/mysql-test/main/create_or_replace.result b/mysql-test/main/create_or_replace.result index 0c1bccb861a..485091e5810 100644 --- a/mysql-test/main/create_or_replace.result +++ b/mysql-test/main/create_or_replace.result @@ -257,12 +257,13 @@ drop table if exists test.t1,mysqltest2.t2; Warnings: Note 1051 Unknown table 'test.t1' Note 1051 Unknown table 'mysqltest2.t2' -create table test.t1 (i int); +create table test.t1 (i int) engine=myisam; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 @@ -274,7 +275,8 @@ Tables_in_test t2 select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 @@ -289,7 +291,8 @@ create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 @@ -301,7 +304,8 @@ Tables_in_test t2 select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 @@ -311,6 +315,31 @@ select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME create table t1 (i int); drop table t1; +create table test.t1 (i int) engine=innodb; +create table mysqltest2.t2 like test.t1; +lock table test.t1 write, mysqltest2.t2 write; +select * from information_schema.metadata_lock_info; +THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# MDL_BACKUP_DDL NULL Backup lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +unlock tables; +drop table test.t1,mysqltest2.t2; +create table test.t1 (i int) engine=aria transactional=1 checksum=1; +create table mysqltest2.t2 like test.t1; +lock table test.t1 write, mysqltest2.t2 write; +select * from information_schema.metadata_lock_info; +THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME +# MDL_BACKUP_DDL NULL Backup lock +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock mysqltest2 +# MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock mysqltest2 t2 +# MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 +unlock tables; +drop table t1; +create table test.t1 (i int); drop database mysqltest2; # # Testing CREATE .. LIKE @@ -398,28 +427,32 @@ create table t1 (a int); lock table t1 write, t2 read; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 (i int); select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 like t2; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_READ NULL Table metadata lock test t2 create or replace table t1 select 1 as f1; select * from information_schema.metadata_lock_info; THREAD_ID LOCK_MODE LOCK_DURATION LOCK_TYPE TABLE_SCHEMA TABLE_NAME -# MDL_INTENTION_EXCLUSIVE NULL Global read lock +# MDL_BACKUP_DDL NULL Backup lock +# MDL_BACKUP_DML NULL Backup lock # MDL_INTENTION_EXCLUSIVE NULL Schema metadata lock test # MDL_SHARED_NO_READ_WRITE NULL Table metadata lock test t1 # MDL_SHARED_READ NULL Table metadata lock test t2 @@ -479,6 +512,21 @@ UNLOCK TABLES; DROP FUNCTION f1; DROP TABLE t1; # +# MDEV-14410 - Assertion `table->pos_in_locked_tables == __null || +# table->pos_in_locked_tables->table == table' failed in +# mark_used_tables_as_free_for_reuse +# +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE TABLE t3 (c INT); +CREATE TRIGGER tr1 BEFORE INSERT ON t3 FOR EACH ROW INSERT INTO t1 VALUES (); +CREATE TRIGGER tr2 BEFORE INSERT ON t2 FOR EACH ROW INSERT INTO t3 SELECT * FROM t1; +LOCK TABLE t1 WRITE, t2 WRITE; +CREATE OR REPLACE TABLE t1 (i INT); +UNLOCK TABLES; +INSERT INTO t2 VALUES (1); +DROP TABLE t1, t2, t3; +# # MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in # Locked_tables_list::unlock_locked_tables # @@ -488,12 +536,12 @@ CREATE TABLE t3(a INT); LOCK TABLE t2 WRITE; SELECT * FROM t2; a -CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +CREATE OR REPLACE TEMPORARY TABLE t1(c INT DEFAULT ''); +ERROR 42000: Invalid default value for 'c' SELECT * FROM t3; ERROR HY000: Table 't3' was not locked with LOCK TABLES -CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; -ERROR HY000: CREATE TEMPORARY TABLE is not allowed with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE. +CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT ''); +ERROR 42000: Invalid default value for 'c' SELECT * FROM t3; ERROR HY000: Table 't3' was not locked with LOCK TABLES UNLOCK TABLES; diff --git a/mysql-test/main/create_or_replace.test b/mysql-test/main/create_or_replace.test index 3ae882139bc..1b4994e811f 100644 --- a/mysql-test/main/create_or_replace.test +++ b/mysql-test/main/create_or_replace.test @@ -210,7 +210,7 @@ drop table t1,t3,t4; create database mysqltest2; drop table if exists test.t1,mysqltest2.t2; -create table test.t1 (i int); +create table test.t1 (i int) engine=myisam; create table mysqltest2.t2 like test.t1; lock table test.t1 write, mysqltest2.t2 write; --replace_column 1 # @@ -249,6 +249,26 @@ create or replace table mysqltest2.t2 (a int) select 1 as 'a', 2 as 'a'; select * from information_schema.metadata_lock_info; create table t1 (i int); drop table t1; + +create table test.t1 (i int) engine=innodb; +create table mysqltest2.t2 like test.t1; +lock table test.t1 write, mysqltest2.t2 write; +--replace_column 1 # +--sorted_result +select * from information_schema.metadata_lock_info; +unlock tables; +drop table test.t1,mysqltest2.t2; + +create table test.t1 (i int) engine=aria transactional=1 checksum=1; +create table mysqltest2.t2 like test.t1; +lock table test.t1 write, mysqltest2.t2 write; +--replace_column 1 # +--sorted_result +select * from information_schema.metadata_lock_info; +unlock tables; +drop table t1; + +create table test.t1 (i int); drop database mysqltest2; --echo # @@ -422,6 +442,27 @@ UNLOCK TABLES; DROP FUNCTION f1; DROP TABLE t1; + +--echo # +--echo # MDEV-14410 - Assertion `table->pos_in_locked_tables == __null || +--echo # table->pos_in_locked_tables->table == table' failed in +--echo # mark_used_tables_as_free_for_reuse +--echo # +CREATE TABLE t1 (a INT); +CREATE TABLE t2 (b INT); +CREATE TABLE t3 (c INT); + +CREATE TRIGGER tr1 BEFORE INSERT ON t3 FOR EACH ROW INSERT INTO t1 VALUES (); +CREATE TRIGGER tr2 BEFORE INSERT ON t2 FOR EACH ROW INSERT INTO t3 SELECT * FROM t1; + +LOCK TABLE t1 WRITE, t2 WRITE; +CREATE OR REPLACE TABLE t1 (i INT); +UNLOCK TABLES; +INSERT INTO t2 VALUES (1); + +# Cleanup +DROP TABLE t1, t2, t3; + --echo # --echo # MDEV-11071 - Assertion `thd->transaction.stmt.is_empty()' failed in --echo # Locked_tables_list::unlock_locked_tables @@ -432,14 +473,14 @@ CREATE TABLE t3(a INT); LOCK TABLE t2 WRITE; SELECT * FROM t2; # drops t2 ---error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE -CREATE OR REPLACE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +--error ER_INVALID_DEFAULT +CREATE OR REPLACE TEMPORARY TABLE t1(c INT DEFAULT ''); # make sure we didn't leave locked tables mode --error ER_TABLE_NOT_LOCKED SELECT * FROM t3; # drops t1 ---error ER_UNSUPPORT_COMPRESSED_TEMPORARY_TABLE -CREATE OR REPLACE TEMPORARY TABLE t2(a INT) ENGINE=InnoDB ROW_FORMAT=COMPRESSED; +--error ER_INVALID_DEFAULT +CREATE OR REPLACE TEMPORARY TABLE t2(c INT DEFAULT ''); # make sure we didn't leave locked tables mode --error ER_TABLE_NOT_LOCKED SELECT * FROM t3; diff --git a/mysql-test/main/create_user.result b/mysql-test/main/create_user.result index 8001b43221b..8bd0ca88335 100644 --- a/mysql-test/main/create_user.result +++ b/mysql-test/main/create_user.result @@ -1,57 +1,57 @@ create user foo; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N N 0.000000 +% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 mysql_native_password N N 0.000000 drop user foo; create user foo identified by 'password'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require SSL; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ANY 0 0 0 0 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N ANY 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require X509; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N X509 0 0 0 0 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N X509 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require CIPHER 'cipher'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher 0 0 0 0 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require ISSUER 'issuer'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED issuer 0 0 0 0 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED issuer 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require SUBJECT 'subject'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED subject 0 0 0 0 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require CIPHER 'cipher' SUBJECT 'subject'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher subject 0 0 0 0 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo identified by 'password' require CIPHER 'cipher' AND SUBJECT 'subject' AND ISSUER 'issuer'; select * from mysql.user where user = 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 N N 0.000000 +% foo *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 mysql_native_password *2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19 N N 0.000000 drop user foo; create user foo, foo2 identified by 'password' require CIPHER 'cipher' AND SUBJECT 'subject' AND ISSUER 'issuer'; select * from mysql.user where user like 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 N N 0.000000 +% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 mysql_native_password N N 0.000000 #--warning ER_USER_CREATE_EXISTS create user if not exists foo, foo2 identified by 'password2' require CIPHER 'cipher2' AND SUBJECT 'subject2' AND ISSUER 'issuer2'; @@ -60,7 +60,7 @@ Note 1973 Can't create user 'foo'@'%'; it already exists Note 1973 Can't create user 'foo2'@'%'; it already exists select * from mysql.user where user like 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 N N 0.000000 +% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N SPECIFIED cipher issuer subject 0 0 0 0 mysql_native_password N N 0.000000 drop user foo, foo2; create user foo with MAX_QUERIES_PER_HOUR 10 MAX_UPDATES_PER_HOUR 20 @@ -68,5 +68,5 @@ MAX_CONNECTIONS_PER_HOUR 30 MAX_USER_CONNECTIONS 40; select * from mysql.user where user like 'foo'; Host User Password Select_priv Insert_priv Update_priv Delete_priv Create_priv Drop_priv Reload_priv Shutdown_priv Process_priv File_priv Grant_priv References_priv Index_priv Alter_priv Show_db_priv Super_priv Create_tmp_table_priv Lock_tables_priv Execute_priv Repl_slave_priv Repl_client_priv Create_view_priv Show_view_priv Create_routine_priv Alter_routine_priv Create_user_priv Event_priv Trigger_priv Create_tablespace_priv Delete_history_priv ssl_type ssl_cipher x509_issuer x509_subject max_questions max_updates max_connections max_user_connections plugin authentication_string password_expired is_role default_role max_statement_time -% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 40 N N 0.000000 +% foo N N N N N N N N N N N N N N N N N N N N N N N N N N N N N N 10 20 30 40 mysql_native_password N N 0.000000 drop user foo; diff --git a/mysql-test/main/create_utf8.result b/mysql-test/main/create_utf8.result new file mode 100644 index 00000000000..e1ccf7a08d7 --- /dev/null +++ b/mysql-test/main/create_utf8.result @@ -0,0 +1,89 @@ +set names utf8; +create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; +use имя_базы_в_кодировке_утф8_длиной_больше_чем_45; +select database(); +database() +имя_базы_в_кодировке_утф8_длиной_больше_чем_45 +use test; +select SCHEMA_NAME from information_schema.schemata +where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45'; +SCHEMA_NAME +имя_базы_в_кодировке_утф8_длиной_больше_чем_45 +drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; +create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 +( +имя_поля_в_кодировке_утф8_длиной_больше_чем_45 int, +index имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 (имя_поля_в_кодировке_утф8_длиной_больше_чем_45) +); +create view имя_вью_кодировке_утф8_длиной_больше_чем_42 as +select имя_поля_в_кодировке_утф8_длиной_больше_чем_45 +from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; +select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; +имя_поля_в_кодировке_утф8_длиной_больше_чем_45 +select TABLE_NAME from information_schema.tables where +table_schema='test'; +TABLE_NAME +имя_вью_кодировке_утф8_длиной_больше_чем_42 +имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 +select COLUMN_NAME from information_schema.columns where +table_schema='test'; +COLUMN_NAME +имя_поля_в_кодировке_утф8_длиной_больше_чем_45 +имя_поля_в_кодировке_утф8_длиной_больше_чем_45 +select INDEX_NAME from information_schema.statistics where +table_schema='test'; +INDEX_NAME +имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 +select TABLE_NAME from information_schema.views where +table_schema='test'; +TABLE_NAME +имя_вью_кодировке_утф8_длиной_больше_чем_42 +show create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; +Table Create Table +имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 CREATE TABLE `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48` ( + `имя_поля_в_кодировке_утф8_длиной_больше_чем_45` int(11) DEFAULT NULL, + KEY `имя_индекса_в_кодировке_утф8_длиной_больше_чем_48` (`имя_поля_в_кодировке_утф8_длиной_больше_чем_45`) +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create view имя_вью_кодировке_утф8_длиной_больше_чем_42; +View Create View character_set_client collation_connection +имя_вью_кодировке_утф8_длиной_больше_чем_42 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `имя_вью_кодировке_утф8_длиной_больше_чем_42` AS select `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48`.`имя_поля_в_кодировке_утф8_длиной_больше_чем_45` AS `имя_поля_в_кодировке_утф8_длиной_больше_чем_45` from `имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48` utf8 utf8_general_ci +create trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49 +before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; +select TRIGGER_NAME from information_schema.triggers where +trigger_schema='test'; +TRIGGER_NAME +имя_триггера_в_кодировке_утф8_длиной_больше_чем_49 +drop trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49; +create trigger +очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66 +before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; +ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long +drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66; +ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long +create procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50() +begin +end; +select ROUTINE_NAME from information_schema.routines where +routine_schema='test'; +ROUTINE_NAME +имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50 +drop procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50; +create procedure очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66() +begin +end; +ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long +create function имя_функции_в_кодировке_утф8_длиной_больше_чем_49() +returns int +return 0; +select ROUTINE_NAME from information_schema.routines where +routine_schema='test'; +ROUTINE_NAME +имя_функции_в_кодировке_утф8_длиной_больше_чем_49 +drop function имя_функции_в_кодировке_утф8_длиной_больше_чем_49; +create function очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66() +returns int +return 0; +ERROR 42000: Identifier name 'очень_очень_очень_очень_очень_очень_очень_очень_длинна' is too long +drop view имя_вью_кодировке_утф8_длиной_больше_чем_42; +drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; +set names default; diff --git a/mysql-test/main/create_utf8.test b/mysql-test/main/create_utf8.test new file mode 100644 index 00000000000..40e814834bc --- /dev/null +++ b/mysql-test/main/create_utf8.test @@ -0,0 +1,80 @@ +# +# Bug#21432 Database/Table name limited to 64 bytes, not chars, problems with multi-byte +# +set names utf8; + +create database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; +use имя_базы_в_кодировке_утф8_длиной_больше_чем_45; +select database(); +use test; + +select SCHEMA_NAME from information_schema.schemata +where schema_name='имя_базы_в_кодировке_утф8_длиной_больше_чем_45'; + +drop database имя_базы_в_кодировке_утф8_длиной_больше_чем_45; +create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 +( + имя_поля_в_кодировке_утф8_длиной_больше_чем_45 int, + index имя_индекса_в_кодировке_утф8_длиной_больше_чем_48 (имя_поля_в_кодировке_утф8_длиной_больше_чем_45) +); + +create view имя_вью_кодировке_утф8_длиной_больше_чем_42 as +select имя_поля_в_кодировке_утф8_длиной_больше_чем_45 +from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; + +# database, table, field, key, view +select * from имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; + +--sorted_result +select TABLE_NAME from information_schema.tables where +table_schema='test'; + +select COLUMN_NAME from information_schema.columns where +table_schema='test'; + +select INDEX_NAME from information_schema.statistics where +table_schema='test'; + +select TABLE_NAME from information_schema.views where +table_schema='test'; + +show create table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; +show create view имя_вью_кодировке_утф8_длиной_больше_чем_42; + +create trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49 +before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; +select TRIGGER_NAME from information_schema.triggers where +trigger_schema='test'; +drop trigger имя_триггера_в_кодировке_утф8_длиной_больше_чем_49; +--error 1059 +create trigger +очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66 +before insert on имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48 for each row set @a:=1; +--error 1059 +drop trigger очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66; + +create procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50() +begin +end; +select ROUTINE_NAME from information_schema.routines where +routine_schema='test'; +drop procedure имя_процедуры_в_кодировке_утф8_длиной_больше_чем_50; +--error 1059 +create procedure очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66() +begin +end; + +create function имя_функции_в_кодировке_утф8_длиной_больше_чем_49() + returns int +return 0; +select ROUTINE_NAME from information_schema.routines where +routine_schema='test'; +drop function имя_функции_в_кодировке_утф8_длиной_больше_чем_49; +--error 1059 +create function очень_очень_очень_очень_очень_очень_очень_очень_длинная_строка_66() + returns int +return 0; + +drop view имя_вью_кодировке_утф8_длиной_больше_чем_42; +drop table имя_таблицы_в_кодировке_утф8_длиной_больше_чем_48; +set names default; diff --git a/mysql-test/main/cte_nonrecursive.result b/mysql-test/main/cte_nonrecursive.result index 96e9f527253..eeae6d02476 100644 --- a/mysql-test/main/cte_nonrecursive.result +++ b/mysql-test/main/cte_nonrecursive.result @@ -1512,3 +1512,150 @@ a a 1 1 drop database db_mdev_16473; use test; +# +# MDEV-17154: using parameter markers for PS within CTEs more than once +# using local variables in SP within CTEs more than once +# +prepare stmt from " +with cte(c) as (select ? ) select r.c, s.c+10 from cte as r, cte as s; +"; +set @a=2; +execute stmt using @a; +c s.c+10 +2 12 +set @a=5; +execute stmt using @a; +c s.c+10 +5 15 +deallocate prepare stmt; +prepare stmt from " +with cte(c) as (select ? ) select c from cte union select c+10 from cte; +"; +set @a=2; +execute stmt using @a; +c +2 +12 +set @a=5; +execute stmt using @a; +c +5 +15 +deallocate prepare stmt; +prepare stmt from " +with cte_e(a,b) as +( + with cte_o(c) as (select ?) + select r.c+10, s.c+20 from cte_o as r, cte_o as s +) +select * from cte_e as cte_e1 where a > 12 +union all +select * from cte_e as cte_e2; +"; +set @a=2; +execute stmt using @a; +a b +12 22 +set @a=5; +execute stmt using @a; +a b +15 25 +15 25 +deallocate prepare stmt; +create table t1 (a int, b int); +insert into t1 values +(3,33), (1,17), (7,72), (4,45), (2,27), (3,35), (4,47), (3,38), (2,22); +prepare stmt from " +with cte as (select * from t1 where a < ? and b > ?) + select r.a, r.b+10, s.a, s.b+20 from cte as r, cte as s where r.a=s.a+1; +"; +set @a=4, @b=20; +execute stmt using @a,@b; +a r.b+10 a s.b+20 +3 43 2 47 +3 45 2 47 +3 48 2 47 +3 43 2 42 +3 45 2 42 +3 48 2 42 +set @a=5, @b=20; +execute stmt using @a,@b; +a r.b+10 a s.b+20 +4 55 3 53 +4 57 3 53 +3 43 2 47 +3 45 2 47 +3 48 2 47 +4 55 3 55 +4 57 3 55 +4 55 3 58 +4 57 3 58 +3 43 2 42 +3 45 2 42 +3 48 2 42 +deallocate prepare stmt; +create procedure p1() +begin +declare i int; +set i = 0; +while i < 4 do +insert into t1 +with cte(a) as (select i) select r.a-1, s.a+1 from cte as r, cte as s; +set i = i+1; +end while; +end| +create procedure p2(in i int) +begin +insert into t1 +with cte(a) as (select i) select r.a-1, s.a+1 from cte as r, cte as s; +end| +delete from t1; +call p1(); +select * from t1; +a b +-1 1 +0 2 +1 3 +2 4 +call p1(); +select * from t1; +a b +-1 1 +0 2 +1 3 +2 4 +-1 1 +0 2 +1 3 +2 4 +delete from t1; +call p2(3); +select * from t1; +a b +2 4 +call p2(7); +select * from t1; +a b +2 4 +6 8 +drop procedure p1; +drop procedure p2; +drop table t1; +# +# MDEV-17107: PS for CREATE OR REPLACE VIEW defined by SELECT with CTEs +# +create table t1(a int); +insert into t1 values (3), (1), (2); +create table t2 (b int); +insert into t2 values (2), (10); +prepare stmt from +"create or replace view v1 as + with t as (select s.a from (select t1.a from t1) s), + r as(select t.a from t2, t where t2.b=t.a) + select a from r;"; +execute stmt; +select * from v1; +a +2 +drop view v1; +drop table t1,t2; diff --git a/mysql-test/main/cte_nonrecursive.test b/mysql-test/main/cte_nonrecursive.test index 11c864bcac1..920c27a70f9 100644 --- a/mysql-test/main/cte_nonrecursive.test +++ b/mysql-test/main/cte_nonrecursive.test @@ -1057,3 +1057,114 @@ select * from cte, db_mdev_16473.t1 as t where cte.a=t.a; drop database db_mdev_16473; use test; + +--echo # +--echo # MDEV-17154: using parameter markers for PS within CTEs more than once +--echo # using local variables in SP within CTEs more than once +--echo # + +prepare stmt from " +with cte(c) as (select ? ) select r.c, s.c+10 from cte as r, cte as s; +"; +set @a=2; +execute stmt using @a; +set @a=5; +execute stmt using @a; +deallocate prepare stmt; + +prepare stmt from " +with cte(c) as (select ? ) select c from cte union select c+10 from cte; +"; +set @a=2; +execute stmt using @a; +set @a=5; +execute stmt using @a; +deallocate prepare stmt; + +prepare stmt from " +with cte_e(a,b) as +( + with cte_o(c) as (select ?) + select r.c+10, s.c+20 from cte_o as r, cte_o as s +) +select * from cte_e as cte_e1 where a > 12 +union all +select * from cte_e as cte_e2; +"; +set @a=2; +execute stmt using @a; +set @a=5; +execute stmt using @a; +deallocate prepare stmt; + +create table t1 (a int, b int); +insert into t1 values + (3,33), (1,17), (7,72), (4,45), (2,27), (3,35), (4,47), (3,38), (2,22); + +prepare stmt from " +with cte as (select * from t1 where a < ? and b > ?) + select r.a, r.b+10, s.a, s.b+20 from cte as r, cte as s where r.a=s.a+1; +"; +set @a=4, @b=20; +execute stmt using @a,@b; +set @a=5, @b=20; +execute stmt using @a,@b; +deallocate prepare stmt; + +delimiter |; + +create procedure p1() +begin + declare i int; + set i = 0; + while i < 4 do + insert into t1 + with cte(a) as (select i) select r.a-1, s.a+1 from cte as r, cte as s; + set i = i+1; + end while; +end| + +create procedure p2(in i int) +begin + insert into t1 + with cte(a) as (select i) select r.a-1, s.a+1 from cte as r, cte as s; +end| + +delimiter ;| + +delete from t1; +call p1(); +select * from t1; +call p1(); +select * from t1; + +delete from t1; +call p2(3); +select * from t1; +call p2(7); +select * from t1; + +drop procedure p1; +drop procedure p2; +drop table t1; + +--echo # +--echo # MDEV-17107: PS for CREATE OR REPLACE VIEW defined by SELECT with CTEs +--echo # + +create table t1(a int); +insert into t1 values (3), (1), (2); +create table t2 (b int); +insert into t2 values (2), (10); + +prepare stmt from +"create or replace view v1 as + with t as (select s.a from (select t1.a from t1) s), + r as(select t.a from t2, t where t2.b=t.a) + select a from r;"; + +execute stmt; +select * from v1; + +drop view v1; +drop table t1,t2; diff --git a/mysql-test/main/cte_recursive.result b/mysql-test/main/cte_recursive.result index 4becc038543..f2ae9929145 100644 --- a/mysql-test/main/cte_recursive.result +++ b/mysql-test/main/cte_recursive.result @@ -1608,6 +1608,44 @@ id name dob father mother 8 Grandpa Ben 1940-10-21 NULL NULL 6 Grandgrandma Martha 1923-05-17 NULL NULL drop table my_ancestors; +WITH RECURSIVE +positions(i) AS ( +VALUES(0) +UNION SELECT ALL +i+1 FROM positions WHERE i < 4*4-1 +), +solutions(board, n_queens) AS ( +SELECT REPEAT('-', 4*4), 0 +FROM positions +UNION +SELECT +concat(substr(board, 1, i),'*',substr(board, i+2)),n_queens + 1 AS n_queens +FROM positions AS ps, solutions +WHERE n_queens < 4 +AND substr(board,1,i) != '*' + AND NOT EXISTS ( +SELECT 1 FROM positions WHERE +substr(board,i+1,1) = '*' AND +( +i % 4 = ps.i % 4 OR +i div 4 = ps.i div 4 OR +i div 4 + (i % 4) = ps.i div 4 + (ps.i % 4) OR +i div 4 - (i % 4) = ps.i div 4 - (ps.i % 4) +) +) +) +SELECT regexp_replace(board,concat('(',REPEAT('.', 4),')'),'\\1\n') n_queens FROM solutions WHERE n_queens = 4; +n_queens +-*-- +---* +*--- +--*- + +--*- +*--- +---* +-*-- + # # MDEV-10883: execution of prepared statement from SELECT # with recursive CTE that renames columns @@ -3306,7 +3344,355 @@ SELECT func(); func() 1 DROP FUNCTION func; -# Start of 10.3 tests +# +# MDEV-17024: two materialized CTEs using the same recursive CTE +# +create table t1 (id int); +insert into t1 values (1), (2), (3); +with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1, cte2; +c1 c2 +2 1 +explain extended with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1, cte2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ALL NULL NULL NULL NULL 6 100.00 +1 PRIMARY ALL NULL NULL NULL NULL 6 100.00 Using join buffer (flat, BNL join) +4 DERIVED ALL NULL NULL NULL NULL 2 100.00 Using where +4 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +5 DERIVED ALL NULL NULL NULL NULL 2 100.00 Using where +5 DERIVED t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using join buffer (flat, BNL join) +2 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used +3 RECURSIVE UNION ALL NULL NULL NULL NULL 2 100.00 Using where +NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 with recursive rcte as (/* select#2 */ select 1 AS `a` union /* select#3 */ select cast(`rcte`.`a` + 1 as unsigned) AS `cast(a+1 as unsigned)` from `rcte` where `rcte`.`a` < 10), cte1 as (/* select#4 */ select count(0) AS `c1` from `rcte` join `test`.`t1` where `rcte`.`a` between 3 and 5 and `test`.`t1`.`id` = `rcte`.`a` - 3), cte2 as (/* select#5 */ select count(0) AS `c2` from `rcte` join `test`.`t1` where `rcte`.`a` between 7 and 8 and `test`.`t1`.`id` = `rcte`.`a` - 7)/* select#1 */ select `cte1`.`c1` AS `c1`,`cte2`.`c2` AS `c2` from `cte1` join `cte2` +prepare stmt from "with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1, cte2"; +execute stmt; +c1 c2 +2 1 +execute stmt; +c1 c2 +2 1 +create table t2 (c1 int, c2 int); +create procedure p() insert into t2 with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1, cte2; +call p(); +select * from t2; +c1 c2 +2 1 +with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1; +c1 +2 +with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from t1), +cte2 as +(select count(*) as c2 from t2) +select * from cte1,cte2; +c1 c2 +3 1 +with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1, cte2 where cte1.c1 = 3; +c1 c2 +drop procedure p; +drop table t1,t2; +# +# MDEV-17201: recursive part with LIMIT +# +CREATE TABLE purchases ( +id int unsigned NOT NULL AUTO_INCREMENT, +pdate date NOT NULL, +quantity int unsigned NOT NULL, +p_id int unsigned NOT NULL, +PRIMARY KEY (id) +); +INSERT INTO purchases(pdate, quantity, p_id) VALUES +('2014-11-01',5 ,1),('2014-11-03', 3 ,1), +('2014-11-01',2 ,2),('2014-11-03', 4 ,2); +CREATE TABLE expired ( +edate date NOT NULL, +quantity int unsigned NOT NULL, +p_id int unsigned NOT NULL, +PRIMARY KEY (edate,p_id) +); +INSERT INTO expired VALUES ('2014-11-12', 5 ,1),('2014-11-08', 1 ,2); +WITH RECURSIVE expired_map AS ( +SELECT edate AS expired_date, +CAST(NULL AS date) AS purchase_date, +0 AS quantity, +e.p_id, +(SELECT MAX(id)+1 FROM purchases p +WHERE pdate <= edate AND p.p_id =p_id) AS purchase_processed, +quantity AS unresolved +FROM expired e +UNION +( SELECT expired_date, +pdate, +IF(p.quantity < m.unresolved, p.quantity, m.unresolved), +p.p_id, +p.id, +IF(p.quantity < m.unresolved, m.unresolved - p.quantity, 0) +FROM purchases p JOIN expired_map m ON p.p_id = m.p_id +WHERE p.id < m.purchase_processed AND m.unresolved > 0 +ORDER BY p.id DESC +LIMIT 1 +) +) +SELECT * FROM expired_map; +expired_date purchase_date quantity p_id purchase_processed unresolved +2014-11-12 NULL 0 1 5 5 +2014-11-08 NULL 0 2 5 1 +2014-11-08 2014-11-03 1 2 4 0 +DROP TABLE purchases, expired; +# +# MDEV-17635: Two recursive CTEs, the second using the first +# +WITH RECURSIVE +x AS (SELECT 0 as k UNION ALL SELECT k + 1 FROM x WHERE k < 1), +z AS +( SELECT k1 AS cx, k2 AS cy, k1, k2 +FROM (SELECT k AS k1 FROM x) x1 JOIN (SELECT k AS k2 FROM x) y1 +UNION +SELECT 1,1,1,1 FROM z) +SELECT * FROM z; +cx cy k1 k2 +0 0 0 0 +1 0 1 0 +0 1 0 1 +1 1 1 1 +# https://wiki.postgresql.org/wiki/Mandelbrot_set: +WITH RECURSIVE x(i) AS ( +SELECT CAST(0 AS DECIMAL(13, 10)) +UNION ALL +SELECT i + 1 +FROM x +WHERE i < 101 +), +Z(Ix, Iy, Cx, Cy, X, Y, I) AS ( +SELECT Ix, Iy, X, Y, X, Y, 0 +FROM (SELECT CAST(-2.2 + 0.031 * i AS DECIMAL(13, 10)) AS X, +i AS Ix FROM x) AS xgen +CROSS JOIN ( +SELECT CAST(-1.5 + 0.031 * i AS DECIMAL(13, 10)) AS Y, +i AS iY FROM x +) AS ygen +UNION ALL +SELECT Ix, Iy, Cx, Cy, +CAST(X * X - Y * Y + Cx AS DECIMAL(13, 10)) AS X, +CAST(Y * X * 2 + Cy AS DECIMAL(13, 10)), I + 1 +FROM Z +WHERE X * X + Y * Y < 16.0 +AND I < 27 +), +Zt (Ix, Iy, I) AS ( +SELECT Ix, Iy, MAX(I) AS I +FROM Z +GROUP BY Iy, Ix +ORDER BY Iy, Ix +) +SELECT GROUP_CONCAT( +SUBSTRING( +' .,,,-----++++%%%%@@@@#### ', +GREATEST(I, 1), +1 +) ORDER BY Ix SEPARATOR '' + ) AS 'Mandelbrot Set' + FROM Zt +GROUP BY Iy +ORDER BY Iy; +Mandelbrot Set + .................................................................................... + ....................................................................................... + ......................................................................................... + ........................................................................................... + ....................................................,,,,,,,,,................................. + ................................................,,,,,,,,,,,,,,,,,,............................. + ..............................................,,,,,,,,,,,,,,,,,,,,,,,,.......................... + ............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................ + ..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................... + .........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................... + ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................... + .......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................. + .......................................,,,,,,,,,,,,,,,,,,,,,,,,--,,,,,,,,,,,,,,,,,,,,................ +......................................,,,,,,,,,,,,,,,,,,,,,,,,,,-+--,,,,,,,,,,,,,,,,,,,............... +....................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----,,,,,,,,,,,,,,,,,,,.............. +...................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,--- -----,,,,,,,,,,,,,,,,,............. +.................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---++--++,,,,,,,,,,,,,,,,,,............ +................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----%++---,,,,,,,,,,,,,,,,,............ +..............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%----,,,,,,,,,,,,,,,,,,........... +.............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----- %%+----,,,,,,,,,,,,,,,,,,.......... +...........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---%-+% ----,,,,,,,,,,,,,,,,,,,......... +..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+ +## %+%---,,,,,,,,,,,,,,,,,,......... +........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----# # +---,,,,,,,,,,,,,,,,,,........ +.......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------% %-----,,,,,,,,,,,,,,,,,........ +.....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---------+ ------,,,,,,,,,,,,,,,,,....... +....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----------+@ +-----------,,,,,,,,,,,,....... +..................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----@-------++ ++-----------,,,,,,,,,,,,...... +.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--+@% ---+ +@%%@ %%+@+@%------+-,,,,,,,,,,,...... +................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---- # ++% % @-----++--,,,,,,,,,,,..... +..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----+ % %%++ %+%@-,,,,,,,,,,,..... +.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+# #% ++-,,,,,,,,,,,,.... +............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------+ @---,,,,,,,,,,,,.... +..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------++% ---,,,,,,,,,,,,.... +.........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+ + %+---,,,,,,,,,,,,,... +........,,,,,,,,,,,,,,,,,,,,,--------------------@ +----,,,,,,,,,,,,... +.......,,,,,,,,,,,,,,,,,,,,,,- +-----------------+ ----,,,,,,,,,,,,... +.......,,,,,,,,,,,,,,,,,,,,,--++------+---------+% +++--,,,,,,,,,,,,.. +......,,,,,,,,,,,,,,,,,,,,,,--%+-----++--------- #+-,,,,,,,,,,,,.. +.....,,,,,,,,,,,,,,,,,,,,,,----#%++--+@ -+-----+% --,,,,,,,,,,,,.. +.....,,,,,,,,,,,,,,,,,,,,,,-----+## ++@ + +----% +--,,,,,,,,,,,,,.. +....,,,,,,,,,,,,,,,,,,,,,,------+@ @ @@++++# +--,,,,,,,,,,,,,.. +....,,,,,,,,,,,,,,,,,,,,,-------% #++% -,,,,,,,,,,,,,.. +...,,,,,,,,,,,,,,,,,,,,,------++%# %%@ %-,,,,,,,,,,,,,,. +...,,,,,,,,,,,,,,,,,,,--------+ % +--,,,,,,,,,,,,,,. +...,,,,,,,,,,,,,,,,,,-----+--++@ # --,,,,,,,,,,,,,,. +..,,,,,,,,,,,,,,,,,-------%+++% @--,,,,,,,,,,,,,,,. +..,,,,,,,,,,,-------------+ @#@ ---,,,,,,,,,,,,,,,. +..,,,,,,,,,---@--------@-+% +---,,,,,,,,,,,,,,,. +..,,,,,------- +-++++-+%%% +----,,,,,,,,,,,,,,,. +..,,,,,,------%--------++% +----,,,,,,,,,,,,,,,. +..,,,,,,,,,,--+----------++# ---,,,,,,,,,,,,,,,. +..,,,,,,,,,,,,------------+@@@% +--,,,,,,,,,,,,,,,. +..,,,,,,,,,,,,,,,,,------- +++% %--,,,,,,,,,,,,,,,. +...,,,,,,,,,,,,,,,,,,---------+@ @ --,,,,,,,,,,,,,,. +...,,,,,,,,,,,,,,,,,,,,------- # %@ +--,,,,,,,,,,,,,,. +...,,,,,,,,,,,,,,,,,,,,,-------++@ %+ %-,,,,,,,,,,,,,,. +....,,,,,,,,,,,,,,,,,,,,,------- %++% %-,,,,,,,,,,,,,.. +....,,,,,,,,,,,,,,,,,,,,,,------+# %# #@ ++++ +--,,,,,,,,,,,,,.. +.....,,,,,,,,,,,,,,,,,,,,,,-----+ %%++% +@+----+ +--,,,,,,,,,,,,,.. +.....,,,,,,,,,,,,,,,,,,,,,,,---%+++--+#+--------% #--,,,,,,,,,,,,.. +......,,,,,,,,,,,,,,,,,,,,,,--++-----%%--------- @#--,,,,,,,,,,,,.. +.......,,,,,,,,,,,,,,,,,,,,,---------------------+@ +-++,,,,,,,,,,,,... +........,,,,,,,,,,,,,,,,,,,,,--------------------+ ----,,,,,,,,,,,,... +.........,,,,,,,,,,,,,,,,,,,,----,,,------------- #+----,,,,,,,,,,,,... +..........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------+ + +---,,,,,,,,,,,,,... +...........,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+%# #---,,,,,,,,,,,,.... +............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,------+# @ @---,,,,,,,,,,,,.... +.............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+# + @--,,,,,,,,,,,,.... +..............,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+% %+@ %+-+ +++%-,,,,,,,,,,,..... +................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----% %@++ # % -----++-,,,,,,,,,,,,..... +.................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-- ++ ---+ + +%@ %++++++------%-,,,,,,,,,,,...... +...................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---- -------++ +------------,,,,,,,,,,,,...... +....................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----------+% +--------,,,,,,,,,,,,,,,....... +......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,--------+# -----,,,,,,,,,,,,,,,,,,....... +.......................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-------+ #----,,,,,,,,,,,,,,,,,,........ +.........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,----+% %#---,,,,,,,,,,,,,,,,,,,........ +..........................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+%+%@ %+%%--,,,,,,,,,,,,,,,,,,......... +............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---+-+% %----,,,,,,,,,,,,,,,,,,.......... +.............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%@+---,,,,,,,,,,,,,,,,,,,.......... +...............................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----+%----,,,,,,,,,,,,,,,,,,........... +................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,-----%+ +--,,,,,,,,,,,,,,,,,............ +..................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,---++----,,,,,,,,,,,,,,,,,............. +...................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,---@-----,,,,,,,,,,,,,,,,,............. +.....................................,,,,,,,,,,,,,,,,,,,,,,,,,,,-----,,,,,,,,,,,,,,,,,,,.............. + .....................................,,,,,,,,,,,,,,,,,,,,,,,,,,--%,,,,,,,,,,,,,,,,,,,,............... + .......................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................. + ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................. + ........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,................... + .........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,.................... + ..........................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,...................... + ............................................,,,,,,,,,,,,,,,,,,,,,,,,,,,,........................ + .............................................,,,,,,,,,,,,,,,,,,,,,,,,.......................... + ................................................,,,,,,,,,,,,,,,,,............................. + .....................................................,,,,.................................... + ........................................................................................... + ......................................................................................... + ...................................................................................... + .................................................................................... + ................................................................................. + .............................................................................. + ........................................................................... + ........................................................................ +# +# MDEV-17871: EXPLAIN for query with not used recursive cte +# +create table t1 (a int); +insert into t1 values (2), (1), (4), (3); +explain extended +with recursive cte as +(select * from t1 where a=1 union select a+1 from cte where a<3) +select * from cte as t; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ALL NULL NULL NULL NULL 4 100.00 +2 DERIVED t1 ALL NULL NULL NULL NULL 4 100.00 Using where +3 RECURSIVE UNION ALL NULL NULL NULL NULL 4 100.00 Using where +NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL +Warnings: +Note 1003 with recursive cte as (/* select#2 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 union /* select#3 */ select `cte`.`a` + 1 AS `a+1` from `cte` where `cte`.`a` < 3)/* select#1 */ select `t`.`a` AS `a` from `cte` `t` +with recursive cte as +(select * from t1 where a=1 union select a+1 from cte where a<3) +select * from cte as t; +a +1 +2 +3 +explain extended +with recursive cte as +(select * from t1 where a=1 union select a+1 from cte where a<3) +select * from t1 as t; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY t ALL NULL NULL NULL NULL 4 100.00 +Warnings: +Note 1003 with recursive cte as (/* select#2 */ select `*` AS `*` from `test`.`t1` where `a` = 1 union /* select#3 */ select `a` + 1 AS `a+1` from `cte` where `a` < 3)/* select#1 */ select `test`.`t`.`a` AS `a` from `test`.`t1` `t` +with recursive cte as +(select * from t1 where a=1 union select a+1 from cte where a<3) +select * from t1 as t; +a +2 +1 +4 +3 +create table t2 ( i1 int, i2 int); +insert into t2 values (1,1),(2,2); +explain +with recursive cte as +( select * from t1 union select s1.* from t1 as s1, cte where s1.i1 = cte.i2 ) +select * from t1 as t; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 4 +drop table t1,t2; +# End of 10.2 tests # # MDEV-14217 [db crash] Recursive CTE when SELECT includes new field # @@ -3595,3 +3981,4 @@ a 0 NULL DROP TABLE t1; +# End of 10.3 tests diff --git a/mysql-test/main/cte_recursive.test b/mysql-test/main/cte_recursive.test index 109f7d73011..483e1ea8c7a 100644 --- a/mysql-test/main/cte_recursive.test +++ b/mysql-test/main/cte_recursive.test @@ -1200,6 +1200,40 @@ select * from my_ancestors; drop table my_ancestors; +# +# MDEV-17967 Add a solution of the 8 queens problem to the regression test for CTE +# +# adapted to MariaDB from https://rosettacode.org/wiki/N-queens_problem#SQL +# +let $N=4; # 8 takes too long for a test +eval WITH RECURSIVE + positions(i) AS ( + VALUES(0) + UNION SELECT ALL + i+1 FROM positions WHERE i < $N*$N-1 + ), + solutions(board, n_queens) AS ( + SELECT REPEAT('-', $N*$N), 0 + FROM positions + UNION + SELECT + concat(substr(board, 1, i),'*',substr(board, i+2)),n_queens + 1 AS n_queens + FROM positions AS ps, solutions + WHERE n_queens < $N + AND substr(board,1,i) != '*' + AND NOT EXISTS ( + SELECT 1 FROM positions WHERE + substr(board,i+1,1) = '*' AND + ( + i % $N = ps.i % $N OR + i div $N = ps.i div $N OR + i div $N + (i % $N) = ps.i div $N + (ps.i % $N) OR + i div $N - (i % $N) = ps.i div $N - (ps.i % $N) + ) + ) + ) +SELECT regexp_replace(board,concat('(',REPEAT('.', $N),')'),'\\\\1\\n') n_queens FROM solutions WHERE n_queens = $N; + --echo # --echo # MDEV-10883: execution of prepared statement from SELECT --echo # with recursive CTE that renames columns @@ -2324,7 +2358,218 @@ SELECT func(); DROP FUNCTION func; ---echo # Start of 10.3 tests +--echo # +--echo # MDEV-17024: two materialized CTEs using the same recursive CTE +--echo # + +create table t1 (id int); +insert into t1 values (1), (2), (3); + +let $q= +with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1, cte2; + +eval $q; +eval explain extended $q; +eval prepare stmt from "$q"; +execute stmt; +execute stmt; + +create table t2 (c1 int, c2 int); +eval create procedure p() insert into t2 $q; +call p(); +select * from t2; + +let $q1= +with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1; + +eval $q1; + +let $q2= +with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from t1), +cte2 as +(select count(*) as c2 from t2) +select * from cte1,cte2; + +eval $q2; + +let $q3= +with recursive +rcte(a) as +(select 1 union select cast(a+1 as unsigned) from rcte where a < 10), +cte1 as +(select count(*) as c1 from rcte,t1 where a between 3 and 5 and id=a-3), +cte2 as +(select count(*) as c2 from rcte,t1 where a between 7 and 8 and id=a-7) +select * from cte1, cte2 where cte1.c1 = 3; + +eval $q3; + +drop procedure p; +drop table t1,t2; + +--echo # +--echo # MDEV-17201: recursive part with LIMIT +--echo # + +CREATE TABLE purchases ( + id int unsigned NOT NULL AUTO_INCREMENT, + pdate date NOT NULL, + quantity int unsigned NOT NULL, + p_id int unsigned NOT NULL, + PRIMARY KEY (id) +); +INSERT INTO purchases(pdate, quantity, p_id) VALUES + ('2014-11-01',5 ,1),('2014-11-03', 3 ,1), + ('2014-11-01',2 ,2),('2014-11-03', 4 ,2); + +CREATE TABLE expired ( + edate date NOT NULL, + quantity int unsigned NOT NULL, + p_id int unsigned NOT NULL, + PRIMARY KEY (edate,p_id) +); + +INSERT INTO expired VALUES ('2014-11-12', 5 ,1),('2014-11-08', 1 ,2); + +WITH RECURSIVE expired_map AS ( + SELECT edate AS expired_date, + CAST(NULL AS date) AS purchase_date, + 0 AS quantity, + e.p_id, + (SELECT MAX(id)+1 FROM purchases p + WHERE pdate <= edate AND p.p_id =p_id) AS purchase_processed, + quantity AS unresolved + FROM expired e + UNION + ( SELECT expired_date, + pdate, + IF(p.quantity < m.unresolved, p.quantity, m.unresolved), + p.p_id, + p.id, + IF(p.quantity < m.unresolved, m.unresolved - p.quantity, 0) + FROM purchases p JOIN expired_map m ON p.p_id = m.p_id + WHERE p.id < m.purchase_processed AND m.unresolved > 0 + ORDER BY p.id DESC + LIMIT 1 + ) +) +SELECT * FROM expired_map; + +DROP TABLE purchases, expired; + +--echo # +--echo # MDEV-17635: Two recursive CTEs, the second using the first +--echo # + +WITH RECURSIVE +x AS (SELECT 0 as k UNION ALL SELECT k + 1 FROM x WHERE k < 1), +z AS + ( SELECT k1 AS cx, k2 AS cy, k1, k2 + FROM (SELECT k AS k1 FROM x) x1 JOIN (SELECT k AS k2 FROM x) y1 + UNION + SELECT 1,1,1,1 FROM z) +SELECT * FROM z; + +--echo # https://wiki.postgresql.org/wiki/Mandelbrot_set: + +WITH RECURSIVE x(i) AS ( + SELECT CAST(0 AS DECIMAL(13, 10)) + UNION ALL + SELECT i + 1 + FROM x + WHERE i < 101 +), +Z(Ix, Iy, Cx, Cy, X, Y, I) AS ( + SELECT Ix, Iy, X, Y, X, Y, 0 + FROM (SELECT CAST(-2.2 + 0.031 * i AS DECIMAL(13, 10)) AS X, + i AS Ix FROM x) AS xgen + CROSS JOIN ( + SELECT CAST(-1.5 + 0.031 * i AS DECIMAL(13, 10)) AS Y, + i AS iY FROM x + ) AS ygen + UNION ALL + SELECT Ix, Iy, Cx, Cy, + CAST(X * X - Y * Y + Cx AS DECIMAL(13, 10)) AS X, + CAST(Y * X * 2 + Cy AS DECIMAL(13, 10)), I + 1 + FROM Z + WHERE X * X + Y * Y < 16.0 + AND I < 27 +), +Zt (Ix, Iy, I) AS ( + SELECT Ix, Iy, MAX(I) AS I + FROM Z + GROUP BY Iy, Ix + ORDER BY Iy, Ix +) +SELECT GROUP_CONCAT( + SUBSTRING( + ' .,,,-----++++%%%%@@@@#### ', + GREATEST(I, 1), + 1 + ) ORDER BY Ix SEPARATOR '' + ) AS 'Mandelbrot Set' + FROM Zt +GROUP BY Iy +ORDER BY Iy; + +--echo # +--echo # MDEV-17871: EXPLAIN for query with not used recursive cte +--echo # + +create table t1 (a int); +insert into t1 values (2), (1), (4), (3); + +let $rec_cte = +with recursive cte as + (select * from t1 where a=1 union select a+1 from cte where a<3); + +eval +explain extended +$rec_cte +select * from cte as t; + +eval +$rec_cte +select * from cte as t; + +eval +explain extended +$rec_cte +select * from t1 as t; + +eval +$rec_cte +select * from t1 as t; + +create table t2 ( i1 int, i2 int); +insert into t2 values (1,1),(2,2); + +explain +with recursive cte as + ( select * from t1 union select s1.* from t1 as s1, cte where s1.i1 = cte.i2 ) +select * from t1 as t; + +drop table t1,t2; + +--echo # End of 10.2 tests --echo # --echo # MDEV-14217 [db crash] Recursive CTE when SELECT includes new field @@ -2553,3 +2798,5 @@ WITH RECURSIVE cte AS SELECT * FROM cte; DROP TABLE t1; + +--echo # End of 10.3 tests diff --git a/mysql-test/main/ctype_big5.result b/mysql-test/main/ctype_big5.result index 2db4da51667..f61fc4c8400 100644 --- a/mysql-test/main/ctype_big5.result +++ b/mysql-test/main/ctype_big5.result @@ -565,70 +565,70 @@ COUNT(*) 28672 UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: -Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 -Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 -Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 -Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 -Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 -Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 -Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 -Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 -Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 -Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 -Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 -Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 -Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 -Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 -Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 -Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 -Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 -Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 -Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 -Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 -Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 -Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 -Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 -Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 -Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 -Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 -Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 -Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 -Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 -Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 -Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 -Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 -Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 -Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 -Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 -Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 -Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 -Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 -Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 -Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 -Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 -Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 -Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 -Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 -Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 -Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 -Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 -Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 -Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 -Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 -Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 -Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 -Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 -Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 -Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 -Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 -Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 -Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 -Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 -Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10 +Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11 +Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12 +Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13 +Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14 +Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15 +Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16 +Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17 +Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18 +Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19 +Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20 +Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21 +Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22 +Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23 +Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24 +Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25 +Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26 +Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27 +Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28 +Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29 +Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30 +Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31 +Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33 +Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34 +Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35 +Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36 +Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37 +Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38 +Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39 +Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40 +Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41 +Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42 +Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43 +Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44 +Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45 +Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46 +Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47 +Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48 +Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50 +Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51 +Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52 +Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53 +Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54 +Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55 +Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56 +Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59 +Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60 +Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61 +Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62 +Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63 +Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64 SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 13973 diff --git a/mysql-test/main/ctype_cp932_binlog_stm.result b/mysql-test/main/ctype_cp932_binlog_stm.result index f49400b63ff..089820d628a 100644 --- a/mysql-test/main/ctype_cp932_binlog_stm.result +++ b/mysql-test/main/ctype_cp932_binlog_stm.result @@ -98,70 +98,70 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: -Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 -Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 -Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 -Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 -Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 -Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 -Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 -Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 -Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 -Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 -Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 -Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 -Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 -Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 -Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 -Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 -Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 -Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 -Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 -Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 -Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 -Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 -Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 -Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 -Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 -Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 -Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 -Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 -Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 -Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 -Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 -Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 -Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 -Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 -Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 -Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 -Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 -Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 -Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 -Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 -Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 -Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 -Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 -Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 -Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 -Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 -Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 -Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 -Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 -Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 -Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 -Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 -Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 -Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 -Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 -Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 -Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 -Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 -Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 -Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10 +Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11 +Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12 +Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13 +Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14 +Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15 +Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16 +Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17 +Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18 +Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19 +Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20 +Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21 +Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22 +Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23 +Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24 +Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25 +Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26 +Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27 +Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28 +Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29 +Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30 +Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31 +Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33 +Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34 +Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35 +Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36 +Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37 +Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38 +Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39 +Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40 +Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41 +Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42 +Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43 +Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44 +Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45 +Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46 +Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47 +Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48 +Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50 +Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51 +Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52 +Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53 +Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54 +Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55 +Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56 +Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59 +Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60 +Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61 +Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62 +Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63 +Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64 SELECT COUNT(*) FROM t1; COUNT(*) 14623 diff --git a/mysql-test/main/ctype_eucjpms.result b/mysql-test/main/ctype_eucjpms.result index 507d0021a1f..be341cc7e68 100644 --- a/mysql-test/main/ctype_eucjpms.result +++ b/mysql-test/main/ctype_eucjpms.result @@ -10042,70 +10042,70 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: -Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 -Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 -Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 -Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 -Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 -Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 -Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 -Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 -Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 -Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 -Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 -Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 -Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 -Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 -Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 -Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 -Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 -Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 -Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 -Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 -Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 -Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 -Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 -Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 -Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 -Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 -Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 -Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 -Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 -Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 -Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 -Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 -Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 -Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 -Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 -Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 -Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 -Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 -Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 -Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 -Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 -Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 -Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 -Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 -Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 -Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 -Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 -Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 -Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 -Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 -Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 -Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 -Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 -Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 -Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 -Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 -Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 -Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 -Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 -Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10 +Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11 +Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12 +Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13 +Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14 +Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15 +Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16 +Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17 +Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18 +Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19 +Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20 +Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21 +Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22 +Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23 +Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24 +Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25 +Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26 +Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27 +Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28 +Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29 +Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30 +Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31 +Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33 +Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34 +Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35 +Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36 +Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37 +Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38 +Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39 +Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40 +Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41 +Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42 +Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43 +Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44 +Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45 +Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46 +Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47 +Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48 +Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50 +Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51 +Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52 +Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53 +Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54 +Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55 +Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56 +Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59 +Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60 +Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61 +Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62 +Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63 +Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64 SELECT COUNT(*) FROM t1; COUNT(*) 56959 diff --git a/mysql-test/main/ctype_euckr.result b/mysql-test/main/ctype_euckr.result index cc50ddd20be..3006e77412a 100644 --- a/mysql-test/main/ctype_euckr.result +++ b/mysql-test/main/ctype_euckr.result @@ -389,22 +389,22 @@ insert into t1 values (0xA181); insert into t1 values (0xA1FE); insert ignore into t1 values (0xA140); Warnings: -Warning 1366 Incorrect string value: '\xA1@' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xA1@' for column `test`.`t1`.`s1` at row 1 insert ignore into t1 values (0xA15B); Warnings: -Warning 1366 Incorrect string value: '\xA1[' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xA1[' for column `test`.`t1`.`s1` at row 1 insert ignore into t1 values (0xA160); Warnings: -Warning 1366 Incorrect string value: '\xA1`' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xA1`' for column `test`.`t1`.`s1` at row 1 insert ignore into t1 values (0xA17B); Warnings: -Warning 1366 Incorrect string value: '\xA1{' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xA1{' for column `test`.`t1`.`s1` at row 1 insert ignore into t1 values (0xA180); Warnings: -Warning 1366 Incorrect string value: '\xA1\x80' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xA1\x80' for column `test`.`t1`.`s1` at row 1 insert ignore into t1 values (0xA1FF); Warnings: -Warning 1366 Incorrect string value: '\xA1\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xA1\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1), hex(convert(s1 using utf8)) from t1 order by binary s1; hex(s1) hex(convert(s1 using utf8)) 3F3F 3F3F @@ -24428,70 +24428,70 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: -Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 -Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 -Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 -Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 -Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 -Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 -Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 -Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 -Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 -Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 -Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 -Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 -Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 -Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 -Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 -Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 -Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 -Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 -Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 -Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 -Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 -Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 -Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 -Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 -Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 -Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 -Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 -Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 -Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 -Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 -Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 -Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 -Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 -Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 -Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 -Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 -Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 -Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 -Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 -Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 -Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 -Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 -Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 -Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 -Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 -Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 -Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 -Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 -Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 -Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 -Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 -Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 -Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 -Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 -Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 -Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 -Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 -Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 -Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 -Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10 +Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11 +Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12 +Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13 +Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14 +Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15 +Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16 +Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17 +Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18 +Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19 +Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20 +Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21 +Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22 +Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23 +Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24 +Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25 +Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26 +Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27 +Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28 +Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29 +Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30 +Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31 +Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33 +Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34 +Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35 +Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36 +Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37 +Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38 +Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39 +Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40 +Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41 +Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42 +Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43 +Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44 +Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45 +Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46 +Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47 +Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48 +Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50 +Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51 +Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52 +Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53 +Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54 +Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55 +Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56 +Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59 +Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60 +Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61 +Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62 +Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63 +Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64 SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 22428 diff --git a/mysql-test/main/ctype_gb2312.result b/mysql-test/main/ctype_gb2312.result index c3c2eee9b1c..8a0950caea8 100644 --- a/mysql-test/main/ctype_gb2312.result +++ b/mysql-test/main/ctype_gb2312.result @@ -489,70 +489,70 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: -Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 -Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 -Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 -Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 -Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 -Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 -Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 -Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 -Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 -Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 -Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 -Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 -Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 -Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 -Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 -Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 -Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 -Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 -Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 -Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 -Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 -Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 -Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 -Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 -Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 -Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 -Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 -Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 -Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 -Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 -Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 -Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 -Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 -Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 -Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 -Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 -Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 -Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 -Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 -Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 -Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 -Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 -Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 -Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 -Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 -Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 -Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 -Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 -Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 -Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 -Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 -Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 -Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 -Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 -Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 -Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 -Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 -Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 -Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 -Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10 +Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11 +Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12 +Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13 +Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14 +Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15 +Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16 +Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17 +Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18 +Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19 +Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20 +Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21 +Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22 +Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23 +Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24 +Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25 +Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26 +Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27 +Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28 +Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29 +Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30 +Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31 +Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33 +Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34 +Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35 +Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36 +Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37 +Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38 +Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39 +Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40 +Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41 +Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42 +Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43 +Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44 +Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45 +Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46 +Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47 +Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48 +Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50 +Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51 +Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52 +Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53 +Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54 +Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55 +Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56 +Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59 +Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60 +Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61 +Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62 +Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63 +Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64 SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 8178 diff --git a/mysql-test/main/ctype_gbk.result b/mysql-test/main/ctype_gbk.result index 4515b9fbdbf..9bf69584725 100644 --- a/mysql-test/main/ctype_gbk.result +++ b/mysql-test/main/ctype_gbk.result @@ -515,70 +515,70 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: -Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 -Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 -Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 -Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 -Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 -Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 -Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 -Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 -Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 -Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 -Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 -Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 -Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 -Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 -Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 -Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 -Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 -Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 -Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 -Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 -Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 -Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 -Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 -Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 -Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 -Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 -Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 -Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 -Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 -Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 -Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 -Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 -Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 -Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 -Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 -Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 -Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 -Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 -Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 -Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 -Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 -Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 -Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 -Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 -Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 -Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 -Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 -Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 -Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 -Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 -Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 -Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 -Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 -Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 -Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 -Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 -Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 -Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 -Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 -Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10 +Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11 +Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12 +Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13 +Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14 +Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15 +Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16 +Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17 +Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18 +Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19 +Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20 +Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21 +Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22 +Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23 +Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24 +Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25 +Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26 +Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27 +Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28 +Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29 +Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30 +Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31 +Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33 +Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34 +Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35 +Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36 +Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37 +Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38 +Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39 +Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40 +Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41 +Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42 +Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43 +Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44 +Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45 +Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46 +Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47 +Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48 +Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50 +Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51 +Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52 +Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53 +Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54 +Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55 +Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56 +Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59 +Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60 +Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61 +Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62 +Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63 +Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64 SELECT COUNT(*) FROM t1 WHERE a<>'?'; COUNT(*) 23940 @@ -5196,25 +5196,25 @@ INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 WHERE type1='tail' OR type1='bad' OR type2='bad' ORDER BY b; Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 1 -Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 2 -Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 3 -Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 4 -Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 5 -Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 6 -Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 7 -Warning 1366 Incorrect string value: '\x80\xFF' for column 'c' at row 8 -Warning 1366 Incorrect string value: '\x81\xFF' for column 'c' at row 9 -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 10 -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 11 -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 12 -Warning 1366 Incorrect string value: '\xFF@' for column 'c' at row 13 -Warning 1366 Incorrect string value: '\xFF\x80' for column 'c' at row 14 -Warning 1366 Incorrect string value: '\xFF\x81' for column 'c' at row 15 -Warning 1366 Incorrect string value: '\xFF\xA1@' for column 'c' at row 16 -Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column 'c' at row 17 -Warning 1366 Incorrect string value: '\xFF\xFE@' for column 'c' at row 18 -Warning 1366 Incorrect string value: '\xFF\xFF' for column 'c' at row 19 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 1 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 2 +Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 3 +Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 4 +Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 5 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 6 +Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 7 +Warning 1366 Incorrect string value: '\x80\xFF' for column `test`.`t3`.`c` at row 8 +Warning 1366 Incorrect string value: '\x81\xFF' for column `test`.`t3`.`c` at row 9 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 10 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 11 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 12 +Warning 1366 Incorrect string value: '\xFF@' for column `test`.`t3`.`c` at row 13 +Warning 1366 Incorrect string value: '\xFF\x80' for column `test`.`t3`.`c` at row 14 +Warning 1366 Incorrect string value: '\xFF\x81' for column `test`.`t3`.`c` at row 15 +Warning 1366 Incorrect string value: '\xFF\xA1@' for column `test`.`t3`.`c` at row 16 +Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column `test`.`t3`.`c` at row 17 +Warning 1366 Incorrect string value: '\xFF\xFE@' for column `test`.`t3`.`c` at row 18 +Warning 1366 Incorrect string value: '\xFF\xFF' for column `test`.`t3`.`c` at row 19 SELECT COUNT(*) FROM t3; COUNT(*) 19 @@ -5252,14 +5252,14 @@ WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1)) AND (FIND_IN_SET('tail',type2) AND NOT FIND_IN_SET('ascii',type2)) ORDER BY b; Warnings: -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 1 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 2 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 3 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 4 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 5 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 7 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 8 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 1 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 2 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 3 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 4 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 5 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 6 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 7 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 8 SELECT COUNT(*) FROM t3; COUNT(*) 8 @@ -5282,7 +5282,7 @@ DELETE FROM t3; # INSERT INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b; Warnings: -Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 5 +Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 5 SELECT COUNT(*) FROM t3; COUNT(*) 6 @@ -5405,70 +5405,70 @@ INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 WHERE type1='tail' OR type1='bad' OR type2='bad' OR type3='bad' ORDER BY b; Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 1 -Warning 1366 Incorrect string value: '\x80\xFF' for column 'c' at row 2 -Warning 1366 Incorrect string value: '\x81\xFF' for column 'c' at row 3 -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 4 -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 5 -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 6 -Warning 1366 Incorrect string value: '\xFF@' for column 'c' at row 7 -Warning 1366 Incorrect string value: '\xFF\x80' for column 'c' at row 8 -Warning 1366 Incorrect string value: '\xFF\x81' for column 'c' at row 9 -Warning 1366 Incorrect string value: '\xFF\xA1@' for column 'c' at row 10 -Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column 'c' at row 11 -Warning 1366 Incorrect string value: '\xFF\xFE@' for column 'c' at row 12 -Warning 1366 Incorrect string value: '\xFF\xFF' for column 'c' at row 13 -Warning 1366 Incorrect string value: '\x80@@' for column 'c' at row 14 -Warning 1366 Incorrect string value: '\x80@\x80' for column 'c' at row 15 -Warning 1366 Incorrect string value: '\x80@\x81' for column 'c' at row 16 -Warning 1366 Incorrect string value: '\x80@\xA1@' for column 'c' at row 17 -Warning 1366 Incorrect string value: '\x80@\xA1\xA3' for column 'c' at row 18 -Warning 1366 Incorrect string value: '\x80@\xFE@' for column 'c' at row 19 -Warning 1366 Incorrect string value: '\x80@\xFF' for column 'c' at row 20 -Warning 1366 Incorrect string value: '\x80\x80@' for column 'c' at row 21 -Warning 1366 Incorrect string value: '\x80\x80\x80' for column 'c' at row 22 -Warning 1366 Incorrect string value: '\x80\x80\x81' for column 'c' at row 23 -Warning 1366 Incorrect string value: '\x80\x80\xA1@' for column 'c' at row 24 -Warning 1366 Incorrect string value: '\x80\x80\xA1\xA3' for column 'c' at row 25 -Warning 1366 Incorrect string value: '\x80\x80\xFE@' for column 'c' at row 26 -Warning 1366 Incorrect string value: '\x80\x80\xFF' for column 'c' at row 27 -Warning 1366 Incorrect string value: '\x80\x81@' for column 'c' at row 28 -Warning 1366 Incorrect string value: '\x80\x81\x80' for column 'c' at row 29 -Warning 1366 Incorrect string value: '\x80\x81\x81' for column 'c' at row 30 -Warning 1366 Incorrect string value: '\x80\x81\xA1@' for column 'c' at row 31 -Warning 1366 Incorrect string value: '\x80\x81\xA1\xA3' for column 'c' at row 32 -Warning 1366 Incorrect string value: '\x80\x81\xFE@' for column 'c' at row 33 -Warning 1366 Incorrect string value: '\x80\x81\xFF' for column 'c' at row 34 -Warning 1366 Incorrect string value: '\x80\xA1@@' for column 'c' at row 35 -Warning 1366 Incorrect string value: '\x80\xA1@\x80' for column 'c' at row 36 -Warning 1366 Incorrect string value: '\x80\xA1@\x81' for column 'c' at row 37 -Warning 1366 Incorrect string value: '\x80\xA1@\xA1@' for column 'c' at row 38 -Warning 1366 Incorrect string value: '\x80\xA1@\xA1\xA3' for column 'c' at row 39 -Warning 1366 Incorrect string value: '\x80\xA1@\xFE@' for column 'c' at row 40 -Warning 1366 Incorrect string value: '\x80\xA1@\xFF' for column 'c' at row 41 -Warning 1366 Incorrect string value: '\x80\xA1\xA3@' for column 'c' at row 42 -Warning 1366 Incorrect string value: '\x80\xA1\xA3\x80' for column 'c' at row 43 -Warning 1366 Incorrect string value: '\x80\xA1\xA3\x81' for column 'c' at row 44 -Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1@' for column 'c' at row 45 -Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1\xA3' for column 'c' at row 46 -Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFE@' for column 'c' at row 47 -Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFF' for column 'c' at row 48 -Warning 1366 Incorrect string value: '\x80\xFE@@' for column 'c' at row 49 -Warning 1366 Incorrect string value: '\x80\xFE@\x80' for column 'c' at row 50 -Warning 1366 Incorrect string value: '\x80\xFE@\x81' for column 'c' at row 51 -Warning 1366 Incorrect string value: '\x80\xFE@\xA1@' for column 'c' at row 52 -Warning 1366 Incorrect string value: '\x80\xFE@\xA1\xA3' for column 'c' at row 53 -Warning 1366 Incorrect string value: '\x80\xFE@\xFE@' for column 'c' at row 54 -Warning 1366 Incorrect string value: '\x80\xFE@\xFF' for column 'c' at row 55 -Warning 1366 Incorrect string value: '\x80\xFF@' for column 'c' at row 56 -Warning 1366 Incorrect string value: '\x80\xFF\x80' for column 'c' at row 57 -Warning 1366 Incorrect string value: '\x80\xFF\x81' for column 'c' at row 58 -Warning 1366 Incorrect string value: '\x80\xFF\xA1@' for column 'c' at row 59 -Warning 1366 Incorrect string value: '\x80\xFF\xA1\xA3' for column 'c' at row 60 -Warning 1366 Incorrect string value: '\x80\xFF\xFE@' for column 'c' at row 61 -Warning 1366 Incorrect string value: '\x80\xFF\xFF' for column 'c' at row 62 -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 63 -Warning 1366 Incorrect string value: '\xFF' for column 'c' at row 64 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 1 +Warning 1366 Incorrect string value: '\x80\xFF' for column `test`.`t3`.`c` at row 2 +Warning 1366 Incorrect string value: '\x81\xFF' for column `test`.`t3`.`c` at row 3 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 4 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 5 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 6 +Warning 1366 Incorrect string value: '\xFF@' for column `test`.`t3`.`c` at row 7 +Warning 1366 Incorrect string value: '\xFF\x80' for column `test`.`t3`.`c` at row 8 +Warning 1366 Incorrect string value: '\xFF\x81' for column `test`.`t3`.`c` at row 9 +Warning 1366 Incorrect string value: '\xFF\xA1@' for column `test`.`t3`.`c` at row 10 +Warning 1366 Incorrect string value: '\xFF\xA1\xA3' for column `test`.`t3`.`c` at row 11 +Warning 1366 Incorrect string value: '\xFF\xFE@' for column `test`.`t3`.`c` at row 12 +Warning 1366 Incorrect string value: '\xFF\xFF' for column `test`.`t3`.`c` at row 13 +Warning 1366 Incorrect string value: '\x80@@' for column `test`.`t3`.`c` at row 14 +Warning 1366 Incorrect string value: '\x80@\x80' for column `test`.`t3`.`c` at row 15 +Warning 1366 Incorrect string value: '\x80@\x81' for column `test`.`t3`.`c` at row 16 +Warning 1366 Incorrect string value: '\x80@\xA1@' for column `test`.`t3`.`c` at row 17 +Warning 1366 Incorrect string value: '\x80@\xA1\xA3' for column `test`.`t3`.`c` at row 18 +Warning 1366 Incorrect string value: '\x80@\xFE@' for column `test`.`t3`.`c` at row 19 +Warning 1366 Incorrect string value: '\x80@\xFF' for column `test`.`t3`.`c` at row 20 +Warning 1366 Incorrect string value: '\x80\x80@' for column `test`.`t3`.`c` at row 21 +Warning 1366 Incorrect string value: '\x80\x80\x80' for column `test`.`t3`.`c` at row 22 +Warning 1366 Incorrect string value: '\x80\x80\x81' for column `test`.`t3`.`c` at row 23 +Warning 1366 Incorrect string value: '\x80\x80\xA1@' for column `test`.`t3`.`c` at row 24 +Warning 1366 Incorrect string value: '\x80\x80\xA1\xA3' for column `test`.`t3`.`c` at row 25 +Warning 1366 Incorrect string value: '\x80\x80\xFE@' for column `test`.`t3`.`c` at row 26 +Warning 1366 Incorrect string value: '\x80\x80\xFF' for column `test`.`t3`.`c` at row 27 +Warning 1366 Incorrect string value: '\x80\x81@' for column `test`.`t3`.`c` at row 28 +Warning 1366 Incorrect string value: '\x80\x81\x80' for column `test`.`t3`.`c` at row 29 +Warning 1366 Incorrect string value: '\x80\x81\x81' for column `test`.`t3`.`c` at row 30 +Warning 1366 Incorrect string value: '\x80\x81\xA1@' for column `test`.`t3`.`c` at row 31 +Warning 1366 Incorrect string value: '\x80\x81\xA1\xA3' for column `test`.`t3`.`c` at row 32 +Warning 1366 Incorrect string value: '\x80\x81\xFE@' for column `test`.`t3`.`c` at row 33 +Warning 1366 Incorrect string value: '\x80\x81\xFF' for column `test`.`t3`.`c` at row 34 +Warning 1366 Incorrect string value: '\x80\xA1@@' for column `test`.`t3`.`c` at row 35 +Warning 1366 Incorrect string value: '\x80\xA1@\x80' for column `test`.`t3`.`c` at row 36 +Warning 1366 Incorrect string value: '\x80\xA1@\x81' for column `test`.`t3`.`c` at row 37 +Warning 1366 Incorrect string value: '\x80\xA1@\xA1@' for column `test`.`t3`.`c` at row 38 +Warning 1366 Incorrect string value: '\x80\xA1@\xA1\xA3' for column `test`.`t3`.`c` at row 39 +Warning 1366 Incorrect string value: '\x80\xA1@\xFE@' for column `test`.`t3`.`c` at row 40 +Warning 1366 Incorrect string value: '\x80\xA1@\xFF' for column `test`.`t3`.`c` at row 41 +Warning 1366 Incorrect string value: '\x80\xA1\xA3@' for column `test`.`t3`.`c` at row 42 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\x80' for column `test`.`t3`.`c` at row 43 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\x81' for column `test`.`t3`.`c` at row 44 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1@' for column `test`.`t3`.`c` at row 45 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\xA1\xA3' for column `test`.`t3`.`c` at row 46 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFE@' for column `test`.`t3`.`c` at row 47 +Warning 1366 Incorrect string value: '\x80\xA1\xA3\xFF' for column `test`.`t3`.`c` at row 48 +Warning 1366 Incorrect string value: '\x80\xFE@@' for column `test`.`t3`.`c` at row 49 +Warning 1366 Incorrect string value: '\x80\xFE@\x80' for column `test`.`t3`.`c` at row 50 +Warning 1366 Incorrect string value: '\x80\xFE@\x81' for column `test`.`t3`.`c` at row 51 +Warning 1366 Incorrect string value: '\x80\xFE@\xA1@' for column `test`.`t3`.`c` at row 52 +Warning 1366 Incorrect string value: '\x80\xFE@\xA1\xA3' for column `test`.`t3`.`c` at row 53 +Warning 1366 Incorrect string value: '\x80\xFE@\xFE@' for column `test`.`t3`.`c` at row 54 +Warning 1366 Incorrect string value: '\x80\xFE@\xFF' for column `test`.`t3`.`c` at row 55 +Warning 1366 Incorrect string value: '\x80\xFF@' for column `test`.`t3`.`c` at row 56 +Warning 1366 Incorrect string value: '\x80\xFF\x80' for column `test`.`t3`.`c` at row 57 +Warning 1366 Incorrect string value: '\x80\xFF\x81' for column `test`.`t3`.`c` at row 58 +Warning 1366 Incorrect string value: '\x80\xFF\xA1@' for column `test`.`t3`.`c` at row 59 +Warning 1366 Incorrect string value: '\x80\xFF\xA1\xA3' for column `test`.`t3`.`c` at row 60 +Warning 1366 Incorrect string value: '\x80\xFF\xFE@' for column `test`.`t3`.`c` at row 61 +Warning 1366 Incorrect string value: '\x80\xFF\xFF' for column `test`.`t3`.`c` at row 62 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 63 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t3`.`c` at row 64 SELECT COUNT(*) FROM t3; COUNT(*) 163 @@ -5650,30 +5650,30 @@ WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1)) AND type2='tail' ORDER BY b; Warnings: -Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 1 -Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 2 -Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 3 -Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 4 -Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 5 -Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 6 -Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 7 -Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 8 -Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 9 -Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 10 -Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 11 -Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 12 -Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 13 -Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 14 -Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 15 -Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 16 -Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 17 -Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 18 -Warning 1366 Incorrect string value: '\x80@' for column 'c' at row 19 -Warning 1366 Incorrect string value: '\x80\x80' for column 'c' at row 20 -Warning 1366 Incorrect string value: '\x80\x81' for column 'c' at row 21 -Warning 1366 Incorrect string value: '\x80\xA1@' for column 'c' at row 22 -Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column 'c' at row 23 -Warning 1366 Incorrect string value: '\x80\xFE@' for column 'c' at row 24 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 1 +Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 2 +Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 3 +Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 4 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 5 +Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 6 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 7 +Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 8 +Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 9 +Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 10 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 11 +Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 12 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 13 +Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 14 +Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 15 +Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 16 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 17 +Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 18 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t3`.`c` at row 19 +Warning 1366 Incorrect string value: '\x80\x80' for column `test`.`t3`.`c` at row 20 +Warning 1366 Incorrect string value: '\x80\x81' for column `test`.`t3`.`c` at row 21 +Warning 1366 Incorrect string value: '\x80\xA1@' for column `test`.`t3`.`c` at row 22 +Warning 1366 Incorrect string value: '\x80\xA1\xA3' for column `test`.`t3`.`c` at row 23 +Warning 1366 Incorrect string value: '\x80\xFE@' for column `test`.`t3`.`c` at row 24 SELECT COUNT(*) FROM t3; COUNT(*) 24 @@ -5717,22 +5717,22 @@ WHERE (FIND_IN_SET('mb2',type1) OR FIND_IN_SET('ascii',type1)) AND type3='tail' ORDER BY b; Warnings: -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 1 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 2 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 3 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 4 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 5 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 6 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 7 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 8 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 9 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 10 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 11 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 12 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 13 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 14 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 15 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 16 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 1 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 2 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 3 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 4 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 5 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 6 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 7 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 8 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 9 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 10 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 11 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 12 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 13 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 14 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 15 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 16 SELECT COUNT(*) FROM t3; COUNT(*) 16 @@ -5768,15 +5768,15 @@ AND NOT FIND_IN_SET('ascii',type3) AND NOT FIND_IN_SET('mb2',type3) ORDER BY b; Warnings: -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 1 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 2 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 3 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 4 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 5 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 7 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 8 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 9 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 1 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 2 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 3 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 4 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 5 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 6 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 7 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 8 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 9 SELECT COUNT(*) FROM t3; COUNT(*) 9 @@ -5852,28 +5852,28 @@ DELETE FROM t2 WHERE b IN (SELECT b FROM t3); DELETE FROM t3; INSERT IGNORE INTO t3 (b,c,comment) SELECT b,b,comment FROM t2 ORDER BY b; Warnings: -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 1 -Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 3 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 5 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 6 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 7 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 9 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 10 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 12 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 13 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 15 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 16 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 18 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 19 -Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 27 -Warning 1366 Incorrect string value: '\x80' for column 'c' at row 30 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 31 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 35 -Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 37 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 39 -Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 41 -Warning 1366 Incorrect string value: '\x81' for column 'c' at row 43 -Warning 1366 Incorrect string value: '\xA3' for column 'c' at row 45 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 1 +Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 3 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 5 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 6 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 7 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 9 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 10 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 12 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 13 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 15 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 16 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 18 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 19 +Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 27 +Warning 1366 Incorrect string value: '\x80' for column `test`.`t3`.`c` at row 30 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 31 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 35 +Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 37 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 39 +Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 41 +Warning 1366 Incorrect string value: '\x81' for column `test`.`t3`.`c` at row 43 +Warning 1366 Incorrect string value: '\xA3' for column `test`.`t3`.`c` at row 45 SELECT COUNT(*) FROM t3; COUNT(*) 46 diff --git a/mysql-test/main/ctype_latin1.result b/mysql-test/main/ctype_latin1.result index 43a84275629..705c719405b 100644 --- a/mysql-test/main/ctype_latin1.result +++ b/mysql-test/main/ctype_latin1.result @@ -7987,12 +7987,12 @@ SET NAMES utf8; CREATE TABLE t1 (a VARCHAR(10) CHARACTER SET latin1); INSERT IGNORE INTO t1 VALUES (''),('#'); Warnings: -Warning 1366 Incorrect string value: '\xC2' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\xC2#' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\xC2' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xC2#' for column `test`.`t1`.`a` at row 2 SHOW WARNINGS; Level Code Message -Warning 1366 Incorrect string value: '\xC2' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\xC2#' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\xC2' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xC2#' for column `test`.`t1`.`a` at row 2 SELECT HEX(a),a FROM t1; HEX(a) a 3F ? @@ -8046,6 +8046,15 @@ ABCDEFGHI-ABCDEFGHI DROP TABLE t1; SET optimizer_switch=@save_optimizer_switch; # +# MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT +# +SET NAMES latin1; +CREATE TABLE t1 (a CHAR); +CREATE TABLE t2 (b ENUM('foo','bar')); +INSERT INTO t1 VALUES ('1'); +INSERT INTO t2 SELECT * FROM t1; +DROP TABLE t1, t2; +# # End of 10.0 tests # # diff --git a/mysql-test/main/ctype_latin1.test b/mysql-test/main/ctype_latin1.test index 61df80e2186..a556c86c016 100644 --- a/mysql-test/main/ctype_latin1.test +++ b/mysql-test/main/ctype_latin1.test @@ -266,6 +266,18 @@ SET NAMES latin1; --source include/ctype_mdev13118.inc +--echo # +--echo # MDEV-17298 ASAN unknown-crash / READ of size 1 in my_strntoul_8bit upon INSERT .. SELECT +--echo # + +SET NAMES latin1; +CREATE TABLE t1 (a CHAR); +CREATE TABLE t2 (b ENUM('foo','bar')); +INSERT INTO t1 VALUES ('1'); +INSERT INTO t2 SELECT * FROM t1; +DROP TABLE t1, t2; + + --echo # --echo # End of 10.0 tests --echo # diff --git a/mysql-test/main/ctype_many.result b/mysql-test/main/ctype_many.result index d73a478b0c0..25802af4b5d 100644 --- a/mysql-test/main/ctype_many.result +++ b/mysql-test/main/ctype_many.result @@ -1767,8 +1767,8 @@ CREATE TABLE t2 (a VARCHAR(10) CHARACTER SET ucs2); INSERT INTO t1 VALUES (0x10082), (0x12345); INSERT IGNORE INTO t2 SELECT * FROM t1; Warnings: -Warning 1366 Incorrect string value: '\x00\x01\x00\x82' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x00\x01\x23\x45' for column 'a' at row 2 +Warning 1366 Incorrect string value: '\x00\x01\x00\x82' for column `test`.`t2`.`a` at row 1 +Warning 1366 Incorrect string value: '\x00\x01\x23\x45' for column `test`.`t2`.`a` at row 2 SELECT HEX(a) FROM t2; HEX(a) 003F diff --git a/mysql-test/main/ctype_recoding.result b/mysql-test/main/ctype_recoding.result index 806d9dc6997..4668ddf9684 100644 --- a/mysql-test/main/ctype_recoding.result +++ b/mysql-test/main/ctype_recoding.result @@ -171,8 +171,8 @@ create table t1 (a char(10) character set koi8r, b text character set koi8r); insert into t1 values ('test','test'); insert ignore into t1 values ('',''); Warnings: -Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column 'b' at row 1 +Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xCA\xC3\xD5\xCB' for column `test`.`t1`.`b` at row 1 drop table t1; set names koi8r; create table t1 (a char(10) character set cp1251); diff --git a/mysql-test/main/ctype_sjis.result b/mysql-test/main/ctype_sjis.result index c19a0008e11..090bb12fc42 100644 --- a/mysql-test/main/ctype_sjis.result +++ b/mysql-test/main/ctype_sjis.result @@ -412,70 +412,70 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: -Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 -Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 -Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 -Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 -Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 -Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 -Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 -Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 -Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 -Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 -Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 -Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 -Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 -Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 -Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 -Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 -Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 -Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 -Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 -Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 -Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 -Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 -Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 -Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 -Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 -Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 -Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 -Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 -Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 -Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 -Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 -Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 -Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 -Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 -Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 -Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 -Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 -Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 -Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 -Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 -Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 -Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 -Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 -Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 -Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 -Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 -Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 -Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 -Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 -Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 -Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 -Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 -Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 -Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 -Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 -Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 -Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 -Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 -Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 -Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10 +Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11 +Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12 +Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13 +Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14 +Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15 +Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16 +Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17 +Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18 +Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19 +Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20 +Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21 +Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22 +Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23 +Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24 +Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25 +Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26 +Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27 +Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28 +Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29 +Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30 +Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31 +Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33 +Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34 +Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35 +Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36 +Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37 +Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38 +Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39 +Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40 +Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41 +Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42 +Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43 +Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44 +Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45 +Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46 +Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47 +Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48 +Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50 +Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51 +Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52 +Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53 +Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54 +Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55 +Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56 +Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59 +Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60 +Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61 +Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62 +Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63 +Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64 SELECT COUNT(*) FROM t1; COUNT(*) 14623 diff --git a/mysql-test/main/ctype_uca.result b/mysql-test/main/ctype_uca.result index 725e744c44e..7394ec82924 100644 --- a/mysql-test/main/ctype_uca.result +++ b/mysql-test/main/ctype_uca.result @@ -6743,13 +6743,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -6766,21 +6766,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -6824,7 +6824,7 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -6845,13 +6845,13 @@ az aЀ aր Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -6872,7 +6872,7 @@ az aЀ aր Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z @@ -6884,23 +6884,23 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 ALTER TABLE t1 DROP KEY ch; # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); @@ -6987,13 +6987,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -7010,21 +7010,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -13940,6 +13940,27 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 'oe' and `test`.`t1`.`a` = 'oe' DROP TABLE t1; # +# MDEV-17064 LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx +# +CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci); +INSERT INTO t1 VALUES ('radio! test'); +SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!'; +name +radio! test +ALTER TABLE t1 CHANGE COLUMN name name VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; +SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!'; +name +radio! test +DROP TABLE t1; +CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci); +INSERT INTO t1 VALUES ('radio! test'); +SELECT name LIKE '%!!%' ESCAPE '!' AS c1, +name LIKE '%!!%' COLLATE utf8_general_ci ESCAPE '!' AS c2 +FROM t1; +c1 c2 +1 1 +DROP TABLE t1; +# # End of MariaDB-10.0 tests # # diff --git a/mysql-test/main/ctype_uca.test b/mysql-test/main/ctype_uca.test index 15a945fde6d..82be0305f07 100644 --- a/mysql-test/main/ctype_uca.test +++ b/mysql-test/main/ctype_uca.test @@ -618,6 +618,24 @@ EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' AND a='oe' COLLATE utf8_german2_c EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='oe' COLLATE utf8_german2_ci AND a='oe'; DROP TABLE t1; +--echo # +--echo # MDEV-17064 LIKE function has error behavior on the fields in which the collation is xxx_unicode_xx +--echo # + +CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci); +INSERT INTO t1 VALUES ('radio! test'); +SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!'; +ALTER TABLE t1 CHANGE COLUMN name name VARCHAR(20) CHARACTER SET 'utf8' COLLATE 'utf8_general_ci'; +SELECT * FROM t1 WHERE name LIKE '%!!%' ESCAPE '!'; +DROP TABLE t1; + +CREATE TABLE t1 (name VARCHAR(20) CHARACTER SET utf8 COLLATE utf8_unicode_ci); +INSERT INTO t1 VALUES ('radio! test'); +SELECT name LIKE '%!!%' ESCAPE '!' AS c1, + name LIKE '%!!%' COLLATE utf8_general_ci ESCAPE '!' AS c2 +FROM t1; +DROP TABLE t1; + --echo # --echo # End of MariaDB-10.0 tests --echo # diff --git a/mysql-test/main/ctype_uca_innodb.result b/mysql-test/main/ctype_uca_innodb.result index c04a99c8cd3..bd6f3b8a21f 100644 --- a/mysql-test/main/ctype_uca_innodb.result +++ b/mysql-test/main/ctype_uca_innodb.result @@ -24,13 +24,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -47,21 +47,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -105,7 +105,7 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -126,13 +126,13 @@ az aЀ aր Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -153,7 +153,7 @@ az aЀ aր Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z @@ -165,23 +165,23 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 ALTER TABLE t1 DROP KEY ch; # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); diff --git a/mysql-test/main/ctype_ucs.result b/mysql-test/main/ctype_ucs.result index 5641726a831..efd113e4847 100644 --- a/mysql-test/main/ctype_ucs.result +++ b/mysql-test/main/ctype_ucs.result @@ -5409,7 +5409,7 @@ ERROR 22003: Out of range value for column 'a' at row 1 SET sql_mode=DEFAULT; INSERT IGNORE INTO t1 VALUES (CONVERT('aaa' USING ucs2)); Warnings: -Warning 1366 Incorrect decimal value: 'aaa' for column 'a' at row 1 +Warning 1366 Incorrect decimal value: 'aaa' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; # # End of 5.6 tests @@ -6383,3 +6383,15 @@ DEALLOCATE PREPARE stmt; # # End of 10.2 tests # +# +# Start of 10.4 tests +# +# +# MDEV-17995 INET6_NTOA(ucs2_input) erroneously returns NULL +# +SELECT HEX(INET6_ATON('1::1')), HEX(INET6_ATON(CONVERT('1::1' USING ucs2))); +HEX(INET6_ATON('1::1')) HEX(INET6_ATON(CONVERT('1::1' USING ucs2))) +00010000000000000000000000000001 00010000000000000000000000000001 +# +# End of 10.4 tests +# diff --git a/mysql-test/main/ctype_ucs.test b/mysql-test/main/ctype_ucs.test index d0d463c0340..983f48edbc5 100644 --- a/mysql-test/main/ctype_ucs.test +++ b/mysql-test/main/ctype_ucs.test @@ -1094,3 +1094,18 @@ DEALLOCATE PREPARE stmt; --echo # --echo # End of 10.2 tests --echo # + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-17995 INET6_NTOA(ucs2_input) erroneously returns NULL +--echo # + +SELECT HEX(INET6_ATON('1::1')), HEX(INET6_ATON(CONVERT('1::1' USING ucs2))); + + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/ctype_ujis.result b/mysql-test/main/ctype_ujis.result index 0b1cf606f0b..a1fcce33bbb 100644 --- a/mysql-test/main/ctype_ujis.result +++ b/mysql-test/main/ctype_ujis.result @@ -2571,70 +2571,70 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 UPDATE IGNORE t1 SET a=unhex(code) ORDER BY code; Warnings: -Warning 1366 Incorrect string value: '\x80 ' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\x80!' for column 'a' at row 2 -Warning 1366 Incorrect string value: '\x80"' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\x80#' for column 'a' at row 4 -Warning 1366 Incorrect string value: '\x80$' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\x80%' for column 'a' at row 6 -Warning 1366 Incorrect string value: '\x80&' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\x80'' for column 'a' at row 8 -Warning 1366 Incorrect string value: '\x80(' for column 'a' at row 9 -Warning 1366 Incorrect string value: '\x80)' for column 'a' at row 10 -Warning 1366 Incorrect string value: '\x80*' for column 'a' at row 11 -Warning 1366 Incorrect string value: '\x80+' for column 'a' at row 12 -Warning 1366 Incorrect string value: '\x80,' for column 'a' at row 13 -Warning 1366 Incorrect string value: '\x80-' for column 'a' at row 14 -Warning 1366 Incorrect string value: '\x80.' for column 'a' at row 15 -Warning 1366 Incorrect string value: '\x80/' for column 'a' at row 16 -Warning 1366 Incorrect string value: '\x800' for column 'a' at row 17 -Warning 1366 Incorrect string value: '\x801' for column 'a' at row 18 -Warning 1366 Incorrect string value: '\x802' for column 'a' at row 19 -Warning 1366 Incorrect string value: '\x803' for column 'a' at row 20 -Warning 1366 Incorrect string value: '\x804' for column 'a' at row 21 -Warning 1366 Incorrect string value: '\x805' for column 'a' at row 22 -Warning 1366 Incorrect string value: '\x806' for column 'a' at row 23 -Warning 1366 Incorrect string value: '\x807' for column 'a' at row 24 -Warning 1366 Incorrect string value: '\x808' for column 'a' at row 25 -Warning 1366 Incorrect string value: '\x809' for column 'a' at row 26 -Warning 1366 Incorrect string value: '\x80:' for column 'a' at row 27 -Warning 1366 Incorrect string value: '\x80;' for column 'a' at row 28 -Warning 1366 Incorrect string value: '\x80<' for column 'a' at row 29 -Warning 1366 Incorrect string value: '\x80=' for column 'a' at row 30 -Warning 1366 Incorrect string value: '\x80>' for column 'a' at row 31 -Warning 1366 Incorrect string value: '\x80?' for column 'a' at row 32 -Warning 1366 Incorrect string value: '\x80@' for column 'a' at row 33 -Warning 1366 Incorrect string value: '\x80A' for column 'a' at row 34 -Warning 1366 Incorrect string value: '\x80B' for column 'a' at row 35 -Warning 1366 Incorrect string value: '\x80C' for column 'a' at row 36 -Warning 1366 Incorrect string value: '\x80D' for column 'a' at row 37 -Warning 1366 Incorrect string value: '\x80E' for column 'a' at row 38 -Warning 1366 Incorrect string value: '\x80F' for column 'a' at row 39 -Warning 1366 Incorrect string value: '\x80G' for column 'a' at row 40 -Warning 1366 Incorrect string value: '\x80H' for column 'a' at row 41 -Warning 1366 Incorrect string value: '\x80I' for column 'a' at row 42 -Warning 1366 Incorrect string value: '\x80J' for column 'a' at row 43 -Warning 1366 Incorrect string value: '\x80K' for column 'a' at row 44 -Warning 1366 Incorrect string value: '\x80L' for column 'a' at row 45 -Warning 1366 Incorrect string value: '\x80M' for column 'a' at row 46 -Warning 1366 Incorrect string value: '\x80N' for column 'a' at row 47 -Warning 1366 Incorrect string value: '\x80O' for column 'a' at row 48 -Warning 1366 Incorrect string value: '\x80P' for column 'a' at row 49 -Warning 1366 Incorrect string value: '\x80Q' for column 'a' at row 50 -Warning 1366 Incorrect string value: '\x80R' for column 'a' at row 51 -Warning 1366 Incorrect string value: '\x80S' for column 'a' at row 52 -Warning 1366 Incorrect string value: '\x80T' for column 'a' at row 53 -Warning 1366 Incorrect string value: '\x80U' for column 'a' at row 54 -Warning 1366 Incorrect string value: '\x80V' for column 'a' at row 55 -Warning 1366 Incorrect string value: '\x80W' for column 'a' at row 56 -Warning 1366 Incorrect string value: '\x80X' for column 'a' at row 57 -Warning 1366 Incorrect string value: '\x80Y' for column 'a' at row 58 -Warning 1366 Incorrect string value: '\x80Z' for column 'a' at row 59 -Warning 1366 Incorrect string value: '\x80[' for column 'a' at row 60 -Warning 1366 Incorrect string value: '\x80\' for column 'a' at row 61 -Warning 1366 Incorrect string value: '\x80]' for column 'a' at row 62 -Warning 1366 Incorrect string value: '\x80^' for column 'a' at row 63 -Warning 1366 Incorrect string value: '\x80_' for column 'a' at row 64 +Warning 1366 Incorrect string value: '\x80 ' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\x80!' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect string value: '\x80"' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\x80#' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect string value: '\x80$' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\x80%' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect string value: '\x80&' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\x80'' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect string value: '\x80(' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect string value: '\x80)' for column `test`.`t1`.`a` at row 10 +Warning 1366 Incorrect string value: '\x80*' for column `test`.`t1`.`a` at row 11 +Warning 1366 Incorrect string value: '\x80+' for column `test`.`t1`.`a` at row 12 +Warning 1366 Incorrect string value: '\x80,' for column `test`.`t1`.`a` at row 13 +Warning 1366 Incorrect string value: '\x80-' for column `test`.`t1`.`a` at row 14 +Warning 1366 Incorrect string value: '\x80.' for column `test`.`t1`.`a` at row 15 +Warning 1366 Incorrect string value: '\x80/' for column `test`.`t1`.`a` at row 16 +Warning 1366 Incorrect string value: '\x800' for column `test`.`t1`.`a` at row 17 +Warning 1366 Incorrect string value: '\x801' for column `test`.`t1`.`a` at row 18 +Warning 1366 Incorrect string value: '\x802' for column `test`.`t1`.`a` at row 19 +Warning 1366 Incorrect string value: '\x803' for column `test`.`t1`.`a` at row 20 +Warning 1366 Incorrect string value: '\x804' for column `test`.`t1`.`a` at row 21 +Warning 1366 Incorrect string value: '\x805' for column `test`.`t1`.`a` at row 22 +Warning 1366 Incorrect string value: '\x806' for column `test`.`t1`.`a` at row 23 +Warning 1366 Incorrect string value: '\x807' for column `test`.`t1`.`a` at row 24 +Warning 1366 Incorrect string value: '\x808' for column `test`.`t1`.`a` at row 25 +Warning 1366 Incorrect string value: '\x809' for column `test`.`t1`.`a` at row 26 +Warning 1366 Incorrect string value: '\x80:' for column `test`.`t1`.`a` at row 27 +Warning 1366 Incorrect string value: '\x80;' for column `test`.`t1`.`a` at row 28 +Warning 1366 Incorrect string value: '\x80<' for column `test`.`t1`.`a` at row 29 +Warning 1366 Incorrect string value: '\x80=' for column `test`.`t1`.`a` at row 30 +Warning 1366 Incorrect string value: '\x80>' for column `test`.`t1`.`a` at row 31 +Warning 1366 Incorrect string value: '\x80?' for column `test`.`t1`.`a` at row 32 +Warning 1366 Incorrect string value: '\x80@' for column `test`.`t1`.`a` at row 33 +Warning 1366 Incorrect string value: '\x80A' for column `test`.`t1`.`a` at row 34 +Warning 1366 Incorrect string value: '\x80B' for column `test`.`t1`.`a` at row 35 +Warning 1366 Incorrect string value: '\x80C' for column `test`.`t1`.`a` at row 36 +Warning 1366 Incorrect string value: '\x80D' for column `test`.`t1`.`a` at row 37 +Warning 1366 Incorrect string value: '\x80E' for column `test`.`t1`.`a` at row 38 +Warning 1366 Incorrect string value: '\x80F' for column `test`.`t1`.`a` at row 39 +Warning 1366 Incorrect string value: '\x80G' for column `test`.`t1`.`a` at row 40 +Warning 1366 Incorrect string value: '\x80H' for column `test`.`t1`.`a` at row 41 +Warning 1366 Incorrect string value: '\x80I' for column `test`.`t1`.`a` at row 42 +Warning 1366 Incorrect string value: '\x80J' for column `test`.`t1`.`a` at row 43 +Warning 1366 Incorrect string value: '\x80K' for column `test`.`t1`.`a` at row 44 +Warning 1366 Incorrect string value: '\x80L' for column `test`.`t1`.`a` at row 45 +Warning 1366 Incorrect string value: '\x80M' for column `test`.`t1`.`a` at row 46 +Warning 1366 Incorrect string value: '\x80N' for column `test`.`t1`.`a` at row 47 +Warning 1366 Incorrect string value: '\x80O' for column `test`.`t1`.`a` at row 48 +Warning 1366 Incorrect string value: '\x80P' for column `test`.`t1`.`a` at row 49 +Warning 1366 Incorrect string value: '\x80Q' for column `test`.`t1`.`a` at row 50 +Warning 1366 Incorrect string value: '\x80R' for column `test`.`t1`.`a` at row 51 +Warning 1366 Incorrect string value: '\x80S' for column `test`.`t1`.`a` at row 52 +Warning 1366 Incorrect string value: '\x80T' for column `test`.`t1`.`a` at row 53 +Warning 1366 Incorrect string value: '\x80U' for column `test`.`t1`.`a` at row 54 +Warning 1366 Incorrect string value: '\x80V' for column `test`.`t1`.`a` at row 55 +Warning 1366 Incorrect string value: '\x80W' for column `test`.`t1`.`a` at row 56 +Warning 1366 Incorrect string value: '\x80X' for column `test`.`t1`.`a` at row 57 +Warning 1366 Incorrect string value: '\x80Y' for column `test`.`t1`.`a` at row 58 +Warning 1366 Incorrect string value: '\x80Z' for column `test`.`t1`.`a` at row 59 +Warning 1366 Incorrect string value: '\x80[' for column `test`.`t1`.`a` at row 60 +Warning 1366 Incorrect string value: '\x80\' for column `test`.`t1`.`a` at row 61 +Warning 1366 Incorrect string value: '\x80]' for column `test`.`t1`.`a` at row 62 +Warning 1366 Incorrect string value: '\x80^' for column `test`.`t1`.`a` at row 63 +Warning 1366 Incorrect string value: '\x80_' for column `test`.`t1`.`a` at row 64 SELECT COUNT(*) FROM t1; COUNT(*) 44671 diff --git a/mysql-test/main/ctype_ujis_ucs2.result b/mysql-test/main/ctype_ujis_ucs2.result index 77961046346..cb501fd065f 100644 --- a/mysql-test/main/ctype_ujis_ucs2.result +++ b/mysql-test/main/ctype_ujis_ucs2.result @@ -1140,70 +1140,70 @@ update t1 set name='User defined range #2' where ujis >= 0x8FF5A1 and ujis <= 0x update t1 set name='UNASSIGNED' where name=''; update ignore t1 set ucs2=ujis, ujis2=ucs2; Warnings: -Warning 1366 Incorrect string value: '\xA2\xAF' for column 'ucs2' at row 237 -Warning 1366 Incorrect string value: '\xA2\xB0' for column 'ucs2' at row 238 -Warning 1366 Incorrect string value: '\xA2\xB1' for column 'ucs2' at row 239 -Warning 1366 Incorrect string value: '\xA2\xB2' for column 'ucs2' at row 240 -Warning 1366 Incorrect string value: '\xA2\xB3' for column 'ucs2' at row 241 -Warning 1366 Incorrect string value: '\xA2\xB4' for column 'ucs2' at row 242 -Warning 1366 Incorrect string value: '\xA2\xB5' for column 'ucs2' at row 243 -Warning 1366 Incorrect string value: '\xA2\xB6' for column 'ucs2' at row 244 -Warning 1366 Incorrect string value: '\xA2\xB7' for column 'ucs2' at row 245 -Warning 1366 Incorrect string value: '\xA2\xB8' for column 'ucs2' at row 246 -Warning 1366 Incorrect string value: '\xA2\xB9' for column 'ucs2' at row 247 -Warning 1366 Incorrect string value: '\xA2\xC2' for column 'ucs2' at row 256 -Warning 1366 Incorrect string value: '\xA2\xC3' for column 'ucs2' at row 257 -Warning 1366 Incorrect string value: '\xA2\xC4' for column 'ucs2' at row 258 -Warning 1366 Incorrect string value: '\xA2\xC5' for column 'ucs2' at row 259 -Warning 1366 Incorrect string value: '\xA2\xC6' for column 'ucs2' at row 260 -Warning 1366 Incorrect string value: '\xA2\xC7' for column 'ucs2' at row 261 -Warning 1366 Incorrect string value: '\xA2\xC8' for column 'ucs2' at row 262 -Warning 1366 Incorrect string value: '\xA2\xC9' for column 'ucs2' at row 263 -Warning 1366 Incorrect string value: '\xA2\xD1' for column 'ucs2' at row 271 -Warning 1366 Incorrect string value: '\xA2\xD2' for column 'ucs2' at row 272 -Warning 1366 Incorrect string value: '\xA2\xD3' for column 'ucs2' at row 273 -Warning 1366 Incorrect string value: '\xA2\xD4' for column 'ucs2' at row 274 -Warning 1366 Incorrect string value: '\xA2\xD5' for column 'ucs2' at row 275 -Warning 1366 Incorrect string value: '\xA2\xD6' for column 'ucs2' at row 276 -Warning 1366 Incorrect string value: '\xA2\xD7' for column 'ucs2' at row 277 -Warning 1366 Incorrect string value: '\xA2\xD8' for column 'ucs2' at row 278 -Warning 1366 Incorrect string value: '\xA2\xD9' for column 'ucs2' at row 279 -Warning 1366 Incorrect string value: '\xA2\xDA' for column 'ucs2' at row 280 -Warning 1366 Incorrect string value: '\xA2\xDB' for column 'ucs2' at row 281 -Warning 1366 Incorrect string value: '\xA2\xEB' for column 'ucs2' at row 297 -Warning 1366 Incorrect string value: '\xA2\xEC' for column 'ucs2' at row 298 -Warning 1366 Incorrect string value: '\xA2\xED' for column 'ucs2' at row 299 -Warning 1366 Incorrect string value: '\xA2\xEE' for column 'ucs2' at row 300 -Warning 1366 Incorrect string value: '\xA2\xEF' for column 'ucs2' at row 301 -Warning 1366 Incorrect string value: '\xA2\xF0' for column 'ucs2' at row 302 -Warning 1366 Incorrect string value: '\xA2\xF1' for column 'ucs2' at row 303 -Warning 1366 Incorrect string value: '\xA2\xFA' for column 'ucs2' at row 312 -Warning 1366 Incorrect string value: '\xA2\xFB' for column 'ucs2' at row 313 -Warning 1366 Incorrect string value: '\xA2\xFC' for column 'ucs2' at row 314 -Warning 1366 Incorrect string value: '\xA2\xFD' for column 'ucs2' at row 315 -Warning 1366 Incorrect string value: '\xA3\xA1' for column 'ucs2' at row 317 -Warning 1366 Incorrect string value: '\xA3\xA2' for column 'ucs2' at row 318 -Warning 1366 Incorrect string value: '\xA3\xA3' for column 'ucs2' at row 319 -Warning 1366 Incorrect string value: '\xA3\xA4' for column 'ucs2' at row 320 -Warning 1366 Incorrect string value: '\xA3\xA5' for column 'ucs2' at row 321 -Warning 1366 Incorrect string value: '\xA3\xA6' for column 'ucs2' at row 322 -Warning 1366 Incorrect string value: '\xA3\xA7' for column 'ucs2' at row 323 -Warning 1366 Incorrect string value: '\xA3\xA8' for column 'ucs2' at row 324 -Warning 1366 Incorrect string value: '\xA3\xA9' for column 'ucs2' at row 325 -Warning 1366 Incorrect string value: '\xA3\xAA' for column 'ucs2' at row 326 -Warning 1366 Incorrect string value: '\xA3\xAB' for column 'ucs2' at row 327 -Warning 1366 Incorrect string value: '\xA3\xAC' for column 'ucs2' at row 328 -Warning 1366 Incorrect string value: '\xA3\xAD' for column 'ucs2' at row 329 -Warning 1366 Incorrect string value: '\xA3\xAE' for column 'ucs2' at row 330 -Warning 1366 Incorrect string value: '\xA3\xAF' for column 'ucs2' at row 331 -Warning 1366 Incorrect string value: '\xA3\xBA' for column 'ucs2' at row 342 -Warning 1366 Incorrect string value: '\xA3\xBB' for column 'ucs2' at row 343 -Warning 1366 Incorrect string value: '\xA3\xBC' for column 'ucs2' at row 344 -Warning 1366 Incorrect string value: '\xA3\xBD' for column 'ucs2' at row 345 -Warning 1366 Incorrect string value: '\xA3\xBE' for column 'ucs2' at row 346 -Warning 1366 Incorrect string value: '\xA3\xBF' for column 'ucs2' at row 347 -Warning 1366 Incorrect string value: '\xA3\xC0' for column 'ucs2' at row 348 -Warning 1366 Incorrect string value: '\xA3\xDB' for column 'ucs2' at row 375 +Warning 1366 Incorrect string value: '\xA2\xAF' for column `test`.`t1`.`ucs2` at row 237 +Warning 1366 Incorrect string value: '\xA2\xB0' for column `test`.`t1`.`ucs2` at row 238 +Warning 1366 Incorrect string value: '\xA2\xB1' for column `test`.`t1`.`ucs2` at row 239 +Warning 1366 Incorrect string value: '\xA2\xB2' for column `test`.`t1`.`ucs2` at row 240 +Warning 1366 Incorrect string value: '\xA2\xB3' for column `test`.`t1`.`ucs2` at row 241 +Warning 1366 Incorrect string value: '\xA2\xB4' for column `test`.`t1`.`ucs2` at row 242 +Warning 1366 Incorrect string value: '\xA2\xB5' for column `test`.`t1`.`ucs2` at row 243 +Warning 1366 Incorrect string value: '\xA2\xB6' for column `test`.`t1`.`ucs2` at row 244 +Warning 1366 Incorrect string value: '\xA2\xB7' for column `test`.`t1`.`ucs2` at row 245 +Warning 1366 Incorrect string value: '\xA2\xB8' for column `test`.`t1`.`ucs2` at row 246 +Warning 1366 Incorrect string value: '\xA2\xB9' for column `test`.`t1`.`ucs2` at row 247 +Warning 1366 Incorrect string value: '\xA2\xC2' for column `test`.`t1`.`ucs2` at row 256 +Warning 1366 Incorrect string value: '\xA2\xC3' for column `test`.`t1`.`ucs2` at row 257 +Warning 1366 Incorrect string value: '\xA2\xC4' for column `test`.`t1`.`ucs2` at row 258 +Warning 1366 Incorrect string value: '\xA2\xC5' for column `test`.`t1`.`ucs2` at row 259 +Warning 1366 Incorrect string value: '\xA2\xC6' for column `test`.`t1`.`ucs2` at row 260 +Warning 1366 Incorrect string value: '\xA2\xC7' for column `test`.`t1`.`ucs2` at row 261 +Warning 1366 Incorrect string value: '\xA2\xC8' for column `test`.`t1`.`ucs2` at row 262 +Warning 1366 Incorrect string value: '\xA2\xC9' for column `test`.`t1`.`ucs2` at row 263 +Warning 1366 Incorrect string value: '\xA2\xD1' for column `test`.`t1`.`ucs2` at row 271 +Warning 1366 Incorrect string value: '\xA2\xD2' for column `test`.`t1`.`ucs2` at row 272 +Warning 1366 Incorrect string value: '\xA2\xD3' for column `test`.`t1`.`ucs2` at row 273 +Warning 1366 Incorrect string value: '\xA2\xD4' for column `test`.`t1`.`ucs2` at row 274 +Warning 1366 Incorrect string value: '\xA2\xD5' for column `test`.`t1`.`ucs2` at row 275 +Warning 1366 Incorrect string value: '\xA2\xD6' for column `test`.`t1`.`ucs2` at row 276 +Warning 1366 Incorrect string value: '\xA2\xD7' for column `test`.`t1`.`ucs2` at row 277 +Warning 1366 Incorrect string value: '\xA2\xD8' for column `test`.`t1`.`ucs2` at row 278 +Warning 1366 Incorrect string value: '\xA2\xD9' for column `test`.`t1`.`ucs2` at row 279 +Warning 1366 Incorrect string value: '\xA2\xDA' for column `test`.`t1`.`ucs2` at row 280 +Warning 1366 Incorrect string value: '\xA2\xDB' for column `test`.`t1`.`ucs2` at row 281 +Warning 1366 Incorrect string value: '\xA2\xEB' for column `test`.`t1`.`ucs2` at row 297 +Warning 1366 Incorrect string value: '\xA2\xEC' for column `test`.`t1`.`ucs2` at row 298 +Warning 1366 Incorrect string value: '\xA2\xED' for column `test`.`t1`.`ucs2` at row 299 +Warning 1366 Incorrect string value: '\xA2\xEE' for column `test`.`t1`.`ucs2` at row 300 +Warning 1366 Incorrect string value: '\xA2\xEF' for column `test`.`t1`.`ucs2` at row 301 +Warning 1366 Incorrect string value: '\xA2\xF0' for column `test`.`t1`.`ucs2` at row 302 +Warning 1366 Incorrect string value: '\xA2\xF1' for column `test`.`t1`.`ucs2` at row 303 +Warning 1366 Incorrect string value: '\xA2\xFA' for column `test`.`t1`.`ucs2` at row 312 +Warning 1366 Incorrect string value: '\xA2\xFB' for column `test`.`t1`.`ucs2` at row 313 +Warning 1366 Incorrect string value: '\xA2\xFC' for column `test`.`t1`.`ucs2` at row 314 +Warning 1366 Incorrect string value: '\xA2\xFD' for column `test`.`t1`.`ucs2` at row 315 +Warning 1366 Incorrect string value: '\xA3\xA1' for column `test`.`t1`.`ucs2` at row 317 +Warning 1366 Incorrect string value: '\xA3\xA2' for column `test`.`t1`.`ucs2` at row 318 +Warning 1366 Incorrect string value: '\xA3\xA3' for column `test`.`t1`.`ucs2` at row 319 +Warning 1366 Incorrect string value: '\xA3\xA4' for column `test`.`t1`.`ucs2` at row 320 +Warning 1366 Incorrect string value: '\xA3\xA5' for column `test`.`t1`.`ucs2` at row 321 +Warning 1366 Incorrect string value: '\xA3\xA6' for column `test`.`t1`.`ucs2` at row 322 +Warning 1366 Incorrect string value: '\xA3\xA7' for column `test`.`t1`.`ucs2` at row 323 +Warning 1366 Incorrect string value: '\xA3\xA8' for column `test`.`t1`.`ucs2` at row 324 +Warning 1366 Incorrect string value: '\xA3\xA9' for column `test`.`t1`.`ucs2` at row 325 +Warning 1366 Incorrect string value: '\xA3\xAA' for column `test`.`t1`.`ucs2` at row 326 +Warning 1366 Incorrect string value: '\xA3\xAB' for column `test`.`t1`.`ucs2` at row 327 +Warning 1366 Incorrect string value: '\xA3\xAC' for column `test`.`t1`.`ucs2` at row 328 +Warning 1366 Incorrect string value: '\xA3\xAD' for column `test`.`t1`.`ucs2` at row 329 +Warning 1366 Incorrect string value: '\xA3\xAE' for column `test`.`t1`.`ucs2` at row 330 +Warning 1366 Incorrect string value: '\xA3\xAF' for column `test`.`t1`.`ucs2` at row 331 +Warning 1366 Incorrect string value: '\xA3\xBA' for column `test`.`t1`.`ucs2` at row 342 +Warning 1366 Incorrect string value: '\xA3\xBB' for column `test`.`t1`.`ucs2` at row 343 +Warning 1366 Incorrect string value: '\xA3\xBC' for column `test`.`t1`.`ucs2` at row 344 +Warning 1366 Incorrect string value: '\xA3\xBD' for column `test`.`t1`.`ucs2` at row 345 +Warning 1366 Incorrect string value: '\xA3\xBE' for column `test`.`t1`.`ucs2` at row 346 +Warning 1366 Incorrect string value: '\xA3\xBF' for column `test`.`t1`.`ucs2` at row 347 +Warning 1366 Incorrect string value: '\xA3\xC0' for column `test`.`t1`.`ucs2` at row 348 +Warning 1366 Incorrect string value: '\xA3\xDB' for column `test`.`t1`.`ucs2` at row 375 Characters with safe Unicode round trip select hex(ujis), hex(ucs2), hex(ujis2), name from t1 where ujis=ujis2 order by ujis; hex(ujis) hex(ucs2) hex(ujis2) name @@ -19131,17 +19131,17 @@ insert into t1 (ucs2,name) values (0xFFE2,'U+FFE2 FULLWIDTH NOT SIGN'); insert into t1 (ucs2,name) values (0xFFE4,'U+FFE4 FULLWIDTH BROKEN BAR'); update ignore t1 set ujis=ucs2; Warnings: -Warning 1366 Incorrect string value: '\x00\xA5' for column 'ujis' at row 1 -Warning 1366 Incorrect string value: '\x20\x14' for column 'ujis' at row 2 -Warning 1366 Incorrect string value: '\x20\x3E' for column 'ujis' at row 3 -Warning 1366 Incorrect string value: '\x22\x25' for column 'ujis' at row 4 -Warning 1366 Incorrect string value: '\xFF\x0D' for column 'ujis' at row 5 -Warning 1366 Incorrect string value: '\xFF\x3C' for column 'ujis' at row 6 -Warning 1366 Incorrect string value: '\xFF\x5E' for column 'ujis' at row 7 -Warning 1366 Incorrect string value: '\xFF\xE0' for column 'ujis' at row 8 -Warning 1366 Incorrect string value: '\xFF\xE1' for column 'ujis' at row 9 -Warning 1366 Incorrect string value: '\xFF\xE2' for column 'ujis' at row 10 -Warning 1366 Incorrect string value: '\xFF\xE4' for column 'ujis' at row 11 +Warning 1366 Incorrect string value: '\x00\xA5' for column `test`.`t1`.`ujis` at row 1 +Warning 1366 Incorrect string value: '\x20\x14' for column `test`.`t1`.`ujis` at row 2 +Warning 1366 Incorrect string value: '\x20\x3E' for column `test`.`t1`.`ujis` at row 3 +Warning 1366 Incorrect string value: '\x22\x25' for column `test`.`t1`.`ujis` at row 4 +Warning 1366 Incorrect string value: '\xFF\x0D' for column `test`.`t1`.`ujis` at row 5 +Warning 1366 Incorrect string value: '\xFF\x3C' for column `test`.`t1`.`ujis` at row 6 +Warning 1366 Incorrect string value: '\xFF\x5E' for column `test`.`t1`.`ujis` at row 7 +Warning 1366 Incorrect string value: '\xFF\xE0' for column `test`.`t1`.`ujis` at row 8 +Warning 1366 Incorrect string value: '\xFF\xE1' for column `test`.`t1`.`ujis` at row 9 +Warning 1366 Incorrect string value: '\xFF\xE2' for column `test`.`t1`.`ujis` at row 10 +Warning 1366 Incorrect string value: '\xFF\xE4' for column `test`.`t1`.`ujis` at row 11 select hex(ucs2),hex(ujis),name from t1 order by name; hex(ucs2) hex(ujis) name 00A5 3F U+00A5 YEN SIGN diff --git a/mysql-test/main/ctype_upgrade.result b/mysql-test/main/ctype_upgrade.result index 7f8b594cbf8..9d19c3b5203 100644 --- a/mysql-test/main/ctype_upgrade.result +++ b/mysql-test/main/ctype_upgrade.result @@ -235,6 +235,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -257,9 +258,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -293,6 +294,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -315,9 +317,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables diff --git a/mysql-test/main/ctype_utf16.result b/mysql-test/main/ctype_utf16.result index a105017b726..fb7ae1f62bb 100644 --- a/mysql-test/main/ctype_utf16.result +++ b/mysql-test/main/ctype_utf16.result @@ -1015,7 +1015,7 @@ insert into t1 values (0xdf84); SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR alter table t1 modify column s1 varchar(50) character set utf16; Warnings: -Warning 1366 Incorrect string value: '\xDF\x84' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xDF\x84' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 003F @@ -1024,7 +1024,7 @@ create table t1 (s1 varchar(5) character set ucs2, s2 varchar(5) character set u insert into t1 (s1) values (0xdf84); update ignore t1 set s2 = s1; Warnings: -Warning 1366 Incorrect string value: '\xDF\x84' for column 's2' at row 1 +Warning 1366 Incorrect string value: '\xDF\x84' for column `test`.`t1`.`s2` at row 1 select hex(s2) from t1; hex(s2) 003F diff --git a/mysql-test/main/ctype_utf16le.result b/mysql-test/main/ctype_utf16le.result index 6d8d7ddca2a..ba7a2383671 100644 --- a/mysql-test/main/ctype_utf16le.result +++ b/mysql-test/main/ctype_utf16le.result @@ -1124,7 +1124,7 @@ INSERT INTO t1 VALUES (0xDF84); SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR ALTER TABLE t1 MODIFY column s1 VARCHAR(50) CHARACTER SET utf16le; Warnings: -Warning 1366 Incorrect string value: '\xDF\x84' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xDF\x84' for column `test`.`t1`.`s1` at row 1 SELECT HEX(s1) FROM t1; HEX(s1) 3F00 @@ -1136,7 +1136,7 @@ CREATE TABLE t1 (s1 VARCHAR(5) CHARACTER SET ucs2, s2 VARCHAR(5) CHARACTER SET u INSERT INTO t1 (s1) VALUES (0xdf84); UPDATE IGNORE t1 set s2 = s1; Warnings: -Warning 1366 Incorrect string value: '\xDF\x84' for column 's2' at row 1 +Warning 1366 Incorrect string value: '\xDF\x84' for column `test`.`t1`.`s2` at row 1 SELECT HEX(s2) FROM t1; HEX(s2) 3F00 diff --git a/mysql-test/main/ctype_utf32.result b/mysql-test/main/ctype_utf32.result index 28b9caf6ffe..47e739df290 100644 --- a/mysql-test/main/ctype_utf32.result +++ b/mysql-test/main/ctype_utf32.result @@ -985,31 +985,31 @@ create table t1 (utf32 varchar(2) character set utf32); Wrong character with pad insert ignore into t1 values (0x110000); Warnings: -Warning 1366 Incorrect string value: '\x11\x00\x00' for column 'utf32' at row 1 +Warning 1366 Incorrect string value: '\x11\x00\x00' for column `test`.`t1`.`utf32` at row 1 Wrong chsaracter without pad insert ignore into t1 values (0x00110000); Warnings: -Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1 +Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column `test`.`t1`.`utf32` at row 1 Wrong character with pad followed by another wrong character insert ignore into t1 values (0x11000000110000); Warnings: -Warning 1366 Incorrect string value: '\x11\x00\x00\x00\x11\x00...' for column 'utf32' at row 1 +Warning 1366 Incorrect string value: '\x11\x00\x00\x00\x11\x00...' for column `test`.`t1`.`utf32` at row 1 Good character with pad followed by bad character insert ignore into t1 values (0x10000000110000); Warnings: -Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1 +Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column `test`.`t1`.`utf32` at row 1 Good character without pad followed by bad character insert ignore into t1 values (0x0010000000110000); Warnings: -Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column 'utf32' at row 1 +Warning 1366 Incorrect string value: '\x00\x11\x00\x00' for column `test`.`t1`.`utf32` at row 1 Wrong character with the second byte higher than 0x10 insert ignore into t1 values (0x00800037); Warnings: -Warning 1366 Incorrect string value: '\x00\x80\x007' for column 'utf32' at row 1 +Warning 1366 Incorrect string value: '\x00\x80\x007' for column `test`.`t1`.`utf32` at row 1 Wrong character with pad with the second byte higher than 0x10 insert ignore into t1 values (0x00800037); Warnings: -Warning 1366 Incorrect string value: '\x00\x80\x007' for column 'utf32' at row 1 +Warning 1366 Incorrect string value: '\x00\x80\x007' for column `test`.`t1`.`utf32` at row 1 drop table t1; select _utf32'a' collate utf32_general_ci = 0xfffd; _utf32'a' collate utf32_general_ci = 0xfffd @@ -1561,12 +1561,12 @@ CREATE TABLE t1 (utf32 CHAR(5) CHARACTER SET utf32, latin1 CHAR(5) CHARACTER SET INSERT INTO t1 (utf32) VALUES (0xc581); UPDATE IGNORE t1 SET latin1 = utf32; Warnings: -Warning 1366 Incorrect string value: '\x00\x00\xC5\x81' for column 'latin1' at row 1 +Warning 1366 Incorrect string value: '\x00\x00\xC5\x81' for column `test`.`t1`.`latin1` at row 1 DELETE FROM t1; INSERT INTO t1 (utf32) VALUES (0x100cc); UPDATE IGNORE t1 SET latin1 = utf32; Warnings: -Warning 1366 Incorrect string value: '\x00\x01\x00\xCC' for column 'latin1' at row 1 +Warning 1366 Incorrect string value: '\x00\x01\x00\xCC' for column `test`.`t1`.`latin1` at row 1 DROP TABLE t1; # # Bug#55912 FORMAT with locale set fails for numbers < 1000 diff --git a/mysql-test/main/ctype_utf8.result b/mysql-test/main/ctype_utf8.result index d696ff78831..9c2fcb84765 100644 --- a/mysql-test/main/ctype_utf8.result +++ b/mysql-test/main/ctype_utf8.result @@ -222,7 +222,7 @@ drop table t1; create table t1 (s1 char(10) character set utf8); insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -230,7 +230,7 @@ drop table t1; create table t1 (s1 varchar(10) character set utf8); insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -238,7 +238,7 @@ drop table t1; create table t1 (s1 text character set utf8); insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -5456,13 +5456,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -5479,21 +5479,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -5537,7 +5537,7 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -5558,13 +5558,13 @@ az aЀ aր Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -5585,7 +5585,7 @@ az aЀ aր Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z @@ -5597,23 +5597,23 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 ALTER TABLE t1 DROP KEY ch; # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); @@ -5700,13 +5700,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -5723,21 +5723,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -5781,7 +5781,7 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -5802,13 +5802,13 @@ az aЀ aր Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch<'a𝌆b' ORDER BY ch; ch a @@ -5829,7 +5829,7 @@ az aЀ aր Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z @@ -5841,23 +5841,23 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆' ORDER BY ch; ch z Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ch ch 183 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch>'a𝌆b' ORDER BY ch; ch z Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 ALTER TABLE t1 DROP KEY ch; # 0xD18F would be a good 2-byte character, 0xD1 is an incomplete sequence SET @query=CONCAT('SELECT ch FROM t1 WHERE ch=''a', 0xD1,''''); @@ -5944,13 +5944,13 @@ INSERT INTO t1 (ch) VALUES ('admin'),('admin1'); SELECT ch FROM t1 WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch='admin𝌆'; ch SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='admin𝌆'; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 DELETE FROM t1; INSERT INTO t1 (ch) VALUES ('a'), ('a?'), ('a??'), ('a???'), ('a????'); INSERT INTO t1 (ch) VALUES ('ab'),('a?b'),('a??b'),('a???b'),('a????b'); @@ -5967,21 +5967,21 @@ SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86' for column `test`.`t1`.`ch` at row 1 EXPLAIN SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL # Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 FORCE KEY (ch) WHERE ch='a𝌆b' ORDER BY ch; ch Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column 'ch' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x8C\x86b' for column `test`.`t1`.`ch` at row 1 SELECT ch FROM t1 IGNORE KEY (ch) WHERE ch<'a𝌆' ORDER BY ch; ch a @@ -10611,11 +10611,11 @@ DROP TABLE t1; CREATE TABLE t1 (a TEXT CHARACTER SET utf8); LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' IGNORE INTO TABLE t1 CHARACTER SET utf8 IGNORE 4 LINES; Warnings: -Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 7 -Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\xD0' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xE1\x80' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 8 SELECT HEX(a) FROM t1; HEX(a) 3F @@ -10633,7 +10633,7 @@ DROP TABLE t1; CREATE TABLE t1 (a TEXT CHARACTER SET utf8); LOAD XML INFILE '../../std_data/loaddata/mdev9874.xml' IGNORE INTO TABLE t1 CHARACTER SET utf8 ROWS IDENTIFIED BY ''; Warnings: -Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\xD0' for column `test`.`t1`.`a` at row 1 SELECT HEX(a) FROM t1; HEX(a) 613F diff --git a/mysql-test/main/ctype_utf8mb4.result b/mysql-test/main/ctype_utf8mb4.result index 27ffd5552fa..fac15a5a2cd 100644 --- a/mysql-test/main/ctype_utf8mb4.result +++ b/mysql-test/main/ctype_utf8mb4.result @@ -222,7 +222,7 @@ drop table t1; create table t1 (s1 char(10) character set utf8mb4); insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -230,7 +230,7 @@ drop table t1; create table t1 (s1 varchar(10) character set utf8mb4); insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -238,7 +238,7 @@ drop table t1; create table t1 (s1 text character set utf8mb4); insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -2328,7 +2328,7 @@ insert into t1 values (0xF0908080); insert into t1 values (0xF0BFBFBF); insert ignore into t1 values (0xF08F8080); Warnings: -Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1 +Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 select hex(utf8mb4) from t1 order by binary utf8mb4; hex(utf8mb4) 3F @@ -2348,7 +2348,7 @@ insert into t1 values (0xF4808080); insert into t1 values (0xF48F8080); insert ignore into t1 values (0xF4908080); Warnings: -Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1 +Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 select hex(utf8mb4) from t1 order by binary utf8mb4; hex(utf8mb4) 3F @@ -2442,7 +2442,7 @@ u_decimal hex(utf8mb4_encoding) 119070 F09D849EF09D859EF09D859EF09D8480F09D859FF09D859FF09D859FF09D85A0F09D85A0F09D8480 INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080'); Warnings: -Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE table_name= 't1' AND column_name= 'utf8mb4_encoding'; character_maximum_length character_octet_length @@ -2456,14 +2456,14 @@ INSERT INTO t2 VALUES (42856, x'ea9da8'); INSERT INTO t2 VALUES (65131, x'efb9ab'); INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf'); Warnings: -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE table_name= 't2' AND column_name= 'utf8mb3_encoding'; character_maximum_length character_octet_length 10 30 UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856; Warnings: -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1 UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) @@ -2524,17 +2524,17 @@ count(*) SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR ALTER TABLE t1 CONVERT TO CHARACTER SET utf8; Warnings: -Warning 1366 Incorrect string value: '\xF0\x9D\x84\x80' for column 'utf8mb4_encoding' at row 1 -Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E' for column 'utf8mb4_encoding' at row 2 -Warning 1366 Incorrect string value: '\xF0\x9D\x85\x9E' for column 'utf8mb4_encoding' at row 3 -Warning 1366 Incorrect string value: '\xF0\x9D\x87\x8F' for column 'utf8mb4_encoding' at row 4 -Warning 1366 Incorrect string value: '\xF0\x9D\x9C\x9F' for column 'utf8mb4_encoding' at row 5 -Warning 1366 Incorrect string value: '\xF0\x9D\x9E\x9F' for column 'utf8mb4_encoding' at row 6 -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb4_encoding' at row 7 -Warning 1366 Incorrect string value: '\xF3\xA0\x87\xAF' for column 'utf8mb4_encoding' at row 8 -Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column 'utf8mb4_encoding' at row 9 -Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column 'utf8mb4_encoding' at row 10 -Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column 'utf8mb4_encoding' at row 11 +Warning 1366 Incorrect string value: '\xF0\x9D\x84\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1 +Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E' for column `test`.`t1`.`utf8mb4_encoding` at row 2 +Warning 1366 Incorrect string value: '\xF0\x9D\x85\x9E' for column `test`.`t1`.`utf8mb4_encoding` at row 3 +Warning 1366 Incorrect string value: '\xF0\x9D\x87\x8F' for column `test`.`t1`.`utf8mb4_encoding` at row 4 +Warning 1366 Incorrect string value: '\xF0\x9D\x9C\x9F' for column `test`.`t1`.`utf8mb4_encoding` at row 5 +Warning 1366 Incorrect string value: '\xF0\x9D\x9E\x9F' for column `test`.`t1`.`utf8mb4_encoding` at row 6 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t1`.`utf8mb4_encoding` at row 7 +Warning 1366 Incorrect string value: '\xF3\xA0\x87\xAF' for column `test`.`t1`.`utf8mb4_encoding` at row 8 +Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column `test`.`t1`.`utf8mb4_encoding` at row 9 +Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column `test`.`t1`.`utf8mb4_encoding` at row 10 +Warning 1366 Incorrect string value: '\xF0\x9D\x84\x9E\xF0\x9D...' for column `test`.`t1`.`utf8mb4_encoding` at row 11 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -3427,8 +3427,8 @@ b VARCHAR(32) CHARACTER SET utf8 ); INSERT IGNORE INTO t1 SELECT 'a 😁 b', 'a 😁 b'; Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'b' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column `test`.`t1`.`b` at row 1 SELECT * FROM t1; a b a ???? b a ???? b @@ -3447,7 +3447,7 @@ b VARCHAR(32) CHARACTER SET utf8 ); INSERT IGNORE INTO t1 SELECT 'a 😁 b', 'a 😁 b'; Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column 'b' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81 b' for column `test`.`t1`.`b` at row 1 SELECT * FROM t1; a b a 😁 b a ? b @@ -3539,10 +3539,10 @@ DROP FUNCTION f1; CREATE TABLE t1 (a TEXT CHARACTER SET utf8mb4); LOAD DATA INFILE '../../std_data/loaddata/mdev9823.utf8mb4.txt' IGNORE INTO TABLE t1 CHARACTER SET utf8mb4 IGNORE 4 LINES; Warnings: -Warning 1366 Incorrect string value: '\xD0' for column 'a' at row 1 -Warning 1366 Incorrect string value: '\xE1\x80' for column 'a' at row 3 -Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 5 -Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column 'a' at row 8 +Warning 1366 Incorrect string value: '\xD0' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect string value: '\xE1\x80' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect string value: '\xF0\x9F\x98' for column `test`.`t1`.`a` at row 8 SELECT HEX(a) FROM t1; HEX(a) 3F diff --git a/mysql-test/main/ctype_utf8mb4_heap.result b/mysql-test/main/ctype_utf8mb4_heap.result index d82ed89be9c..85668451181 100644 --- a/mysql-test/main/ctype_utf8mb4_heap.result +++ b/mysql-test/main/ctype_utf8mb4_heap.result @@ -222,7 +222,7 @@ drop table t1; create table t1 (s1 char(10) character set utf8mb4) engine heap; insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -230,7 +230,7 @@ drop table t1; create table t1 (s1 varchar(10) character set utf8mb4) engine heap; insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -2160,7 +2160,7 @@ insert into t1 values (0xF0908080); insert into t1 values (0xF0BFBFBF); insert ignore into t1 values (0xF08F8080); Warnings: -Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1 +Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) 3F @@ -2180,7 +2180,7 @@ insert into t1 values (0xF4808080); insert into t1 values (0xF48F8080); insert ignore into t1 values (0xF4908080); Warnings: -Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1 +Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) 3F @@ -2255,7 +2255,7 @@ u_decimal hex(utf8mb4_encoding) 917999 F3A087AF INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080'); Warnings: -Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE table_name= 't1' AND column_name= 'utf8mb4_encoding'; character_maximum_length character_octet_length @@ -2269,14 +2269,14 @@ INSERT INTO t2 VALUES (42856, x'ea9da8'); INSERT INTO t2 VALUES (65131, x'efb9ab'); INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf'); Warnings: -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE table_name= 't2' AND column_name= 'utf8mb3_encoding'; character_maximum_length character_octet_length 10 30 UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856; Warnings: -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1 UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) diff --git a/mysql-test/main/ctype_utf8mb4_innodb.result b/mysql-test/main/ctype_utf8mb4_innodb.result index 956b2f83d9e..82f0ddff1c4 100644 --- a/mysql-test/main/ctype_utf8mb4_innodb.result +++ b/mysql-test/main/ctype_utf8mb4_innodb.result @@ -222,7 +222,7 @@ drop table t1; create table t1 (s1 char(10) character set utf8mb4) engine InnoDB; insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -230,7 +230,7 @@ drop table t1; create table t1 (s1 varchar(10) character set utf8mb4) engine InnoDB; insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -238,7 +238,7 @@ drop table t1; create table t1 (s1 text character set utf8mb4) engine InnoDB; insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -2286,7 +2286,7 @@ insert into t1 values (0xF0908080); insert into t1 values (0xF0BFBFBF); insert ignore into t1 values (0xF08F8080); Warnings: -Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1 +Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) 3F @@ -2306,7 +2306,7 @@ insert into t1 values (0xF4808080); insert into t1 values (0xF48F8080); insert ignore into t1 values (0xF4908080); Warnings: -Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1 +Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) 3F @@ -2398,7 +2398,7 @@ u_decimal hex(utf8mb4_encoding) 917999 F3A087AF INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080'); Warnings: -Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE table_name= 't1' AND column_name= 'utf8mb4_encoding'; character_maximum_length character_octet_length @@ -2412,14 +2412,14 @@ INSERT INTO t2 VALUES (42856, x'ea9da8'); INSERT INTO t2 VALUES (65131, x'efb9ab'); INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf'); Warnings: -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE table_name= 't2' AND column_name= 'utf8mb3_encoding'; character_maximum_length character_octet_length 10 30 UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856; Warnings: -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1 UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) diff --git a/mysql-test/main/ctype_utf8mb4_myisam.result b/mysql-test/main/ctype_utf8mb4_myisam.result index fd58e12542c..0bd13ef0282 100644 --- a/mysql-test/main/ctype_utf8mb4_myisam.result +++ b/mysql-test/main/ctype_utf8mb4_myisam.result @@ -222,7 +222,7 @@ drop table t1; create table t1 (s1 char(10) character set utf8mb4) engine MyISAM; insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -230,7 +230,7 @@ drop table t1; create table t1 (s1 varchar(10) character set utf8mb4) engine MyISAM; insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -238,7 +238,7 @@ drop table t1; create table t1 (s1 text character set utf8mb4) engine MyISAM; insert ignore into t1 values (0x41FF); Warnings: -Warning 1366 Incorrect string value: '\xFF' for column 's1' at row 1 +Warning 1366 Incorrect string value: '\xFF' for column `test`.`t1`.`s1` at row 1 select hex(s1) from t1; hex(s1) 413F @@ -2293,7 +2293,7 @@ insert into t1 values (0xF0908080); insert into t1 values (0xF0BFBFBF); insert ignore into t1 values (0xF08F8080); Warnings: -Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column 'utf8mb4' at row 1 +Warning 1366 Incorrect string value: '\xF0\x8F\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) 3F @@ -2313,7 +2313,7 @@ insert into t1 values (0xF4808080); insert into t1 values (0xF48F8080); insert ignore into t1 values (0xF4908080); Warnings: -Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column 'utf8mb4' at row 1 +Warning 1366 Incorrect string value: '\xF4\x90\x80\x80' for column `test`.`t1`.`utf8mb4` at row 1 select hex(utf8mb4) from t1; hex(utf8mb4) 3F @@ -2407,7 +2407,7 @@ u_decimal hex(utf8mb4_encoding) 917999 F3A087AF INSERT IGNORE INTO t1 VALUES (1114111, x'f5808080'); Warnings: -Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column 'utf8mb4_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF5\x80\x80\x80' for column `test`.`t1`.`utf8mb4_encoding` at row 1 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE table_name= 't1' AND column_name= 'utf8mb4_encoding'; character_maximum_length character_octet_length @@ -2421,14 +2421,14 @@ INSERT INTO t2 VALUES (42856, x'ea9da8'); INSERT INTO t2 VALUES (65131, x'efb9ab'); INSERT IGNORE INTO t2 VALUES (1114111, x'f48fbfbf'); Warnings: -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column 'utf8mb3_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBF' for column `test`.`t2`.`utf8mb3_encoding` at row 1 SELECT character_maximum_length, character_octet_length FROM information_schema.columns WHERE table_name= 't2' AND column_name= 'utf8mb3_encoding'; character_maximum_length character_octet_length 10 30 UPDATE IGNORE t2 SET utf8mb3_encoding= x'f48fbfbd' where u_decimal= 42856; Warnings: -Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column 'utf8mb3_encoding' at row 1 +Warning 1366 Incorrect string value: '\xF4\x8F\xBF\xBD' for column `test`.`t2`.`utf8mb3_encoding` at row 1 UPDATE t2 SET utf8mb3_encoding= _utf8mb4 x'ea9da8' where u_decimal= 42856; SELECT HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) FROM t1; HEX(CONCAT(utf8mb4_encoding, _utf8 x'ea9da8')) diff --git a/mysql-test/main/custom_aggregate_functions.result b/mysql-test/main/custom_aggregate_functions.result index 4060d6665f6..0a27334f58e 100644 --- a/mysql-test/main/custom_aggregate_functions.result +++ b/mysql-test/main/custom_aggregate_functions.result @@ -573,7 +573,7 @@ select f3(sal) from t1; f3(sal) 1000 select f2(val) from t1; -ERROR 22007: Incorrect integer value: 'ab' for column 'x' at row 1 +ERROR 22007: Incorrect integer value: 'ab' for column ``.``.`x` at row 1 select val, id, c from (select f1(sal) as c from t2) as t1, t2; val id c 10 2 17000 diff --git a/mysql-test/main/date_formats.result b/mysql-test/main/date_formats.result index 16dbdf7969c..463cce39520 100644 --- a/mysql-test/main/date_formats.result +++ b/mysql-test/main/date_formats.result @@ -442,7 +442,7 @@ f1 f2 f3 Warnings: Warning 1292 Truncated incorrect datetime value: '2003-01-02 10:11:12.0012ABCD' Warning 1292 Truncated incorrect time value: '-01:01:01.01 GGG' -Warning 1292 Truncated incorrect time value: '1997-12-31 23:59:59.01XXXX' +Warning 1292 Truncated incorrect datetime value: '1997-12-31 23:59:59.01XXXX' select str_to_date("2003-04-05 g", "%Y-%m-%d") as f1, str_to_date("2003-04-05 10:11:12.101010234567", "%Y-%m-%d %H:%i:%S.%f") as f2; f1 f2 diff --git a/mysql-test/main/delayed.result b/mysql-test/main/delayed.result index 26a1fc670f4..ec36e3af46d 100644 --- a/mysql-test/main/delayed.result +++ b/mysql-test/main/delayed.result @@ -284,9 +284,9 @@ CREATE TABLE t2 ( ); SET SQL_MODE='NO_ZERO_DATE,STRICT_ALL_TABLES,NO_ZERO_IN_DATE'; INSERT DELAYED INTO t2 VALUES (0,'0000-00-00'); -ERROR 22007: Incorrect date value: '0000-00-00' for column 'f1' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t2`.`f1` at row 1 INSERT DELAYED INTO t2 VALUES (0,'2007-00-00'); -ERROR 22007: Incorrect date value: '2007-00-00' for column 'f1' at row 1 +ERROR 22007: Incorrect date value: '2007-00-00' for column `test`.`t2`.`f1` at row 1 DROP TABLE t1,t2; set @old_delayed_updates = @@global.low_priority_updates; set global low_priority_updates = 1; diff --git a/mysql-test/main/delete_use_source.result b/mysql-test/main/delete_use_source.result index 08da8901528..a9a6df88077 100644 --- a/mysql-test/main/delete_use_source.result +++ b/mysql-test/main/delete_use_source.result @@ -6,6 +6,7 @@ insert t1 select 2,seq from seq_1_to_50; insert t1 select 3,seq from seq_1_to_20; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK # # Delete with limit (quick select - range acces) @@ -47,8 +48,8 @@ rollback; start transaction; explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL c1 NULL NULL NULL 502 Using where -2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 58 Using index +1 PRIMARY t1 range c1 c1 4 NULL 600 Using where +2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 167 Using index delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1; affected rows: 1 delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 limit 1; @@ -63,8 +64,8 @@ rollback; start transaction; explain delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL c1 NULL NULL NULL 502 Using where -2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 58 Using index +1 PRIMARY t1 ALL c1 NULL NULL NULL 670 Using where +2 DEPENDENT SUBQUERY b ref c1 c1 4 test.t1.c1 167 Using index delete from v1 where (select count(*) from t1 b where b.c1=v1.c1) = 500 ; affected rows: 500 select count(*) from v1 where c1=0; diff --git a/mysql-test/main/deprecated_features.result b/mysql-test/main/deprecated_features.result index fc6c86d065d..2c77d745e2e 100644 --- a/mysql-test/main/deprecated_features.result +++ b/mysql-test/main/deprecated_features.result @@ -5,7 +5,7 @@ ERROR HY000: Unknown system variable 'table_type' select @@table_type='MyISAM'; ERROR HY000: Unknown system variable 'table_type' backup table t1 to 'data.txt'; -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 'backup table t1 to 'data.txt'' at line 1 +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 'table t1 to 'data.txt'' at line 1 restore table t1 from 'data.txt'; 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 'restore table t1 from 'data.txt'' at line 1 show plugin; diff --git a/mysql-test/main/derived_cond_pushdown.result b/mysql-test/main/derived_cond_pushdown.result index a1120ba6de7..36a44ce6fba 100644 --- a/mysql-test/main/derived_cond_pushdown.result +++ b/mysql-test/main/derived_cond_pushdown.result @@ -1,23 +1,23 @@ create table t1 (a int, b int, c int); create table t2 (a int, b int, c int, d decimal); -insert into t1 values +insert into t1 values (1,21,345), (1,33,7), (8,33,114), (1,21,500), (1,19,107), (5,14,787), (8,33,123), (9,10,211), (5,16,207), (1,33,988), (5,27,132), (1,21,104), (6,20,309), (6,20,315), (1,21,101), (8,33,404), (9,10,800), (1,21,123), (7,11,708), (6,20,214); insert into t2 values -(2,3,207,207.0000), (1,21,909,12.0000), (7,13,312,406.0000), +(2,3,207,207.0000), (1,21,909,12.0000), (7,13,312,406.0000), (8,64,248,107.0000), (6,20,315,279.3333), (1,19,203,107.0000), (8,80,800,314.0000), (3,12,231,190.0000), (6,23,303,909.0000); Warnings: Note 1265 Data truncated for column 'd' at row 5 create table t1_double(a int, b double, c double); -insert into t1_double values +insert into t1_double values (1,23.4,14.3333), (1,12.5,18.9), (3,12.5,18.9), (4,33.4,14.3333), (4,14.3333,13.65), (5,17.89,7.22), (6,33.4,14.3), (10,33.4,13.65), (11,33.4,13.65); create table t2_double(a int, b double, c double); -insert into t2_double values +insert into t2_double values (1,22.4,14.3333), (1,12.5,18.9), (2,22.4,18.9), (4,33.4,14.3333), (5,22.4,13.65), (7,17.89,18.9), (6,33.4,14.3333), (10,31.4,13.65), (12,33.4,13.65); @@ -41,22 +41,22 @@ insert into t2_decimal values (2,1,13),(2,2,11),(3,3,16), (1,3,22),(1,3,14),(2,2,15), (2,1,43),(2,3,11),(2,3,16); -create view v1 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 +create view v1 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 group by a,b having max_c < 707; -create view v2 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 +create view v2 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707; create view v3 as select a, b, min(c) as min_c from t1 where t1.a<10 group by a,b having min_c > 109; create view v4 as select a, b, min(max_c) as min_c from v1 where (v1.a<15) group by a,b; -create view v_union as +create view v_union as select a, b, min(c) as c from t1 where t1.a<10 group by a,b having c > 109 union select a, b, max(c) as c from t1 where t1.b>10 group by a,b having c < 300; -create view v2_union as +create view v2_union as select a, b, min(c) as c from t1 where t1.a<10 group by a,b having c > 109 union @@ -65,13 +65,13 @@ where t1.b>10 group by a,b having c < 300 union select a, b, avg(c) as c from t1 where t1.c>300 group by a,b having c < 707; -create view v3_union as +create view v3_union as select a, b, (a+1) as c from t1 where t1.a<10 union select a, b, c from t1 where t1.b>10 and t1.c>100; -create view v4_union as +create view v4_union as select a, b, max(c)-100 as c from t1 where t1.a<10 group by a,b having c > 109 union @@ -80,13 +80,13 @@ where t1.b>10; create view v_double as select a, avg(a/4) as avg_a, b, c from t1_double where (b>12.2) group by b,c having (avg_a<22.333); -create view v_char as -select a, b, max(c) as max_c from t1_char +create view v_char as +select a, b, max(c) as max_c from t1_char group by a,b having max_c < 9; create view v_decimal as select a, b, avg(c) as avg_c from t1_decimal group by a,b having (avg_c>12); -# conjunctive subformula : pushing into HAVING +# conjunctive subformula : pushing into HAVING set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); a b max_c avg_c a b c d 1 21 500 234.6000 2 3 207 207 @@ -161,7 +161,7 @@ EXPLAIN } set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300); a b max_c avg_c a b c d 1 21 500 234.6000 1 21 909 12 @@ -172,7 +172,7 @@ a b max_c avg_c a b c d 6 20 315 279.3333 6 23 303 909 select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300); a b max_c avg_c a b c d 1 21 500 234.6000 1 21 909 12 @@ -183,7 +183,7 @@ a b max_c avg_c a b c d 6 20 315 279.3333 6 23 303 909 explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -191,7 +191,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300); EXPLAIN { @@ -235,8 +235,8 @@ EXPLAIN } } } -# extracted or formula : pushing into HAVING -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +# extracted or formula : pushing into HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -explain format=json select * from v1,t2 where +explain format=json select * from v1,t2 where ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or +((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or ((v1.max_c<135) and (v1.max_c300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or +((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or ((v1.max_c<135) and (v1.max_c300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or +((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or ((v1.max_c<135) and (v1.max_c ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort explain format=json select * from v1,t2 where -((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or +((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or ((v1.max_c<135) and (v1.max_c7) and (t2.c7) and (t2.c7) and (t2.c ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -explain format=json select * from v1,t2 where +explain format=json select * from v1,t2 where ((v1.a>7) and (t2.c7) and (t2.c5) and (t2.b7) and (t2.c5) and (t2.b7) and (t2.c5) and (t2.b ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -explain format=json select * from v2,t2 where +explain format=json select * from v2,t2 where ((v2.a>7) and (t2.c5) and (t2.b4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or ((v1.a<2) and (v1.max_c4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +select * from v1,t2 where +((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or ((v1.a<2) and (v1.max_c4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +explain select * from v1,t2 where +((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or ((v1.a<2) and (v1.max_c ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -explain format=json select * from v1,t2 where -((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +explain format=json select * from v1,t2 where +((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or ((v1.a<2) and (v1.max_c7) and (v1.max_c>300) and (t2.c7) and (v1.max_c>300) and (t2.c7) and (v1.max_c>300) and (t2.c7) and (v1.max_c>300) and (t2.c7) and (v1.max_c>300) and (t2.c7) and (v1.max_c>300) and (t2.c ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -explain format=json select * from v1,t2 where -((v1.a>7) and (v1.max_c>300) and (t2.c7) and (v1.max_c>300) and (t2.c120) and (v1.b=t2.b)) or (v1.a>7); a b max_c avg_c a b c d 1 21 500 234.6000 1 21 909 12 @@ -1118,7 +1118,7 @@ a b max_c avg_c a b c d 8 33 404 213.6667 8 80 800 314 8 33 404 213.6667 3 12 231 190 8 33 404 213.6667 6 23 303 909 -select * from v1,t2 where +select * from v1,t2 where ((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); a b max_c avg_c a b c d 1 21 500 234.6000 1 21 909 12 @@ -1131,13 +1131,13 @@ a b max_c avg_c a b c d 8 33 404 213.6667 8 80 800 314 8 33 404 213.6667 3 12 231 190 8 33 404 213.6667 6 23 303 909 -explain select * from v1,t2 where +explain select * from v1,t2 where ((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 1 PRIMARY ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -explain format=json select * from v1,t2 where +explain format=json select * from v1,t2 where ((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); EXPLAIN { @@ -1250,7 +1250,7 @@ EXPLAIN } } # prepare of a query containing extracted or formula -prepare stmt from "select * from v1,t2 where +prepare stmt from "select * from v1,t2 where ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a20)); a b max_c a b c c Harry 4 d Harry 1 c Harry 4 b Harry 4 -select * from v_char as v,t2_char as t where +select * from v_char as v,t2_char as t where (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); a b max_c a b c c Harry 4 d Harry 1 c Harry 4 b Harry 4 -explain select * from v_char as v,t2_char as t where +explain select * from v_char as v,t2_char as t where (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 12 Using where 1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort -explain format=json select * from v_char as v,t2_char as t where +explain format=json select * from v_char as v,t2_char as t where (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); EXPLAIN { @@ -1885,7 +1885,7 @@ EXPLAIN } } } -# extracted or formula : pushing into HAVING using equalities +# extracted or formula : pushing into HAVING using equalities set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); a b max_c avg_c a b c d @@ -2014,24 +2014,24 @@ EXPLAIN } } # conjunctive subformulas : pushing into WHERE and HAVING -# pushing equalities +# pushing equalities set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); a b max_c avg_c a b c d 8 33 404 213.6667 8 64 248 107 8 33 404 213.6667 8 80 800 314 select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); a b max_c avg_c a b c d 8 33 404 213.6667 8 64 248 107 8 33 404 213.6667 8 80 800 314 explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -2039,7 +2039,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); EXPLAIN { @@ -2084,22 +2084,22 @@ EXPLAIN } } } -# conjunctive subformulas : pushing into WHERE and HAVING -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +# conjunctive subformulas : pushing into WHERE and HAVING +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a>3) and (v1.max_c>200) and (t2.b3) and (v1.max_c>200) and (t2.b3) and (v1.max_c>200) and (t2.b ref key0 key0 5 test.t2.d 2 Using where 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -explain format=json select * from v1,t2 where +explain format=json select * from v1,t2 where (v1.a>3) and (v1.max_c>200) and (t2.b0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); a avg_a b c a b c @@ -2366,17 +2366,17 @@ EXPLAIN } set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -where t1.a>5 group by a,b having max_c < 707) v1, +where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); a b max_c avg_c a b c d select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -where t1.a>5 group by a,b having max_c < 707) v1, +where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); a b max_c avg_c a b c d explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -where t1.a>5 group by a,b having max_c < 707) v1, +where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -2384,7 +2384,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -where t1.a>5 group by a,b having max_c < 707) v1, +where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); EXPLAIN { @@ -2550,7 +2550,7 @@ EXPLAIN } } } -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); a b max_c avg_c a b c d 1 19 107 107.0000 1 21 909 12 @@ -2561,7 +2561,7 @@ a b max_c avg_c a b c d 6 20 315 279.3333 6 23 303 909 8 33 404 213.6667 8 64 248 107 8 33 404 213.6667 8 80 800 314 -select * from v1,t2 where +select * from v1,t2 where (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); a b max_c avg_c a b c d 1 19 107 107.0000 1 21 909 12 @@ -2572,13 +2572,13 @@ a b max_c avg_c a b c d 6 20 315 279.3333 6 23 303 909 8 33 404 213.6667 8 64 248 107 8 33 404 213.6667 8 80 800 314 -explain select * from v1,t2 where +explain select * from v1,t2 where (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 1 PRIMARY ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -explain format=json select * from v1,t2 where +explain format=json select * from v1,t2 where (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); EXPLAIN { @@ -2716,7 +2716,7 @@ EXPLAIN } } } -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (t2.a<2) and (t2.c>900) and ((v1.a900) and ((v1.a900) and ((v1.a ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -explain format=json select * from v1,t2 where +explain format=json select * from v1,t2 where (t2.a<2) and (t2.c>900) and ((v1.a ref key0 key0 5 test.t2.a 2 Using where 3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -explain format=json select * from v1,v2,t2 where +explain format=json select * from v1,v2,t2 where (v1.a=v2.a) and (v1.a=t2.a) and (v2.b<50); EXPLAIN { @@ -2880,7 +2880,7 @@ EXPLAIN } } } -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); a b max_c avg_c a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279.3333 2 3 207 207 @@ -2897,7 +2897,7 @@ a b max_c avg_c a b max_c avg_c a b c d 8 33 404 213.6667 8 33 404 213.6667 1 19 203 107 8 33 404 213.6667 8 33 404 213.6667 3 12 231 190 8 33 404 213.6667 8 33 404 213.6667 6 23 303 909 -select * from v1,v2,t2 where +select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); a b max_c avg_c a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279.3333 2 3 207 207 @@ -2914,7 +2914,7 @@ a b max_c avg_c a b max_c avg_c a b c d 8 33 404 213.6667 8 33 404 213.6667 1 19 203 107 8 33 404 213.6667 8 33 404 213.6667 3 12 231 190 8 33 404 213.6667 8 33 404 213.6667 6 23 303 909 -explain select * from v1,v2,t2 where +explain select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -2922,7 +2922,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ref key0 key0 5 v1.b 2 Using where 3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -explain format=json select * from v1,v2,t2 where +explain format=json select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and (t2.b<50) and (v1.b=v2.b); EXPLAIN { @@ -2996,21 +2996,21 @@ EXPLAIN } } } -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where ((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); a b max_c avg_c a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279.3333 6 20 315 279 6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 8 33 404 213.6667 8 33 404 213.6667 8 64 248 107 8 33 404 213.6667 8 33 404 213.6667 8 80 800 314 -select * from v1,v2,t2 where +select * from v1,v2,t2 where ((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); a b max_c avg_c a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279.3333 6 20 315 279 6 20 315 279.3333 6 20 315 279.3333 6 23 303 909 8 33 404 213.6667 8 33 404 213.6667 8 64 248 107 8 33 404 213.6667 8 33 404 213.6667 8 80 800 314 -explain select * from v1,v2,t2 where +explain select * from v1,v2,t2 where ((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 @@ -3018,7 +3018,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) 3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -explain format=json select * from v1,v2,t2 where +explain format=json select * from v1,v2,t2 where ((v1.a=v2.a) and (v1.a=t2.a)) or ((v2.b>13) and (t2.c<115)); EXPLAIN { @@ -3094,22 +3094,22 @@ EXPLAIN # using several derived tables : pushing in all tables # conjunctive subformula : pushing into HAVING # extracted or formula : pushing into WHERE -# pushing equalities -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +# pushing equalities +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v2.b<50) or (v2.b=19)) and (v1.max_c<300); a b max_c avg_c a b max_c avg_c a b c d 1 19 107 107.0000 6 20 315 279.3333 1 21 909 12 1 19 107 107.0000 6 20 315 279.3333 1 19 203 107 1 19 107 107.0000 8 33 404 213.6667 1 21 909 12 1 19 107 107.0000 8 33 404 213.6667 1 19 203 107 -select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v2.b<50) or (v2.b=19)) and (v1.max_c<300); a b max_c avg_c a b max_c avg_c a b c d 1 19 107 107.0000 6 20 315 279.3333 1 21 909 12 1 19 107 107.0000 6 20 315 279.3333 1 19 203 107 1 19 107 107.0000 8 33 404 213.6667 1 21 909 12 1 19 107 107.0000 8 33 404 213.6667 1 19 203 107 -explain select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +explain select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v2.b<50) or (v2.b=19)) and (v1.max_c<300); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 @@ -3117,7 +3117,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 20 Using where; Using join buffer (incremental, BNL join) 3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -explain format=json select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +explain format=json select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v2.b<50) or (v2.b=19)) and (v1.max_c<300); EXPLAIN { @@ -3194,13 +3194,13 @@ EXPLAIN # using several derived tables : pushing only in one table # conjunctive subformula : pushing into WHERE # pushing equalities -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,t2 where (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); a b max_c avg_c a b max_c avg_c a b c d -select * from v1,v2,t2 where +select * from v1,v2,t2 where (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); a b max_c avg_c a b max_c avg_c a b c d -explain select * from v1,v2,t2 where +explain select * from v1,v2,t2 where (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -3208,7 +3208,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ref key0 key0 5 test.t2.a 2 Using where 3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort -explain format=json select * from v1,v2,t2 where +explain format=json select * from v1,v2,t2 where (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); EXPLAIN { @@ -3373,7 +3373,7 @@ EXPLAIN # extracted or formula : pushing into WHERE # conjunctive subformula : pushing into WHERE using equalities # pushing equalities -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); a b max_c a b c b Vika 2 b Ivan 1 @@ -3381,7 +3381,7 @@ b Vika 2 b Ali 6 b Vika 2 b Hermes 3 b Vika 2 b Ivan 11 b Vika 2 b Harry 4 -select * from v_char as v,t2_char as t where +select * from v_char as v,t2_char as t where (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); a b max_c a b c b Vika 2 b Ivan 1 @@ -3389,13 +3389,13 @@ b Vika 2 b Ali 6 b Vika 2 b Hermes 3 b Vika 2 b Ivan 11 b Vika 2 b Harry 4 -explain select * from v_char as v,t2_char as t where +explain select * from v_char as v,t2_char as t where (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY ALL NULL NULL NULL NULL 12 Using where 1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) 2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort -explain format=json select * from v_char as v,t2_char as t where +explain format=json select * from v_char as v,t2_char as t where (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); EXPLAIN { @@ -3442,10 +3442,10 @@ EXPLAIN } # using several derived tables : pushing in all tables # extracted or formula : pushing into WHERE -# conjunctive subformulas : pushing into HAVING +# conjunctive subformulas : pushing into HAVING # pushing equalities -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,v3,t2 where -((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,v2,v3,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); a b max_c avg_c a b max_c avg_c a b min_c a b c d 6 20 315 279.3333 6 20 315 279.3333 7 11 708 7 13 312 406 @@ -3462,8 +3462,8 @@ a b max_c avg_c a b max_c avg_c a b min_c a b c d 8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 20 315 279 8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 80 800 314 8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 23 303 909 -select * from v1,v2,v3,t2 where -((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +select * from v1,v2,v3,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); a b max_c avg_c a b max_c avg_c a b min_c a b c d 6 20 315 279.3333 6 20 315 279.3333 7 11 708 7 13 312 406 @@ -3480,8 +3480,8 @@ a b max_c avg_c a b max_c avg_c a b min_c a b c d 8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 20 315 279 8 33 404 213.6667 8 33 404 213.6667 8 33 114 8 80 800 314 8 33 404 213.6667 8 33 404 213.6667 6 20 214 6 23 303 909 -explain select * from v1,v2,v3,t2 where -((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +explain select * from v1,v2,v3,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -3491,8 +3491,8 @@ id select_type table type possible_keys key key_len ref rows Extra 4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 3 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort -explain format=json select * from v1,v2,v3,t2 where -((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +explain format=json select * from v1,v2,v3,t2 where +((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); EXPLAIN { @@ -3598,7 +3598,7 @@ EXPLAIN } } # using several derived tables : pushing in all tables -# conjunctive subformulas : pushing into HAVING +# conjunctive subformulas : pushing into HAVING set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, @@ -3706,7 +3706,7 @@ EXPLAIN } # using several derived tables : pushing in all tables # extracted or formulas : pushing into HAVING -# conjunctive subformula : pushing into HAVING +# conjunctive subformula : pushing into HAVING set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, @@ -3875,10 +3875,10 @@ EXPLAIN } } # extracted or formula : pushing into HAVING -# conjunctive subformula : pushing into WHERE +# conjunctive subformula : pushing into WHERE set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); a b max_c avg_c a b c d 5 27 132 132.0000 2 3 207 207 @@ -3892,7 +3892,7 @@ a b max_c avg_c a b c d 5 27 132 132.0000 6 23 303 909 select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); a b max_c avg_c a b c d 5 27 132 132.0000 2 3 207 207 @@ -3906,7 +3906,7 @@ a b max_c avg_c a b c d 5 27 132 132.0000 6 23 303 909 explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 @@ -3914,7 +3914,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -group by a,b having max_c < 707) v1, +group by a,b having max_c < 707) v1, t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); EXPLAIN { @@ -3960,24 +3960,24 @@ EXPLAIN } } # extracted and formula : pushing into WHERE -# conjunctive subformula : pushing into HAVING +# conjunctive subformula : pushing into HAVING set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -where t1.a>5 group by a,b having max_c < 707) v1, +where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279 6 20 315 279.3333 6 23 303 909 select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -where t1.a>5 group by a,b having max_c < 707) v1, +where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); a b max_c avg_c a b c d 6 20 315 279.3333 6 20 315 279 6 20 315 279.3333 6 23 303 909 explain select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -where t1.a>5 group by a,b having max_c < 707) v1, +where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -3985,7 +3985,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 -where t1.a>5 group by a,b having max_c < 707) v1, +where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); EXPLAIN { @@ -4156,11 +4156,11 @@ EXPLAIN } } # using query with union -# extracted and formula : pushing into WHERE -# extracted or formula : pushing into HAVING +# extracted and formula : pushing into WHERE +# extracted or formula : pushing into HAVING # pushing equalities set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) -union +union select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a400) or (v1.avg_c>270)) and (v1.a400) or (v1.avg_c>270)) and (v1.a ALL NULL NULL NULL NULL NULL explain format=json select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) -union +union select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a3) and (v1.b>27)) or (v1.max_c>550); @@ -4322,7 +4322,7 @@ a b max_c avg_c a b c d 8 33 404 213.6667 8 80 800 314 8 33 404 213.6667 3 12 231 190 8 33 404 213.6667 6 23 303 909 -select * from v1,t2 where +select * from v1,t2 where ((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) union select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); @@ -4342,7 +4342,7 @@ a b max_c avg_c a b c d 8 33 404 213.6667 8 80 800 314 8 33 404 213.6667 3 12 231 190 8 33 404 213.6667 6 23 303 909 -explain select * from v1,t2 where +explain select * from v1,t2 where ((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) union select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); @@ -4354,7 +4354,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 UNION ALL NULL NULL NULL NULL 20 Using where; Using join buffer (flat, BNL join) 4 DERIVED t1 ALL NULL NULL NULL NULL 20 Using temporary; Using filesort NULL UNION RESULT ALL NULL NULL NULL NULL NULL -explain format=json select * from v1,t2 where +explain format=json select * from v1,t2 where ((t2.a=v1.a) or (v1.b=t2.b)) and ((v1.a=1) or (v1.a=6)) union select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); @@ -4454,10 +4454,10 @@ EXPLAIN } } # using query with union -# extracted or formula : pushing into HAVING -# conjunctive subformulas : pushing into WHERE +# extracted or formula : pushing into HAVING +# conjunctive subformulas : pushing into WHERE # pushing equalities -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v1,t2 where ((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) union select * from v2,t2 where @@ -4472,7 +4472,7 @@ a b max_c avg_c a b c d 6 20 315 279.3333 1 19 203 107 8 33 404 213.6667 1 21 909 12 8 33 404 213.6667 1 19 203 107 -select * from v1,t2 where +select * from v1,t2 where ((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) union select * from v2,t2 where @@ -4487,7 +4487,7 @@ a b max_c avg_c a b c d 6 20 315 279.3333 1 19 203 107 8 33 404 213.6667 1 21 909 12 8 33 404 213.6667 1 19 203 107 -explain select * from v1,t2 where +explain select * from v1,t2 where ((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) union select * from v2,t2 where @@ -4506,7 +4506,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 UNION ref key0 key0 5 test.t2.c 2 Using where 6 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort NULL UNION RESULT ALL NULL NULL NULL NULL NULL -explain format=json select * from v1,t2 where +explain format=json select * from v1,t2 where ((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) union select * from v2,t2 where @@ -4760,7 +4760,7 @@ EXPLAIN } # using derived table with union # conjunctive subformula : pushing into WHERE -# extracted or formula : pushing into HAVING +# extracted or formula : pushing into HAVING set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,t2 where ((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); a b c a b c d @@ -4963,27 +4963,27 @@ EXPLAIN } } } -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_char as v,t2_char as t where (v.a=t.a) and (v.b='Vika') and (v.max_c>2); a b max_c a b c c Vika 7 c Vinny 3 c Vika 7 c Inga 9 c Vika 7 c Ivan 2 c Vika 7 c Inga 2 -select * from v_char as v,t2_char as t where +select * from v_char as v,t2_char as t where (v.a=t.a) and (v.b='Vika') and (v.max_c>2); a b max_c a b c c Vika 7 c Vinny 3 c Vika 7 c Inga 9 c Vika 7 c Ivan 2 c Vika 7 c Inga 2 -explain select * from v_char as v,t2_char as t where +explain select * from v_char as v,t2_char as t where (v.a=t.a) and (v.b='Vika') and (v.max_c>2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t ALL NULL NULL NULL NULL 12 Using where 1 PRIMARY ref key0 key0 2 test.t.a 2 Using where 2 DERIVED t1_char ALL NULL NULL NULL NULL 12 Using where; Using temporary; Using filesort -explain format=json select * from v_char as v,t2_char as t where +explain format=json select * from v_char as v,t2_char as t where (v.a=t.a) and (v.b='Vika') and (v.max_c>2); EXPLAIN { @@ -5033,19 +5033,19 @@ EXPLAIN # conjunctive subformula : pushing into WHERE using equalities # pushing equalities set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v_union,v1,t2 where -(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) +(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) and ((v_union.c>800) or (v1.max_c>200)); a b c a b max_c avg_c a b c d 1 19 107 1 21 500 234.6000 1 21 909 12 1 19 107 1 21 500 234.6000 1 19 203 107 select * from v_union,v1,t2 where -(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) +(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) and ((v_union.c>800) or (v1.max_c>200)); a b c a b max_c avg_c a b c d 1 19 107 1 21 500 234.6000 1 21 909 12 1 19 107 1 21 500 234.6000 1 19 203 107 explain select * from v_union,v1,t2 where -(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) +(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) and ((v_union.c>800) or (v1.max_c>200)); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -5056,7 +5056,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort NULL UNION RESULT ALL NULL NULL NULL NULL NULL explain format=json select * from v_union,v1,t2 where -(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) +(v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) and ((v_union.c>800) or (v1.max_c>200)); EXPLAIN { @@ -5161,11 +5161,11 @@ EXPLAIN } } } -# using derived table with union -# extracted or formula : pushing into WHERE +# using derived table with union +# extracted or formula : pushing into WHERE # conjunctive subformula : pushing into HAVING # pushing equalities -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2_union as v,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v2_union as v,t2 where ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); a b c a b c d 8 33 404.0000 8 64 248 107 @@ -5174,7 +5174,7 @@ a b c a b c d 8 33 404.0000 8 80 800 314 6 20 312.0000 6 23 303 909 6 20 214.0000 6 23 303 909 -select * from v2_union as v,t2 where +select * from v2_union as v,t2 where ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); a b c a b c d 8 33 404.0000 8 64 248 107 @@ -5183,7 +5183,7 @@ a b c a b c d 8 33 404.0000 8 80 800 314 6 20 312.0000 6 23 303 909 6 20 214.0000 6 23 303 909 -explain select * from v2_union as v,t2 where +explain select * from v2_union as v,t2 where ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -5192,7 +5192,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 4 UNION t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort NULL UNION RESULT ALL NULL NULL NULL NULL NULL -explain format=json select * from v2_union as v,t2 where +explain format=json select * from v2_union as v,t2 where ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); EXPLAIN { @@ -5543,21 +5543,21 @@ EXPLAIN } # using derived table with union of selects without aggregation # extracted the whole condition: in WHERE of both selects -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v3_union as v,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v3_union as v,t2 where (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); a b c a b c d 1 19 2 1 21 909 12 1 21 2 1 21 909 12 1 19 2 1 19 203 107 1 21 2 1 19 203 107 -select * from v3_union as v,t2 where +select * from v3_union as v,t2 where (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); a b c a b c d 1 19 2 1 21 909 12 1 21 2 1 21 909 12 1 19 2 1 19 203 107 1 21 2 1 19 203 107 -explain select * from v3_union as v,t2 where +explain select * from v3_union as v,t2 where (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -5565,7 +5565,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where 3 UNION t1 ALL NULL NULL NULL NULL 20 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL -explain format=json select * from v3_union as v,t2 where +explain format=json select * from v3_union as v,t2 where (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); EXPLAIN { @@ -5627,7 +5627,7 @@ EXPLAIN } } } -# using derived table with union of +# using derived table with union of # a select without aggregation and a select with aggregation # extracted conjunctive predicate: pushing in WHERE of both selects set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); @@ -5716,13 +5716,13 @@ EXPLAIN } } } -# using derived table with union of +# using derived table with union of # a select without aggregation and a select with aggregation # extracted subformula: pushing in WHERE of one select # extracted subformula: pushing in HAVING of the other select # extracted sub-subformula: pushing in WHERE of the other select # using an equality in all pushdowns -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4_union as v,t2 where +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4_union as v,t2 where (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); a b c a b c d 1 33 1088 1 21 909 12 @@ -5735,7 +5735,7 @@ a b c a b c d 1 21 600 1 19 203 107 1 33 888 1 19 203 107 8 33 504 8 80 800 314 -select * from v4_union as v,t2 where +select * from v4_union as v,t2 where (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); a b c a b c d 1 33 1088 1 21 909 12 @@ -5748,7 +5748,7 @@ a b c a b c d 1 21 600 1 19 203 107 1 33 888 1 19 203 107 8 33 504 8 80 800 314 -explain select * from v4_union as v,t2 where +explain select * from v4_union as v,t2 where (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where @@ -5756,7 +5756,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t1 ALL NULL NULL NULL NULL 20 Using where; Using temporary; Using filesort 3 UNION t1 ALL NULL NULL NULL NULL 20 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL -explain format=json select * from v4_union as v,t2 where +explain format=json select * from v4_union as v,t2 where (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); EXPLAIN { @@ -6773,7 +6773,7 @@ EXPLAIN # using several derived tables : pushing in all tables # extracted or formula : pushing into WHERE # conjunctive subformula : pushing into WHERE -# pushing equalities +# pushing equalities set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from v4,v2 where (((v4.a<12) and (v4.b>13)) or (v4.a>10)) and (v4.min_c=v2.max_c) and (v4.min_c>100); @@ -6999,6 +6999,3505 @@ drop view v_union,v2_union,v3_union,v4_union; drop view v_double,v_char,v_decimal; drop table t1,t2,t1_double,t2_double,t1_char,t2_char,t1_decimal,t2_decimal; # +# MDEV-10782: condition extracted from a multiple equality +# pushed into HAVING +# +CREATE TABLE t1 (i int); +INSERT INTO t1 VALUES (1),(2); +EXPLAIN EXTENDED +SELECT * +FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 +WHERE f = 8; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 100.00 Using where +3 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 +Warnings: +Note 1003 /* select#1 */ select `sq1`.`f` AS `f` from (/* select#3 */ select min(`test`.`t1`.`i`) AS `f` from `test`.`t1` having `f` = 8) `sq1` where `sq1`.`f` = 8 +SELECT * +FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 +WHERE f = 8; +f +SELECT * +FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 +WHERE f = 1; +f +1 +DROP TABLE t1; +# +# MDEV-10783: pushdown into constant view +# +CREATE TABLE t1 (i int) ENGINE=MyISAM; +CREATE VIEW v AS SELECT 5; +SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v ); +i +DROP VIEW v; +DROP TABLE t1; +# +# MDEV-10785: second execution of a query with condition +# pushed into view +# +CREATE TABLE t1 (i int); +CREATE VIEW v1 AS SELECT i FROM t1 WHERE i < 5; +CREATE FUNCTION f (in1 int) RETURNS int RETURN in1; +CREATE VIEW v2 AS SELECT * FROM v1 GROUP BY i; +PREPARE stmt FROM "SELECT * FROM v2 WHERE f(0) <> 2"; +EXECUTE stmt; +i +EXECUTE stmt; +i +DROP FUNCTION f; +DROP VIEW v2,v1; +DROP TABLE t1; +# +# MDEV-10884: condition pushdown into derived specified by +# 1. unit with SELECT containing ORDER BY ... LIMIT +# 2. unit containing global ORDER BY ... LIMIT +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +select a from t1 order by a limit 5; +a +0 +1 +2 +3 +4 +set statement optimizer_switch='condition_pushdown_for_derived=off' for +select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); +a +0 +4 +set statement optimizer_switch='condition_pushdown_for_derived=on' for +select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); +a +0 +4 +select a from t1 where a < 4 union select a from t1 where a > 5 +order by a limit 5; +a +0 +1 +2 +3 +6 +set statement optimizer_switch='condition_pushdown_for_derived=off' for +select * from +(select a from t1 where a < 4 union select a from t1 where a > 5 +order by a limit 5) t where t.a not in (2,9); +a +0 +1 +3 +6 +set statement optimizer_switch='condition_pushdown_for_derived=on' for +select * from +(select a from t1 where a < 4 union select a from t1 where a > 5 +order by a limit 5) t where t.a not in (2,9); +a +0 +1 +3 +6 +drop table t1; +# +# MDEV-11072: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +a +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (3), (2); +INSERT INTO t3 VALUES (4), (1), (2), (7); +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +a +2 +EXPLAIN FORMAT=JSON +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT c FROM v3 WHERE c = a +) +); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "0 or (2,(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 2", + "first_match": "t1" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["c"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 5, + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 4, + "filtered": 100, + "attached_condition": "t3.c = 2" + } + } + } + } + } + } + ] + } +} +CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE OR REPLACE VIEW v4 AS +SELECT d, sum(e) AS s FROM t4 GROUP BY d; +set statement optimizer_switch='condition_pushdown_for_derived=off' for SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +a +2 +SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +a +2 +explain SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system NULL NULL NULL NULL 1 +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) +3 DEPENDENT SUBQUERY index_subquery key0 key0 5 func 2 Using where +5 DERIVED t4 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +explain format=json SELECT * FROM t1 WHERE a IN ( +SELECT b FROM v2 WHERE b < a OR b IN ( +SELECT d FROM v4 WHERE s > a +) +); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "0 or (2,(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 2", + "first_match": "t1" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["d"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 5, + "having_condition": "s > 2", + "filesort": { + "sort_key": "t4.d", + "temporary_table": { + "table": { + "table_name": "t4", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + ] + } +} +DROP VIEW v2,v3,v4; +DROP TABLE t1,t2,t3,t4; +# +# MDEV-10800: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM +( SELECT * FROM t1 +WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; +a +EXPLAIN FORMAT=JSON +SELECT * FROM +( SELECT * FROM t1 +WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "const_condition": "(1,exists(subquery#3))", + "table": { + "table_name": "t1", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.b = 1", + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.b = 1" + } + } + } + } + } + } + ] + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-11102: condition pushdown into materialized inner table +# of outer join is not applied as not being valid +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(2); +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL; +a b +0 NULL +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; +a b +0 NULL +EXPLAIN FORMAT=JSON +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "trigcond(v2.b is null) and trigcond(trigcond(t1.a is not null))", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + } + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-11103: pushdown condition with ANY subquery +# +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(v1.i <= 3)", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(t1.i <= 3)" + } + } + } + } + } +} +Warnings: +Note 1249 Select 2 was reduced during optimization +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); +i +1 +2 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-11315: condition with outer reference to mergeable derived +# +CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,7,1),(11,0,2); +CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES +(1,4,'2008-09-27 00:34:58'), +(2,5,'2007-05-28 00:00:00'), +(3,6,'2009-07-25 09:21:20'); +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM v1 AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +pk1 a b +10 7 1 +11 0 2 +EXPLAIN FORMAT=JSON +SELECT * FROM v1 AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(t1.b,(subquery#2)) or t1.b = 100" + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["pk2"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + ] + } +} +SELECT * FROM ( SELECT * FROM t1 ) AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +pk1 a b +10 7 1 +11 0 2 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT * FROM t1 ) AS sq +WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "(t1.b,(subquery#3)) or t1.b = 100" + }, + "subqueries": [ + { + "query_block": { + "select_id": 3, + "table": { + "table_name": "", + "access_type": "index_subquery", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["pk2"], + "ref": ["func"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + ] + } +} +DROP VIEW v1,v2; +DROP TABLE t1,t2; +# +# MDEV-11313: pushdown of the condition obtained +# after constant row substitution +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (50); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +f +0 +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.a = 50", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a = 50" + } + } + } + } + } + } + ] + } +} +CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM; +INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ; +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +f +3 +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "system", + "rows": 1, + "filtered": 100 + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "v2.s < 50", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "s < 50", + "filesort": { + "sort_key": "t3.a", + "temporary_table": { + "table": { + "table_name": "t3", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + ] + } +} +DROP VIEW v1,v2; +DROP TABLE t1,t2,t3; +# +# MDEV-10882: pushdown of the predicate with cached value +# +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,2),(3,4); +CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (5),(6); +SELECT a, GROUP_CONCAT(b) FROM v1 +WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; +a GROUP_CONCAT(b) +1 2 +EXPLAIN FORMAT=JSON +SELECT a, GROUP_CONCAT(b) FROM v1 +WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "read_sorted_file": { + "filesort": { + "sort_key": "v1.a", + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.b = 2", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.b = 2" + } + } + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1,t2; +# +# MDEV-10836: pushdown of the predicate with cached value +# +CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM; +CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; +INSERT INTO t VALUES (1,1),(3,2); +SELECT * FROM v AS v1, v AS v2 +WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); +pk f pk f +3 2 3 2 +EXPLAIN FORMAT=JSON +SELECT * FROM v AS v1, v AS v2 +WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.f = 2", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t.f = 2" + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.pk > 2" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t", + "access_type": "range", + "possible_keys": ["PRIMARY"], + "key": "PRIMARY", + "key_length": "4", + "used_key_parts": ["pk"], + "rows": 2, + "filtered": 100, + "index_condition": "t.pk > 2" + } + } + } + } + } +} +DROP VIEW v; +DROP TABLE t; +# +# MDEV-11488: pushdown of the predicate with cached value +# +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(3),(2); +CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +3 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 3", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 3" + } + } + } + } + } +} +UPDATE t2 SET j = 2 WHERE j = 3; +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2 +DROP TABLE t1,t2; +CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.2),(2.71); +CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.2),(2.71); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2.71 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 2.7100000381469727", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 2.7100000381469727" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.21),(2.47); +CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.21),(4.55); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +3.21 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 3.21", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 3.21" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('cc'),('aa'),('ddd'); +CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bbb'),('aa'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +aa +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = 'aa'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = 'aa'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES +('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20'); +CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES +('2007-05-28 00:00:00'), ('2010-08-25 00:00:00'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2007-05-28 00:00:00 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = '2007-05-28 00:00:00'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i DATE) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25'); +CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +2007-05-28 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = '2007-05-28'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = DATE'2007-05-28'" + } + } + } + } + } +} +DROP TABLE t1,t2; +CREATE TABLE t1 (i TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20'); +CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10'); +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +i +10:00:02 +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq +WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 3, + "table": { + "message": "Select tables optimized away" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "sq.i = '10:00:02'", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.i = TIME'10:00:02'" + } + } + } + } + } +} +DROP TABLE t1,t2; +# +# MDEV-11593: pushdown of condition with NULLIF +# +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (2), (1); +SELECT * FROM v1 WHERE NULLIF(1, i); +i +2 +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE NULLIF(1, i); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "nullif(1,v1.i)", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "nullif(1,t1.i)" + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-11608: pushdown of the predicate with cached null value +# +CREATE TABLE t1 (c VARCHAR(3)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE TABLE t2 (c VARCHAR(3)); +INSERT INTO t2 VALUES ('foo'),('xyz'); +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +c +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "system", + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "message": "Impossible WHERE" + } + } + } + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c = NULL", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.c = NULL" + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1,t2; +CREATE TABLE t1 (d DECIMAL(10,2)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (5.37),(1.1); +CREATE TABLE t2 (d DECIMAL(10,2)); +INSERT INTO t2 VALUES ('1.1'),('2.23'); +SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 ); +d +DROP VIEW v1; +DROP TABLE t1,t2; +# +# MDEV-11820: second execution of PS for query +# with false subquery predicate in WHERE +# +CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (3), (4); +PREPARE stmt1 FROM +" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; +PREPARE stmt2 FROM +"EXPLAIN FORMAT=JSON + SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; +EXECUTE stmt1; +c +foo +EXECUTE stmt2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.c = 'foo'", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.c = 'foo'" + } + } + } + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "1 = t2.a" + } + } + } + ] + } +} +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +EXECUTE stmt1; +c +foo +EXECUTE stmt2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "((1,(subquery#2))) or v1.c = 'foo'", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + }, + "subqueries": [ + { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 128, + "filtered": 100, + "attached_condition": "1 = t2.a" + } + } + } + ] + } +} +DEALLOCATE PREPARE stmt1; +DEALLOCATE PREPARE stmt2; +DROP VIEW v1; +DROP TABLE t1,t2; +# +# MDEV-12373: pushdown into derived with side effects is prohibited +# +CREATE TABLE sales_documents ( +id int NOT NULL AUTO_INCREMENT, +sale_id int NULL DEFAULT NULL, +type tinyint unsigned NULL DEFAULT NULL, +data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci', +date date NULL DEFAULT NULL, +order_number int unsigned NULL DEFAULT NULL, +created_at int NULL DEFAULT NULL, +updated_at int NULL DEFAULT NULL, +generated tinyint NOT NULL DEFAULT '0', +synced_at int NOT NULL DEFAULT '0', +sum decimal(13,2) NOT NULL DEFAULT '0', +PRIMARY KEY (id) +); +INSERT INTO sales_documents +(id, sale_id, type, order_number, data, created_at, +updated_at, date, generated, synced_at, sum) +VALUES +(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00), +(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00), +(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00), +(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00), +(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00), +(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00), +(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00), +(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00), +(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00), +(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00), +(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00), +(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00), +(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00), +(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00), +(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00), +(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00), +(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00), +(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00), +(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00), +(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00), +(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00), +(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00), +(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00), +(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00), +(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00), +(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00), +(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00), +(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00), +(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00), +(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00), +(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00), +(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00), +(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00), +(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00), +(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00), +(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00), +(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00), +(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00), +(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00), +(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00), +(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00), +(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00), +(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00), +(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00), +(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00), +(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00), +(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00), +(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00), +(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00), +(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00), +(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00), +(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00), +(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00), +(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75), +(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00), +(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00), +(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00), +(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00), +(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00), +(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00); +SELECT * FROM +(SELECT @row := @row + 1 as row, a.* from ( +SELECT t.order_number +FROM sales_documents t +WHERE +t.type = 2 AND +t.date >= '2017-01-01' AND +t.date <= '2017-12-31' AND +t.order_number IS NOT NULL AND +t.generated = 1 +GROUP BY t.order_number +) a, (SELECT @row := 0) r) t +WHERE row <> order_number; +row order_number +14 51 +DROP TABLE sales_documents; +# +# MDEV-12845: pushdown from merged derived using equalities +# +create table t1 (a int); +insert into t1 values +(4), (8), (5), (3), (10), (2), (7); +create table t2 (b int, c int); +insert into t2 values +(2,1), (5,2), (2,2), (4,1), (4,3), +(5,3), (2,4), (4,6), (2,1); +create view v1 as +select b, sum(c) as s from t2 group by b; +create view v2 as +select distinct b, c from t2; +create view v3 as +select b, max(c) as m from t2 group by b; +select b +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where b > 2; +b +4 +5 +explain format=json select b +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where b > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a > 2 and t1.a is not null" + }, + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t2.b", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b > 2" + } + } + } + } + } + } + } +} +select a +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where a > 2; +a +4 +5 +explain format=json select a +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where a > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a > 2 and t1.a is not null" + }, + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t2.b", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b > 2" + } + } + } + } + } + } + } +} +select a +from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t +where a > 2; +a +4 +4 +4 +5 +5 +explain format=json select a +from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t +where a > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a > 2 and t1.a is not null" + }, + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["b"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100, + "attached_condition": "t2.b > 2" + } + } + } + } + } + } +} +select a +from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t +where a > 2; +a +4 +3 +explain format=json select a +from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t +where a > 2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a > 2 and t1.a is not null" + }, + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "5", + "used_key_parts": ["m"], + "ref": ["test.t1.a"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "m > 2", + "filesort": { + "sort_key": "t2.b", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + } + } + } + } + } + } + } +} +drop view v1,v2,v3; +drop table t1,t2; +# +# MDEV-13166: pushdown from merged derived +# +CREATE TABLE t1 (i int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1; +SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; +f +2 +explain format=json SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v1.f > 0", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "f > 0", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + } + } + } + } + } +} +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-13193: pushdown of equality extracted from multiple equality +# +CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2),(4); +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; +SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq +WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); +i1 i2 +explain format=json SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq +WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["i1"], + "key": "i1", + "key_length": "5", + "used_key_parts": ["i1"], + "ref": ["const"], + "rows": 1, + "filtered": 100, + "using_index": true + }, + "block-nl-join": { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "v2.i2 = 1" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.i2 = 1" + } + } + } + } + } +} +DROP VIEW v2; +DROP TABLE t1,t2; +# +# MDEV-14237: derived with regexp_substr() in select list +# +create table t1 (a char(8)); +insert into t1 values ('b'), ('a'), ('xx'); +select * +from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t +where t.f = 'a' or t.f = 'b'; +f +b +a +explain format=json select * +from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t +where t.f = 'a' or t.f = 'b'; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t.f = 'a' or t.f = 'b'", + "materialized": { + "query_block": { + "select_id": 2, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } +} +drop table t1; +# +# MDEV-13454: consequence of mdev-14368 fixed for 5.5 +# +SET sql_mode = 'ONLY_FULL_GROUP_BY'; +create table t1 (id int, id2 int); +insert into t1 values (1,1),(2,3),(3,4),(7,2); +create table t2(id2 int); +insert t2 values (1),(2),(3); +SELECT * FROM t1 +LEFT OUTER JOIN +(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) +WHERE (vc.ct>0); +id2 id ct +1 1 1 +3 2 1 +2 7 1 +EXPLAIN FORMAT=JSON SELECT * FROM t1 +LEFT OUTER JOIN +(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) +WHERE (vc.ct>0); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "vc.ct > 0", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "ct > 0", + "filesort": { + "sort_key": "t2.id2", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 4, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t1.id2 = vc.id2" + } + } +} +DROP TABLE t1,t2; +SET sql_mode = DEFAULT; +# +# MDEV-15579: incorrect removal of sub-formulas to be pushed +# into WHERE of materialized derived with GROUP BY +# +CREATE TABLE t1 (a INT, b INT, c INT, d INT); +CREATE TABLE t2 (x INT, y INT, z INT); +INSERT INTO t1 VALUES (1,1,66,1), (1,1,56,2), (3,2,42,3); +INSERT INTO t2 VALUES (1,1,66), (1,12,32); +SELECT * +FROM t2, +( +SELECT a, b, max(c) AS max_c +FROM t1 +GROUP BY a +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND +(v1.a=t2.x) AND (v1.max_c>30); +x y z a b max_c +1 1 66 1 1 66 +1 12 32 1 1 66 +EXPLAIN SELECT * +FROM t2, +( +SELECT a, b, max(c) AS max_c +FROM t1 +GROUP BY a +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND +(v1.a=t2.x) AND (v1.max_c>30); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN FORMAT=JSON SELECT * +FROM t2, +( +SELECT a, b, max(c) AS max_c +FROM t1 +GROUP BY a +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND +(v1.a=t2.x) AND (v1.max_c>30); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.x = 1" + }, + "block-nl-join": { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "v1.a = 1 and v1.b = 1 and v1.max_c > 30" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c > 37 and max_c > 30 and t1.b = 1", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.a = 1" + } + } + } + } + } +} +SELECT * +FROM t2, +( +SELECT a, b, d, max(c) AS max_c +FROM t1 +GROUP BY a,d +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND +(v1.a=t2.x) AND (v1.max_c>30); +x y z a b d max_c +1 1 66 1 1 1 66 +1 12 32 1 1 1 66 +EXPLAIN SELECT * +FROM t2, +( +SELECT a, b, d, max(c) AS max_c +FROM t1 +GROUP BY a,d +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND +(v1.a=t2.x) AND (v1.max_c>30); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where +1 PRIMARY ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where +EXPLAIN FORMAT=JSON SELECT * +FROM t2, +( +SELECT a, b, d, max(c) AS max_c +FROM t1 +GROUP BY a,d +HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND +(v1.a=t2.x) AND (v1.max_c>30); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t2.x = 1" + }, + "block-nl-join": { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "v1.a = 1 and v1.b = 1 and v1.d = 1 and v1.max_c > 30" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "max_c > 37 and max_c > 30 and t1.b = 1", + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "t1.a = 1 and t1.d = 1" + } + } + } + } + } +} +DROP TABLE t1,t2; +# +# MDEV-15765: pushing condition with temporal constants +# into constant tables +# +select * from (select date('2018-01-01') as d +union all +select date('2018-01-01') as d) as t +where t.d between date ('2017-01-01') and date ('2019-01-01'); +d +2018-01-01 +2018-01-01 +select * from (select date('2018-01-01') as d) as t +where t.d between date ('2017-01-01') and date ('2019-01-01'); +d +2018-01-01 +# +# MDEV-16088: pushdown into derived defined in the IN subquery +# +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (e INT, f INT, g INT); +INSERT INTO t1 VALUES (1,14),(2,13),(1,19),(2,32),(3,24); +INSERT INTO t2 VALUES (1,19,2),(3,24,1),(1,12,2),(3,11,3),(2,32,1); +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.e>1 +) +; +a b +2 32 +3 24 +EXPLAIN SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.e>1 +) +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED ALL NULL NULL NULL NULL 5 Using where +3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +EXPLAIN FORMAT=JSON SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.e>1 +) +; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + }, + "table": { + "table_name": "", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "8", + "used_key_parts": ["e", "max_f"], + "ref": ["func", "func"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "d_tab.e > 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_f > 18", + "filesort": { + "sort_key": "t2.e", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t2.e > 1" + } + } + } + } + } + } + } + } + } + } +} +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.max_f<25 +) +; +a b +1 19 +3 24 +EXPLAIN SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.max_f<25 +) +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 +1 PRIMARY eq_ref distinct_key distinct_key 8 func,func 1 +2 MATERIALIZED ALL NULL NULL NULL NULL 5 Using where +3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +EXPLAIN FORMAT=JSON SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e,d_tab.max_f +FROM ( +SELECT t2.e, MAX(t2.f) AS max_f +FROM t2 +GROUP BY t2.e +HAVING max_f>18 +) as d_tab +WHERE d_tab.max_f<25 +) +; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + }, + "table": { + "table_name": "", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "8", + "used_key_parts": ["e", "max_f"], + "ref": ["func", "func"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "d_tab.max_f < 25", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_f > 18 and max_f < 25", + "filesort": { + "sort_key": "t2.e", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + } + } +} +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.e>1 +GROUP BY d_tab.g +) +; +a b +2 32 +EXPLAIN SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.e>1 +GROUP BY d_tab.g +) +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED ALL NULL NULL NULL NULL 5 Using where; Using temporary +3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort +EXPLAIN FORMAT=JSON SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.e>1 +GROUP BY d_tab.g +) +; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t1.a is not null and t1.b is not null" + }, + "table": { + "table_name": "", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "8", + "used_key_parts": ["e", "max_f"], + "ref": ["test.t1.a", "test.t1.b"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "temporary_table": { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "d_tab.e > 1", + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t2.e", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t2.e > 1" + } + } + } + } + } + } + } + } + } + } + } +} +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.max_f>20 +GROUP BY d_tab.g +) +; +a b +2 32 +EXPLAIN SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.max_f>20 +GROUP BY d_tab.g +) +; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 +2 MATERIALIZED ALL NULL NULL NULL NULL 5 Using where; Using temporary +3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort +EXPLAIN FORMAT=JSON SELECT * FROM t1 +WHERE (t1.a,t1.b) IN +( +SELECT d_tab.e, MAX(d_tab.max_f) AS max_f +FROM ( +SELECT t2.e, MAX(t2.f) as max_f, t2.g +FROM t2 +GROUP BY t2.e +) as d_tab +WHERE d_tab.max_f>20 +GROUP BY d_tab.g +) +; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t1.a is not null and t1.b is not null" + }, + "table": { + "table_name": "", + "access_type": "eq_ref", + "possible_keys": ["distinct_key"], + "key": "distinct_key", + "key_length": "8", + "used_key_parts": ["e", "max_f"], + "ref": ["test.t1.a", "test.t1.b"], + "rows": 1, + "filtered": 100, + "materialized": { + "unique": 1, + "query_block": { + "select_id": 2, + "temporary_table": { + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "d_tab.max_f > 20", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "max_f > 20", + "filesort": { + "sort_key": "t2.e", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + } + } + } + } + } + } + } + } + } + } + } +} +DROP TABLE t1,t2; +# +# MDEV-15765: pushing condition with IN subquery defined with constants +# using substitution +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM +( +SELECT DISTINCT * FROM t1 +) der_tab +WHERE (a>0 AND a<2 OR a IN (2,3)) AND +(a=2 OR 0); +a +2 +DROP TABLE t1; +# +# MDEV-16386: pushing condition into the HAVING clause when ambiguous +# fields warning appears +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(2,3),(3,4); +SELECT * FROM +( +SELECT t1.b AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a=2); +a +2 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT t1.b AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a=2); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "dt.a = 2", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "a = 2", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * FROM +( +SELECT t1.b AS a +FROM t1 +GROUP BY t1.a +HAVING (t1.a<3) +) dt +WHERE (dt.a>1); +a +2 +3 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT t1.b AS a +FROM t1 +GROUP BY t1.a +HAVING (t1.a<3) +) dt +WHERE (dt.a>1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "dt.a > 1", + "materialized": { + "query_block": { + "select_id": 2, + "having_condition": "t1.a < 3 and a > 1", + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * FROM +( +SELECT 'ab' AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a='ab'); +a +ab +ab +ab +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT 'ab' AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a='ab'); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "dt.a = 'ab'", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * FROM +( +SELECT 1 AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a=1); +a +1 +1 +1 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT 1 AS a +FROM t1 +GROUP BY t1.a +) dt +WHERE (dt.a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "dt.a = 1", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +DROP TABLE t1; +# +# MDEV-16517: pushdown condition with the IN predicate defined +# with non-constant values +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(1,3); +SELECT * FROM +( +SELECT t1.a +FROM t1 +WHERE 1 IN (0,t1.a) +GROUP BY t1.a +) AS dt1 +JOIN +( +SELECT t1.a +FROM t1 +WHERE 1 IN (0,t1.a) +) AS dt2 +ON dt1.a = dt2.a; +a a +1 1 +1 1 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT t1.a +FROM t1 +WHERE 1 IN (0,t1.a) +GROUP BY t1.a +) AS dt1 +JOIN +( +SELECT t1.a +FROM t1 +WHERE 1 IN (0,t1.a) +) AS dt2 +ON dt1.a = dt2.a; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "1 in (0,dt1.a)", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "1 in (0,t1.a) and 1 in (0,t1.a)" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t1.a = dt1.a" + } + } +} +SELECT * FROM +( +SELECT t1.a,MAX(t1.b) +FROM t1 +GROUP BY t1.a +) AS dt, t1 +WHERE dt.a=t1.a AND dt.a IN (1,t1.a); +a MAX(t1.b) a b +1 3 1 2 +1 3 1 3 +EXPLAIN FORMAT=JSON SELECT * FROM +( +SELECT t1.a,MAX(t1.b) +FROM t1 +GROUP BY t1.a +) AS dt, t1 +WHERE dt.a=t1.a AND dt.a IN (1,t1.a); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "dt.a in (1,dt.a)", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.a in (1,t1.a)" + } + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t1.a = dt.a" + } + } +} +DROP TABLE t1; +# +# MDEV-15087: error from inexpensive subquery before check +# for condition pushdown into derived +# +CREATE TABLE t1 (i1 int, v1 varchar(1)); +INSERT INTO t1 VALUES (7,'x'); +CREATE TABLE t2 (i1 int); +INSERT INTO t2 VALUES (8); +CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1)); +INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL); +SELECT 1 +FROM (t1 AS a1 +JOIN (((SELECT DISTINCT t3.* +FROM t3) AS a2 +JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1)) +WHERE (SELECT BIT_COUNT(t2.i1) +FROM (t2 JOIN t3)) IS NULL; +ERROR 21000: Subquery returns more than 1 row +DROP TABLE t1, t2, t3; +# +# MDEV-16614 signal 7 after calling stored procedure, that uses regexp +# +CREATE PROCEDURE p1(m1 varchar(5), m2 varchar(5)) +BEGIN +SELECT a FROM +(SELECT "aa" a) t +JOIN (SELECT "aa" b) t1 on t.a=t1.b +WHERE t.a regexp m1 and t1.b regexp m2 +GROUP BY a; +END$$ +CALL p1('a','a'); +a +aa +DROP PROCEDURE p1; +CREATE PROCEDURE p1(m1 varchar(5)) +BEGIN +SELECT a FROM (SELECT "aa" a) t WHERE t.a regexp m1; +END$$ +CALL p1('a'); +a +aa +DROP PROCEDURE p1; +SELECT a FROM (SELECT "aa" a) t WHERE REGEXP_INSTR(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); +a +aa +CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT +BEGIN +RETURN 1; +END;$$ +CREATE OR REPLACE PROCEDURE p1(m1 varchar(5)) +BEGIN +SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, m1); +END$$ +CALL p1('a'); +a +aa +DROP PROCEDURE p1; +DROP FUNCTION f1; +CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT +BEGIN +RETURN 1; +END;$$ +SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); +a +aa +DROP FUNCTION f1; +# +# MDEV-17011: condition pushdown into materialized derived used +# in INSERT SELECT, multi-table UPDATE and DELETE +# +CREATE TABLE t1 (a int ,b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES +(1, 1), (1, 2), (2, 1), (2, 2), (3,1), (3,3), (4,2); +CREATE TABLE t2 (a int) ENGINE MYISAM; +INSERT INTO t2 VALUES +(3), (7), (1), (4), (1); +CREATE TABLE t3 (a int, b int) ENGINE MYISAM; +EXPLAIN FORMAT=JSON INSERT INTO t3 +SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t.a <= 2", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a <= 2" + } + } + } + } + } + } + } +} +INSERT INTO t3 +SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; +SELECT * FROM t3; +a b +1 2 +2 2 +EXPLAIN FORMAT=JSON UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 +WHERE t2.a= t.c and t.a>=3; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100, + "attached_condition": "t2.a is not null" + }, + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "8", + "used_key_parts": ["c"], + "ref": ["test.t2.a"], + "rows": 2, + "filtered": 100, + "attached_condition": "t2.a = t.c and t.a >= 3", + "materialized": { + "query_block": { + "select_id": 2, + "filesort": { + "sort_key": "t1.a", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a >= 3" + } + } + } + } + } + } + } +} +UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 +WHERE t2.a= t.c and t.a>=3; +SELECT * FROM t2; +a +3 +7 +11 +4 +11 +EXPLAIN FORMAT=JSON DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t +WHERE t2.a= t.c+9 and t.a=2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 5, + "filtered": 100 + }, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t.a = 2 and t2.a = t.c + 9", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 7, + "filtered": 100, + "attached_condition": "t1.a = 2" + } + } + } + } + } +} +DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t +WHERE t2.a= t.c+9 and t.a=2; +SELECT * FROM t2; +a +3 +7 +4 +DROP TABLE t1,t2,t3; +# +# MDEV-16765: pushdown condition with the CASE structure +# defined with Item_cond item +# +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,2), (3,4), (2,3); +SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +max_a b +1 2 +1 3 +EXPLAIN FORMAT=JSON SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (tab2.max_a = 1 or tab2.max_a = 2) then 1 else 0 end = 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "case when (max_a = 1 or max_a = 2) then 1 else 0 end = 1", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +max_a b +1 2 +1 4 +EXPLAIN FORMAT=JSON SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4) then 1 else 0 end = 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "case when (max_a = 1 or max_a > 2 and max_a < 4) then 1 else 0 end = 1", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +max_a b +1 3 +1 4 +EXPLAIN FORMAT=JSON SELECT * +FROM +( +SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2)) then 1 else 0 end = 1", + "materialized": { + "query_block": { + "select_id": 3, + "having_condition": "case when (max_a > 1 and (max_a = 2 or max_a > 2)) then 1 else 0 end = 1", + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100 + } + } + } + } + } + } + } +} +SELECT * +FROM +( +SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +max_a b +1 2 +1 4 +EXPLAIN FORMAT=JSON SELECT * +FROM +( +SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) +THEN 1 ELSE 0 END AS max_a,b +FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (tab2.b = 2 or tab2.b = 4) then 1 else 0 end = 1", + "materialized": { + "query_block": { + "select_id": 3, + "filesort": { + "sort_key": "t1.b", + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 3, + "filtered": 100, + "attached_condition": "case when (t1.b = 2 or t1.b = 4) then 1 else 0 end = 1" + } + } + } + } + } + } + } +} +DROP TABLE t1; +# +# MDEV-16803: pushdown condition with IN predicate in the derived table +# defined with several SELECT statements +# +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,2),(1,1); +SELECT * FROM +( +SELECT a,b,1 as c +FROM t1 +UNION ALL +SELECT a,b,2 as c +FROM t1 +) AS tab +WHERE ((a,b) IN ((1,2),(3,2))); +a b c +1 2 1 +3 2 1 +1 2 2 +3 2 2 +DROP TABLE t1; +# +# MDEV-17354: INSERT SELECT with condition pushdown into derived +# +CREATE TABLE t1 (f INT NOT NULL); +INSERT INTO t1 VALUES (3), (7), (3); +CREATE ALGORITHM= TEMPTABLE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 ) AS sq; +INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; +EXPLAIN INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 144 Using where +2 DERIVED ALL NULL NULL NULL NULL 12 +2 DERIVED t1 ALL NULL NULL NULL NULL 12 Using where; Using join buffer (flat, BNL join) +4 DERIVED t1 ALL NULL NULL NULL NULL 12 +EXPLAIN FORMAT=JSON INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 144, + "filtered": 100, + "attached_condition": "t.f is not null", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 12, + "filtered": 100 + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 12, + "filtered": 100, + "attached_condition": "t1.f is not null" + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL" + } + } + } + } + } +} +SELECT * FROM t1; +f +3 +7 +3 +3 +3 +3 +7 +7 +7 +3 +3 +3 +DELETE FROM t1; +INSERT INTO t1 VALUES (3), (7), (3); +INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ON v1.f=t1.f) AS t +WHERE f IS NOT NULL; +EXPLAIN FORMAT=JSON INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ON v1.f=t1.f) AS t +WHERE f IS NOT NULL; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 16, + "filtered": 100, + "attached_condition": "t.f is not null", + "materialized": { + "query_block": { + "select_id": 2, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 8, + "filtered": 100, + "attached_condition": "t1.f is not null" + }, + "table": { + "table_name": "", + "access_type": "ref", + "possible_keys": ["key0"], + "key": "key0", + "key_length": "4", + "used_key_parts": ["f"], + "ref": ["test.t1.f"], + "rows": 2, + "filtered": 100, + "materialized": { + "query_block": { + "select_id": 4, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 8, + "filtered": 100, + "attached_condition": "t1.f is not null" + } + } + } + } + } + } + } + } +} +SELECT * FROM t1; +f +3 +7 +3 +3 +3 +7 +3 +3 +DROP VIEW v1; +DROP TABLE t1; +# +# MDEV-17574: pushdown into derived from mergeable view +# used in multi-table UPDATE +# pushdown into materialized derived from mergeable view +# used in SELECT +# +CREATE TABLE t1 (f1 text, f2 int); +INSERT INTO t1 VALUES ('x',1), ('y',2); +CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t; +UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2; +EXPLAIN FORMAT=JSON UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t.f2 < 2", + "materialized": { + "query_block": { + "select_id": 3, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 < 2" + } + } + } + }, + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 = t.f2" + } + } +} +SELECT * FROM t1; +f1 f2 +z 1 +y 2 +CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t; +SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2; +f2 f1 f2 +1 z 1 +EXPLAIN FORMAT=JSON SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2; +EXPLAIN +{ + "query_block": { + "select_id": 1, + "table": { + "table_name": "", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t.f2 < 2", + "materialized": { + "query_block": { + "select_id": 3, + "temporary_table": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100, + "attached_condition": "t1.f2 < 2" + } + } + } + } + }, + "block-nl-join": { + "table": { + "table_name": "t1", + "access_type": "ALL", + "rows": 2, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t1.f2 = t.f2" + } + } +} +DROP VIEW v1,v2; +DROP TABLE t1; +# End of 10.2 tests +# # MDEV-14579: pushdown conditions into materialized views/derived tables # that are defined with EXIST or/and INTERSECT # @@ -10464,16 +13963,16 @@ a b max_c a b c 1 21 345 3 21 231 select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); a b max_c a b c -1 21 345 3 21 231 2 33 7 5 33 207 -2 33 7 8 33 117 -3 21 500 3 21 231 4 33 123 5 33 207 +2 33 7 8 33 117 4 33 123 8 33 117 +1 21 345 3 21 231 +3 21 500 3 21 231 explain select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 9 -1 PRIMARY ALL NULL NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 PRIMARY ALL NULL NULL NULL NULL 5 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 9 Using where; Using join buffer (flat, BNL join) 2 DERIVED t3 range i1 i1 5 NULL 5 Using index condition explain format=json select * from v1,t2 where (v1.b=t2.b) and (v1.a<5); EXPLAIN @@ -10481,23 +13980,11 @@ EXPLAIN "query_block": { "select_id": 1, "table": { - "table_name": "t2", + "table_name": "", "access_type": "ALL", - "rows": 9, - "filtered": 100 - }, - "block-nl-join": { - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 5, - "filtered": 80, - "attached_condition": "v1.a < 5" - }, - "buffer_type": "flat", - "buffer_size": "256Kb", - "join_type": "BNL", - "attached_condition": "v1.b = t2.b", + "rows": 5, + "filtered": 100, + "attached_condition": "v1.a < 5", "materialized": { "query_block": { "select_id": 2, @@ -10514,6 +14001,18 @@ EXPLAIN } } } + }, + "block-nl-join": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "rows": 9, + "filtered": 100 + }, + "buffer_type": "flat", + "buffer_size": "256Kb", + "join_type": "BNL", + "attached_condition": "t2.b = v1.b" } } } @@ -10715,2833 +14214,7 @@ drop view v1; alter table t3 drop index i1; drop table t1,t2,t3; # -# MDEV-10782: condition extracted from a multiple equality -# pushed into HAVING -# -CREATE TABLE t1 (i int); -INSERT INTO t1 VALUES (1),(2); -EXPLAIN EXTENDED -SELECT * -FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 -WHERE f = 8; -id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY ALL NULL NULL NULL NULL 2 100.00 Using where -3 DERIVED t1 ALL NULL NULL NULL NULL 2 100.00 -Warnings: -Note 1003 /* select#1 */ select `sq1`.`f` AS `f` from (/* select#3 */ select min(`test`.`t1`.`i`) AS `f` from `test`.`t1` having `f` = 8) `sq1` where `sq1`.`f` = 8 -SELECT * -FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 -WHERE f = 8; -f -SELECT * -FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 -WHERE f = 1; -f -1 -DROP TABLE t1; -# -# MDEV-10783: pushdown into constant view -# -CREATE TABLE t1 (i int) ENGINE=MyISAM; -CREATE VIEW v AS SELECT 5; -SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v ); -i -DROP VIEW v; -DROP TABLE t1; -# -# MDEV-10785: second execution of a query with condition -# pushed into view -# -CREATE TABLE t1 (i int); -CREATE VIEW v1 AS SELECT i FROM t1 WHERE i < 5; -CREATE FUNCTION f (in1 int) RETURNS int RETURN in1; -CREATE VIEW v2 AS SELECT * FROM v1 GROUP BY i; -PREPARE stmt FROM "SELECT * FROM v2 WHERE f(0) <> 2"; -EXECUTE stmt; -i -EXECUTE stmt; -i -DROP FUNCTION f; -DROP VIEW v2,v1; -DROP TABLE t1; -# -# MDEV-10884: condition pushdown into derived specified by -# 1. unit with SELECT containing ORDER BY ... LIMIT -# 2. unit containing global ORDER BY ... LIMIT -# -create table t1(a int); -insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); -select a from t1 order by a limit 5; -a -0 -1 -2 -3 -4 -set statement optimizer_switch='condition_pushdown_for_derived=off' for -select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); -a -0 -4 -set statement optimizer_switch='condition_pushdown_for_derived=on' for -select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); -a -0 -4 -select a from t1 where a < 4 union select a from t1 where a > 5 -order by a limit 5; -a -0 -1 -2 -3 -6 -set statement optimizer_switch='condition_pushdown_for_derived=off' for -select * from -(select a from t1 where a < 4 union select a from t1 where a > 5 -order by a limit 5) t where t.a not in (2,9); -a -0 -1 -3 -6 -set statement optimizer_switch='condition_pushdown_for_derived=on' for -select * from -(select a from t1 where a < 4 union select a from t1 where a > 5 -order by a limit 5) t where t.a not in (2,9); -a -0 -1 -3 -6 -drop table t1; -# -# MDEV-11072: pushdown of the condition obtained -# after constant row substitution -# -CREATE TABLE t1 (a INT) ENGINE=MyISAM; -CREATE TABLE t2 (b INT) ENGINE=MyISAM; -CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; -CREATE TABLE t3 (c INT) ENGINE=MyISAM; -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; -SELECT * FROM t1 WHERE a IN ( -SELECT b FROM v2 WHERE b < a OR b IN ( -SELECT c FROM v3 WHERE c = a -) -); -a -INSERT INTO t1 VALUES (2); -INSERT INTO t2 VALUES (3), (2); -INSERT INTO t3 VALUES (4), (1), (2), (7); -SELECT * FROM t1 WHERE a IN ( -SELECT b FROM v2 WHERE b < a OR b IN ( -SELECT c FROM v3 WHERE c = a -) -); -a -2 -EXPLAIN FORMAT=JSON -SELECT * FROM t1 WHERE a IN ( -SELECT b FROM v2 WHERE b < a OR b IN ( -SELECT c FROM v3 WHERE c = a -) -); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "const_condition": "0 or (2,(subquery#3))", - "table": { - "table_name": "t1", - "access_type": "system", - "rows": 1, - "filtered": 100 - }, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t2.b = 2", - "first_match": "t1" - }, - "subqueries": [ - { - "query_block": { - "select_id": 3, - "table": { - "table_name": "", - "access_type": "index_subquery", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["c"], - "ref": ["func"], - "rows": 2, - "filtered": 100, - "materialized": { - "query_block": { - "select_id": 5, - "table": { - "table_name": "t3", - "access_type": "ALL", - "rows": 4, - "filtered": 100, - "attached_condition": "t3.c = 2" - } - } - } - } - } - } - ] - } -} -CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM; -INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); -CREATE OR REPLACE VIEW v4 AS -SELECT d, sum(e) AS s FROM t4 GROUP BY d; -set statement optimizer_switch='condition_pushdown_for_derived=off' for SELECT * FROM t1 WHERE a IN ( -SELECT b FROM v2 WHERE b < a OR b IN ( -SELECT d FROM v4 WHERE s > a -) -); -a -2 -SELECT * FROM t1 WHERE a IN ( -SELECT b FROM v2 WHERE b < a OR b IN ( -SELECT d FROM v4 WHERE s > a -) -); -a -2 -explain SELECT * FROM t1 WHERE a IN ( -SELECT b FROM v2 WHERE b < a OR b IN ( -SELECT d FROM v4 WHERE s > a -) -); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 system NULL NULL NULL NULL 1 -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where; FirstMatch(t1) -3 DEPENDENT SUBQUERY index_subquery key0 key0 5 func 2 Using where -5 DERIVED t4 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort -explain format=json SELECT * FROM t1 WHERE a IN ( -SELECT b FROM v2 WHERE b < a OR b IN ( -SELECT d FROM v4 WHERE s > a -) -); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "const_condition": "0 or (2,(subquery#3))", - "table": { - "table_name": "t1", - "access_type": "system", - "rows": 1, - "filtered": 100 - }, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t2.b = 2", - "first_match": "t1" - }, - "subqueries": [ - { - "query_block": { - "select_id": 3, - "table": { - "table_name": "", - "access_type": "index_subquery", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["d"], - "ref": ["func"], - "rows": 2, - "filtered": 100, - "materialized": { - "query_block": { - "select_id": 5, - "having_condition": "s > 2", - "filesort": { - "sort_key": "t4.d", - "temporary_table": { - "table": { - "table_name": "t4", - "access_type": "ALL", - "rows": 5, - "filtered": 100 - } - } - } - } - } - } - } - } - ] - } -} -DROP VIEW v2,v3,v4; -DROP TABLE t1,t2,t3,t4; -# -# MDEV-10800: pushdown of the condition obtained -# after constant row substitution -# -CREATE TABLE t1 (a INT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1); -CREATE TABLE t2 (b INT) ENGINE=MyISAM; -INSERT INTO t2 VALUES (3),(4); -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; -SELECT * FROM -( SELECT * FROM t1 -WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; -a -EXPLAIN FORMAT=JSON -SELECT * FROM -( SELECT * FROM t1 -WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "const_condition": "(1,exists(subquery#3))", - "table": { - "table_name": "t1", - "access_type": "system", - "rows": 1, - "filtered": 100 - }, - "subqueries": [ - { - "query_block": { - "select_id": 3, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v2.b = 1", - "materialized": { - "query_block": { - "select_id": 4, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t2.b = 1" - } - } - } - } - } - } - ] - } -} -DROP VIEW v2; -DROP TABLE t1,t2; -# -# MDEV-11102: condition pushdown into materialized inner table -# of outer join is not applied as not being valid -# -CREATE TABLE t1 (a INT); -INSERT INTO t1 VALUES (0),(2); -CREATE TABLE t2 (b INT); -INSERT INTO t2 VALUES (1),(2); -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; -SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL; -a b -0 NULL -SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; -a b -0 NULL -EXPLAIN FORMAT=JSON -SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - }, - "table": { - "table_name": "", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["b"], - "ref": ["test.t1.a"], - "rows": 2, - "filtered": 100, - "attached_condition": "trigcond(v2.b is null) and trigcond(trigcond(t1.a is not null))", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - } - } - } - } - } -} -DROP VIEW v2; -DROP TABLE t1,t2; -# -# MDEV-11103: pushdown condition with ANY subquery -# -CREATE TABLE t1 (i INT); -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES (1),(2); -EXPLAIN FORMAT=JSON -SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "(v1.i <= 3)", - "materialized": { - "query_block": { - "select_id": 3, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "(t1.i <= 3)" - } - } - } - } - } -} -Warnings: -Note 1249 Select 2 was reduced during optimization -SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); -i -1 -2 -DROP VIEW v1; -DROP TABLE t1; -# -# MDEV-11315: condition with outer reference to mergeable derived -# -CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (10,7,1),(11,0,2); -CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM; -INSERT INTO t2 VALUES -(1,4,'2008-09-27 00:34:58'), -(2,5,'2007-05-28 00:00:00'), -(3,6,'2009-07-25 09:21:20'); -CREATE VIEW v1 AS SELECT * FROM t1; -CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; -SELECT * FROM v1 AS sq -WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; -pk1 a b -10 7 1 -11 0 2 -EXPLAIN FORMAT=JSON -SELECT * FROM v1 AS sq -WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "(t1.b,(subquery#2)) or t1.b = 100" - }, - "subqueries": [ - { - "query_block": { - "select_id": 2, - "table": { - "table_name": "", - "access_type": "index_subquery", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "4", - "used_key_parts": ["pk2"], - "ref": ["func"], - "rows": 2, - "filtered": 100, - "materialized": { - "query_block": { - "select_id": 4, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - ] - } -} -SELECT * FROM ( SELECT * FROM t1 ) AS sq -WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; -pk1 a b -10 7 1 -11 0 2 -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT * FROM t1 ) AS sq -WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "(t1.b,(subquery#3)) or t1.b = 100" - }, - "subqueries": [ - { - "query_block": { - "select_id": 3, - "table": { - "table_name": "", - "access_type": "index_subquery", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "4", - "used_key_parts": ["pk2"], - "ref": ["func"], - "rows": 2, - "filtered": 100, - "materialized": { - "query_block": { - "select_id": 4, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - ] - } -} -DROP VIEW v1,v2; -DROP TABLE t1,t2; -# -# MDEV-11313: pushdown of the condition obtained -# after constant row substitution -# -CREATE TABLE t1 (a INT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1),(2); -CREATE TABLE t2 (b INT) ENGINE=MyISAM; -INSERT INTO t2 VALUES (50); -CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; -f -0 -EXPLAIN FORMAT=JSON -SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t2", - "access_type": "system", - "rows": 1, - "filtered": 100 - }, - "subqueries": [ - { - "query_block": { - "select_id": 2, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v1.a = 50", - "materialized": { - "query_block": { - "select_id": 3, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.a = 50" - } - } - } - } - } - } - ] - } -} -CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM; -INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); -CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ; -SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; -f -3 -EXPLAIN FORMAT=JSON -SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t2", - "access_type": "system", - "rows": 1, - "filtered": 100 - }, - "subqueries": [ - { - "query_block": { - "select_id": 2, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "v2.s < 50", - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "s < 50", - "filesort": { - "sort_key": "t3.a", - "temporary_table": { - "table": { - "table_name": "t3", - "access_type": "ALL", - "rows": 5, - "filtered": 100 - } - } - } - } - } - } - } - } - ] - } -} -DROP VIEW v1,v2; -DROP TABLE t1,t2,t3; -# -# MDEV-10882: pushdown of the predicate with cached value -# -CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM; -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES (1,2),(3,4); -CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM; -INSERT INTO t2 VALUES (5),(6); -SELECT a, GROUP_CONCAT(b) FROM v1 -WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; -a GROUP_CONCAT(b) -1 2 -EXPLAIN FORMAT=JSON -SELECT a, GROUP_CONCAT(b) FROM v1 -WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 2, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "read_sorted_file": { - "filesort": { - "sort_key": "v1.a", - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v1.b = 2", - "materialized": { - "query_block": { - "select_id": 3, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.b = 2" - } - } - } - } - } - } - } -} -DROP VIEW v1; -DROP TABLE t1,t2; -# -# MDEV-10836: pushdown of the predicate with cached value -# -CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM; -CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; -INSERT INTO t VALUES (1,1),(3,2); -SELECT * FROM v AS v1, v AS v2 -WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); -pk f pk f -3 2 3 2 -EXPLAIN FORMAT=JSON -SELECT * FROM v AS v1, v AS v2 -WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 2, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v1.f = 2", - "materialized": { - "query_block": { - "select_id": 3, - "table": { - "table_name": "t", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t.f = 2" - } - } - } - }, - "block-nl-join": { - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v2.pk > 2" - }, - "buffer_type": "flat", - "buffer_size": "256Kb", - "join_type": "BNL", - "materialized": { - "query_block": { - "select_id": 4, - "table": { - "table_name": "t", - "access_type": "range", - "possible_keys": ["PRIMARY"], - "key": "PRIMARY", - "key_length": "4", - "used_key_parts": ["pk"], - "rows": 2, - "filtered": 100, - "index_condition": "t.pk > 2" - } - } - } - } - } -} -DROP VIEW v; -DROP TABLE t; -# -# MDEV-11488: pushdown of the predicate with cached value -# -CREATE TABLE t1 (i INT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1),(3),(2); -CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (3),(4); -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -i -3 -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 3, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "sq.i = 3", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.i = 3" - } - } - } - } - } -} -UPDATE t2 SET j = 2 WHERE j = 3; -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -i -2 -DROP TABLE t1,t2; -CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1.5),(3.2),(2.71); -CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (3.2),(2.71); -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -i -2.71 -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 3, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "sq.i = 2.7100000381469727", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.i = 2.7100000381469727" - } - } - } - } - } -} -DROP TABLE t1,t2; -CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1.5),(3.21),(2.47); -CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (3.21),(4.55); -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -i -3.21 -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 3, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "sq.i = 3.21", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.i = 3.21" - } - } - } - } - } -} -DROP TABLE t1,t2; -CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM; -INSERT INTO t1 VALUES ('cc'),('aa'),('ddd'); -CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES ('bbb'),('aa'); -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -i -aa -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 3, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "sq.i = 'aa'", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.i = 'aa'" - } - } - } - } - } -} -DROP TABLE t1,t2; -CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM; -INSERT INTO t1 VALUES -('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20'); -CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES -('2007-05-28 00:00:00'), ('2010-08-25 00:00:00'); -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -i -2007-05-28 00:00:00 -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 3, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "sq.i = '2007-05-28 00:00:00'", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.i = TIMESTAMP'2007-05-28 00:00:00'" - } - } - } - } - } -} -DROP TABLE t1,t2; -CREATE TABLE t1 (i DATE) ENGINE=MyISAM; -INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25'); -CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25'); -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -i -2007-05-28 -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 3, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "sq.i = '2007-05-28'", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.i = DATE'2007-05-28'" - } - } - } - } - } -} -DROP TABLE t1,t2; -CREATE TABLE t1 (i TIME) ENGINE=MyISAM; -INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20'); -CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10'); -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -i -10:00:02 -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq -WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 3, - "table": { - "message": "Select tables optimized away" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "sq.i = '10:00:02'", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.i = TIME'10:00:02'" - } - } - } - } - } -} -DROP TABLE t1,t2; -# -# MDEV-11593: pushdown of condition with NULLIF -# -CREATE TABLE t1 (i INT); -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES (2), (1); -SELECT * FROM v1 WHERE NULLIF(1, i); -i -2 -EXPLAIN FORMAT=JSON -SELECT * FROM v1 WHERE NULLIF(1, i); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "nullif(1,v1.i)", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "nullif(1,t1.i)" - } - } - } - } - } -} -DROP VIEW v1; -DROP TABLE t1; -# -# MDEV-11608: pushdown of the predicate with cached null value -# -CREATE TABLE t1 (c VARCHAR(3)); -CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES ('foo'),('bar'); -CREATE TABLE t2 (c VARCHAR(3)); -INSERT INTO t2 VALUES ('foo'),('xyz'); -SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); -c -EXPLAIN FORMAT=JSON -SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "system", - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 2, - "table": { - "message": "Impossible WHERE" - } - } - } - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v1.c = NULL", - "materialized": { - "query_block": { - "select_id": 3, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.c = NULL" - } - } - } - } - } -} -DROP VIEW v1; -DROP TABLE t1,t2; -CREATE TABLE t1 (d DECIMAL(10,2)); -CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES (5.37),(1.1); -CREATE TABLE t2 (d DECIMAL(10,2)); -INSERT INTO t2 VALUES ('1.1'),('2.23'); -SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 ); -d -DROP VIEW v1; -DROP TABLE t1,t2; -# -# MDEV-11820: second execution of PS for query -# with false subquery predicate in WHERE -# -CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM; -INSERT INTO t1 VALUES ('foo'),('bar'); -CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -CREATE TABLE t2 (a INT); -INSERT INTO t2 VALUES (3), (4); -PREPARE stmt1 FROM -" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; -PREPARE stmt2 FROM -"EXPLAIN FORMAT=JSON - SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; -EXECUTE stmt1; -c -foo -EXECUTE stmt2; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v1.c = 'foo'", - "materialized": { - "query_block": { - "select_id": 3, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.c = 'foo'" - } - } - } - }, - "subqueries": [ - { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "1 = t2.a" - } - } - } - ] - } -} -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -EXECUTE stmt1; -c -foo -EXECUTE stmt2; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "((1,(subquery#2))) or v1.c = 'foo'", - "materialized": { - "query_block": { - "select_id": 3, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - } - } - } - }, - "subqueries": [ - { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 128, - "filtered": 100, - "attached_condition": "1 = t2.a" - } - } - } - ] - } -} -DEALLOCATE PREPARE stmt1; -DEALLOCATE PREPARE stmt2; -DROP VIEW v1; -DROP TABLE t1,t2; -# -# MDEV-12373: pushdown into derived with side effects is prohibited -# -CREATE TABLE sales_documents ( -id int NOT NULL AUTO_INCREMENT, -sale_id int NULL DEFAULT NULL, -type tinyint unsigned NULL DEFAULT NULL, -data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci', -date date NULL DEFAULT NULL, -order_number int unsigned NULL DEFAULT NULL, -created_at int NULL DEFAULT NULL, -updated_at int NULL DEFAULT NULL, -generated tinyint NOT NULL DEFAULT '0', -synced_at int NOT NULL DEFAULT '0', -sum decimal(13,2) NOT NULL DEFAULT '0', -PRIMARY KEY (id) -); -INSERT INTO sales_documents -(id, sale_id, type, order_number, data, created_at, -updated_at, date, generated, synced_at, sum) -VALUES -(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00), -(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00), -(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00), -(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00), -(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00), -(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00), -(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00), -(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00), -(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00), -(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00), -(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00), -(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00), -(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00), -(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00), -(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00), -(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00), -(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00), -(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00), -(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00), -(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00), -(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00), -(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00), -(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00), -(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00), -(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00), -(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00), -(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00), -(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00), -(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00), -(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00), -(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00), -(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00), -(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00), -(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00), -(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00), -(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00), -(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00), -(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00), -(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00), -(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00), -(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00), -(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00), -(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00), -(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00), -(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00), -(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00), -(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00), -(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00), -(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00), -(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00), -(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00), -(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00), -(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00), -(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75), -(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00), -(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00), -(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00), -(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00), -(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00), -(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00); -SELECT * FROM -(SELECT @row := @row + 1 as row, a.* from ( -SELECT t.order_number -FROM sales_documents t -WHERE -t.type = 2 AND -t.date >= '2017-01-01' AND -t.date <= '2017-12-31' AND -t.order_number IS NOT NULL AND -t.generated = 1 -GROUP BY t.order_number -) a, (SELECT @row := 0) r) t -WHERE row <> order_number; -row order_number -14 51 -DROP TABLE sales_documents; -# -# MDEV-12845: pushdown from merged derived using equalities -# -create table t1 (a int); -insert into t1 values -(4), (8), (5), (3), (10), (2), (7); -create table t2 (b int, c int); -insert into t2 values -(2,1), (5,2), (2,2), (4,1), (4,3), -(5,3), (2,4), (4,6), (2,1); -create view v1 as -select b, sum(c) as s from t2 group by b; -create view v2 as -select distinct b, c from t2; -create view v3 as -select b, max(c) as m from t2 group by b; -select b -from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t -where b > 2; -b -4 -5 -explain format=json select b -from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t -where b > 2; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t1.a > 2 and t1.a is not null" - }, - "table": { - "table_name": "", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["b"], - "ref": ["test.t1.a"], - "rows": 2, - "filtered": 100, - "materialized": { - "query_block": { - "select_id": 3, - "filesort": { - "sort_key": "t2.b", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 9, - "filtered": 100, - "attached_condition": "t2.b > 2" - } - } - } - } - } - } - } -} -select a -from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t -where a > 2; -a -4 -5 -explain format=json select a -from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t -where a > 2; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t1.a > 2 and t1.a is not null" - }, - "table": { - "table_name": "", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["b"], - "ref": ["test.t1.a"], - "rows": 2, - "filtered": 100, - "materialized": { - "query_block": { - "select_id": 3, - "filesort": { - "sort_key": "t2.b", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 9, - "filtered": 100, - "attached_condition": "t2.b > 2" - } - } - } - } - } - } - } -} -select a -from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t -where a > 2; -a -4 -4 -4 -5 -5 -explain format=json select a -from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t -where a > 2; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t1.a > 2 and t1.a is not null" - }, - "table": { - "table_name": "", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["b"], - "ref": ["test.t1.a"], - "rows": 2, - "filtered": 100, - "materialized": { - "query_block": { - "select_id": 3, - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 9, - "filtered": 100, - "attached_condition": "t2.b > 2" - } - } - } - } - } - } -} -select a -from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t -where a > 2; -a -4 -3 -explain format=json select a -from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t -where a > 2; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t1.a > 2 and t1.a is not null" - }, - "table": { - "table_name": "", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "5", - "used_key_parts": ["m"], - "ref": ["test.t1.a"], - "rows": 2, - "filtered": 100, - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "m > 2", - "filesort": { - "sort_key": "t2.b", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 9, - "filtered": 100 - } - } - } - } - } - } - } -} -drop view v1,v2,v3; -drop table t1,t2; -# -# MDEV-13166: pushdown from merged derived -# -CREATE TABLE t1 (i int) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1),(2); -CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1; -SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; -f -2 -explain format=json SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v1.f > 0", - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "f > 0", - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - } - } - } - } - } -} -DROP VIEW v1; -DROP TABLE t1; -# -# MDEV-13193: pushdown of equality extracted from multiple equality -# -CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1),(2); -CREATE TABLE t2 (i2 int) ENGINE=MyISAM; -INSERT INTO t2 VALUES (2),(4); -CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; -SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq -WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); -i1 i2 -explain format=json SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq -WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ref", - "possible_keys": ["i1"], - "key": "i1", - "key_length": "5", - "used_key_parts": ["i1"], - "ref": ["const"], - "rows": 1, - "filtered": 100, - "using_index": true - }, - "block-nl-join": { - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "v2.i2 = 1" - }, - "buffer_type": "flat", - "buffer_size": "256Kb", - "join_type": "BNL", - "materialized": { - "query_block": { - "select_id": 3, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t2.i2 = 1" - } - } - } - } - } -} -DROP VIEW v2; -DROP TABLE t1,t2; -# -# MDEV-14237: derived with regexp_substr() in select list -# -create table t1 (a char(8)); -insert into t1 values ('b'), ('a'), ('xx'); -select * -from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t -where t.f = 'a' or t.f = 'b'; -f -b -a -explain format=json select * -from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t -where t.f = 'a' or t.f = 'b'; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t.f = 'a' or t.f = 'b'", - "materialized": { - "query_block": { - "select_id": 2, - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } -} -drop table t1; -# -# MDEV-13454: consequence of mdev-14368 fixed for 5.5 -# -SET sql_mode = 'ONLY_FULL_GROUP_BY'; -create table t1 (id int, id2 int); -insert into t1 values (1,1),(2,3),(3,4),(7,2); -create table t2(id2 int); -insert t2 values (1),(2),(3); -SELECT * FROM t1 -LEFT OUTER JOIN -(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) -WHERE (vc.ct>0); -id2 id ct -1 1 1 -3 2 1 -2 7 1 -EXPLAIN FORMAT=JSON SELECT * FROM t1 -LEFT OUTER JOIN -(SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) -WHERE (vc.ct>0); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "vc.ct > 0", - "materialized": { - "query_block": { - "select_id": 2, - "having_condition": "ct > 0", - "filesort": { - "sort_key": "t2.id2", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - }, - "block-nl-join": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 4, - "filtered": 100 - }, - "buffer_type": "flat", - "buffer_size": "256Kb", - "join_type": "BNL", - "attached_condition": "t1.id2 = vc.id2" - } - } -} -DROP TABLE t1,t2; -SET sql_mode = DEFAULT; -# -# MDEV-15579: incorrect removal of sub-formulas to be pushed -# into WHERE of materialized derived with GROUP BY -# -CREATE TABLE t1 (a INT, b INT, c INT, d INT); -CREATE TABLE t2 (x INT, y INT, z INT); -INSERT INTO t1 VALUES (1,1,66,1), (1,1,56,2), (3,2,42,3); -INSERT INTO t2 VALUES (1,1,66), (1,12,32); -SELECT * -FROM t2, -( -SELECT a, b, max(c) AS max_c -FROM t1 -GROUP BY a -HAVING max_c > 37 -) AS v1 -WHERE (v1.a=1) AND (v1.b=v1.a) AND -(v1.a=t2.x) AND (v1.max_c>30); -x y z a b max_c -1 1 66 1 1 66 -1 12 32 1 1 66 -EXPLAIN SELECT * -FROM t2, -( -SELECT a, b, max(c) AS max_c -FROM t1 -GROUP BY a -HAVING max_c > 37 -) AS v1 -WHERE (v1.a=1) AND (v1.b=v1.a) AND -(v1.a=t2.x) AND (v1.max_c>30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where -EXPLAIN FORMAT=JSON SELECT * -FROM t2, -( -SELECT a, b, max(c) AS max_c -FROM t1 -GROUP BY a -HAVING max_c > 37 -) AS v1 -WHERE (v1.a=1) AND (v1.b=v1.a) AND -(v1.a=t2.x) AND (v1.max_c>30); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t2.x = 1" - }, - "block-nl-join": { - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "v1.a = 1 and v1.b = 1 and v1.max_c > 30" - }, - "buffer_type": "flat", - "buffer_size": "256Kb", - "join_type": "BNL", - "materialized": { - "query_block": { - "select_id": 2, - "having_condition": "max_c > 37 and max_c > 30 and t1.b = 1", - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.a = 1" - } - } - } - } - } -} -SELECT * -FROM t2, -( -SELECT a, b, d, max(c) AS max_c -FROM t1 -GROUP BY a,d -HAVING max_c > 37 -) AS v1 -WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND -(v1.a=t2.x) AND (v1.max_c>30); -x y z a b d max_c -1 1 66 1 1 1 66 -1 12 32 1 1 1 66 -EXPLAIN SELECT * -FROM t2, -( -SELECT a, b, d, max(c) AS max_c -FROM t1 -GROUP BY a,d -HAVING max_c > 37 -) AS v1 -WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND -(v1.a=t2.x) AND (v1.max_c>30); -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 2 Using where -1 PRIMARY ALL NULL NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) -2 DERIVED t1 ALL NULL NULL NULL NULL 3 Using where -EXPLAIN FORMAT=JSON SELECT * -FROM t2, -( -SELECT a, b, d, max(c) AS max_c -FROM t1 -GROUP BY a,d -HAVING max_c > 37 -) AS v1 -WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND -(v1.a=t2.x) AND (v1.max_c>30); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t2.x = 1" - }, - "block-nl-join": { - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "v1.a = 1 and v1.b = 1 and v1.d = 1 and v1.max_c > 30" - }, - "buffer_type": "flat", - "buffer_size": "256Kb", - "join_type": "BNL", - "materialized": { - "query_block": { - "select_id": 2, - "having_condition": "max_c > 37 and max_c > 30 and t1.b = 1", - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "t1.a = 1 and t1.d = 1" - } - } - } - } - } -} -DROP TABLE t1,t2; -# -# MDEV-15765: pushing condition with temporal constants -# into constant tables -# -select * from (select date('2018-01-01') as d -union all -select date('2018-01-01') as d) as t -where t.d between date ('2017-01-01') and date ('2019-01-01'); -d -2018-01-01 -2018-01-01 -select * from (select date('2018-01-01') as d) as t -where t.d between date ('2017-01-01') and date ('2019-01-01'); -d -2018-01-01 -# -# MDEV-16088: pushdown into derived defined in the IN subquery -# -CREATE TABLE t1 (a INT, b INT); -CREATE TABLE t2 (e INT, f INT, g INT); -INSERT INTO t1 VALUES (1,14),(2,13),(1,19),(2,32),(3,24); -INSERT INTO t2 VALUES (1,19,2),(3,24,1),(1,12,2),(3,11,3),(2,32,1); -SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e,d_tab.max_f -FROM ( -SELECT t2.e, MAX(t2.f) AS max_f -FROM t2 -GROUP BY t2.e -HAVING max_f>18 -) as d_tab -WHERE d_tab.e>1 -) -; -a b -2 32 -3 24 -EXPLAIN SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e,d_tab.max_f -FROM ( -SELECT t2.e, MAX(t2.f) AS max_f -FROM t2 -GROUP BY t2.e -HAVING max_f>18 -) as d_tab -WHERE d_tab.e>1 -) -; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 -1 PRIMARY eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED ALL NULL NULL NULL NULL 5 Using where -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort -EXPLAIN FORMAT=JSON SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e,d_tab.max_f -FROM ( -SELECT t2.e, MAX(t2.f) AS max_f -FROM t2 -GROUP BY t2.e -HAVING max_f>18 -) as d_tab -WHERE d_tab.e>1 -) -; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 5, - "filtered": 100 - }, - "table": { - "table_name": "", - "access_type": "eq_ref", - "possible_keys": ["distinct_key"], - "key": "distinct_key", - "key_length": "8", - "used_key_parts": ["e", "max_f"], - "ref": ["func", "func"], - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 2, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "d_tab.e > 1", - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "max_f > 18", - "filesort": { - "sort_key": "t2.e", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "t2.e > 1" - } - } - } - } - } - } - } - } - } - } -} -SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e,d_tab.max_f -FROM ( -SELECT t2.e, MAX(t2.f) AS max_f -FROM t2 -GROUP BY t2.e -HAVING max_f>18 -) as d_tab -WHERE d_tab.max_f<25 -) -; -a b -1 19 -3 24 -EXPLAIN SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e,d_tab.max_f -FROM ( -SELECT t2.e, MAX(t2.f) AS max_f -FROM t2 -GROUP BY t2.e -HAVING max_f>18 -) as d_tab -WHERE d_tab.max_f<25 -) -; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 -1 PRIMARY eq_ref distinct_key distinct_key 8 func,func 1 -2 MATERIALIZED ALL NULL NULL NULL NULL 5 Using where -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort -EXPLAIN FORMAT=JSON SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e,d_tab.max_f -FROM ( -SELECT t2.e, MAX(t2.f) AS max_f -FROM t2 -GROUP BY t2.e -HAVING max_f>18 -) as d_tab -WHERE d_tab.max_f<25 -) -; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 5, - "filtered": 100 - }, - "table": { - "table_name": "", - "access_type": "eq_ref", - "possible_keys": ["distinct_key"], - "key": "distinct_key", - "key_length": "8", - "used_key_parts": ["e", "max_f"], - "ref": ["func", "func"], - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 2, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "d_tab.max_f < 25", - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "max_f > 18 and max_f < 25", - "filesort": { - "sort_key": "t2.e", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 5, - "filtered": 100 - } - } - } - } - } - } - } - } - } - } -} -SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e, MAX(d_tab.max_f) AS max_f -FROM ( -SELECT t2.e, MAX(t2.f) as max_f, t2.g -FROM t2 -GROUP BY t2.e -) as d_tab -WHERE d_tab.e>1 -GROUP BY d_tab.g -) -; -a b -2 32 -EXPLAIN SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e, MAX(d_tab.max_f) AS max_f -FROM ( -SELECT t2.e, MAX(t2.f) as max_f, t2.g -FROM t2 -GROUP BY t2.e -) as d_tab -WHERE d_tab.e>1 -GROUP BY d_tab.g -) -; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 -2 MATERIALIZED ALL NULL NULL NULL NULL 5 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using where; Using temporary; Using filesort -EXPLAIN FORMAT=JSON SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e, MAX(d_tab.max_f) AS max_f -FROM ( -SELECT t2.e, MAX(t2.f) as max_f, t2.g -FROM t2 -GROUP BY t2.e -) as d_tab -WHERE d_tab.e>1 -GROUP BY d_tab.g -) -; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "t1.a is not null and t1.b is not null" - }, - "table": { - "table_name": "", - "access_type": "eq_ref", - "possible_keys": ["distinct_key"], - "key": "distinct_key", - "key_length": "8", - "used_key_parts": ["e", "max_f"], - "ref": ["test.t1.a", "test.t1.b"], - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 2, - "temporary_table": { - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "d_tab.e > 1", - "materialized": { - "query_block": { - "select_id": 3, - "filesort": { - "sort_key": "t2.e", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "t2.e > 1" - } - } - } - } - } - } - } - } - } - } - } -} -SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e, MAX(d_tab.max_f) AS max_f -FROM ( -SELECT t2.e, MAX(t2.f) as max_f, t2.g -FROM t2 -GROUP BY t2.e -) as d_tab -WHERE d_tab.max_f>20 -GROUP BY d_tab.g -) -; -a b -2 32 -EXPLAIN SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e, MAX(d_tab.max_f) AS max_f -FROM ( -SELECT t2.e, MAX(t2.f) as max_f, t2.g -FROM t2 -GROUP BY t2.e -) as d_tab -WHERE d_tab.max_f>20 -GROUP BY d_tab.g -) -; -id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 5 Using where -1 PRIMARY eq_ref distinct_key distinct_key 8 test.t1.a,test.t1.b 1 -2 MATERIALIZED ALL NULL NULL NULL NULL 5 Using where; Using temporary -3 DERIVED t2 ALL NULL NULL NULL NULL 5 Using temporary; Using filesort -EXPLAIN FORMAT=JSON SELECT * FROM t1 -WHERE (t1.a,t1.b) IN -( -SELECT d_tab.e, MAX(d_tab.max_f) AS max_f -FROM ( -SELECT t2.e, MAX(t2.f) as max_f, t2.g -FROM t2 -GROUP BY t2.e -) as d_tab -WHERE d_tab.max_f>20 -GROUP BY d_tab.g -) -; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "t1.a is not null and t1.b is not null" - }, - "table": { - "table_name": "", - "access_type": "eq_ref", - "possible_keys": ["distinct_key"], - "key": "distinct_key", - "key_length": "8", - "used_key_parts": ["e", "max_f"], - "ref": ["test.t1.a", "test.t1.b"], - "rows": 1, - "filtered": 100, - "materialized": { - "unique": 1, - "query_block": { - "select_id": 2, - "temporary_table": { - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "d_tab.max_f > 20", - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "max_f > 20", - "filesort": { - "sort_key": "t2.e", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 5, - "filtered": 100 - } - } - } - } - } - } - } - } - } - } - } -} -DROP TABLE t1,t2; -# -# MDEV-15765: pushing condition with IN subquery defined with constants -# using substitution -# -CREATE TABLE t1 (a INT); -INSERT INTO t1 VALUES (1),(2); -SELECT * FROM -( -SELECT DISTINCT * FROM t1 -) der_tab -WHERE (a>0 AND a<2 OR a IN (2,3)) AND -(a=2 OR 0); -a -2 -DROP TABLE t1; -# -# MDEV-16386: pushing condition into the HAVING clause when ambiguous -# fields warning appears -# -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 VALUES (1,2),(2,3),(3,4); -SELECT * FROM -( -SELECT t1.b AS a -FROM t1 -GROUP BY t1.a -) dt -WHERE (dt.a=2); -a -2 -EXPLAIN FORMAT=JSON SELECT * FROM -( -SELECT t1.b AS a -FROM t1 -GROUP BY t1.a -) dt -WHERE (dt.a=2); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "dt.a = 2", - "materialized": { - "query_block": { - "select_id": 2, - "having_condition": "a = 2", - "filesort": { - "sort_key": "t1.a", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - } -} -SELECT * FROM -( -SELECT t1.b AS a -FROM t1 -GROUP BY t1.a -HAVING (t1.a<3) -) dt -WHERE (dt.a>1); -a -2 -3 -EXPLAIN FORMAT=JSON SELECT * FROM -( -SELECT t1.b AS a -FROM t1 -GROUP BY t1.a -HAVING (t1.a<3) -) dt -WHERE (dt.a>1); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "dt.a > 1", - "materialized": { - "query_block": { - "select_id": 2, - "having_condition": "t1.a < 3 and a > 1", - "filesort": { - "sort_key": "t1.a", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - } -} -SELECT * FROM -( -SELECT 'ab' AS a -FROM t1 -GROUP BY t1.a -) dt -WHERE (dt.a='ab'); -a -ab -ab -ab -EXPLAIN FORMAT=JSON SELECT * FROM -( -SELECT 'ab' AS a -FROM t1 -GROUP BY t1.a -) dt -WHERE (dt.a='ab'); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "dt.a = 'ab'", - "materialized": { - "query_block": { - "select_id": 2, - "filesort": { - "sort_key": "t1.a", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - } -} -SELECT * FROM -( -SELECT 1 AS a -FROM t1 -GROUP BY t1.a -) dt -WHERE (dt.a=1); -a -1 -1 -1 -EXPLAIN FORMAT=JSON SELECT * FROM -( -SELECT 1 AS a -FROM t1 -GROUP BY t1.a -) dt -WHERE (dt.a=1); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "dt.a = 1", - "materialized": { - "query_block": { - "select_id": 2, - "filesort": { - "sort_key": "t1.a", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - } -} -DROP TABLE t1; -# -# MDEV-16517: pushdown condition with the IN predicate defined -# with non-constant values -# -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 VALUES (1,2),(1,3); -SELECT * FROM -( -SELECT t1.a -FROM t1 -WHERE 1 IN (0,t1.a) -GROUP BY t1.a -) AS dt1 -JOIN -( -SELECT t1.a -FROM t1 -WHERE 1 IN (0,t1.a) -) AS dt2 -ON dt1.a = dt2.a; -a a -1 1 -1 1 -EXPLAIN FORMAT=JSON SELECT * FROM -( -SELECT t1.a -FROM t1 -WHERE 1 IN (0,t1.a) -GROUP BY t1.a -) AS dt1 -JOIN -( -SELECT t1.a -FROM t1 -WHERE 1 IN (0,t1.a) -) AS dt2 -ON dt1.a = dt2.a; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "1 in (0,dt1.a)", - "materialized": { - "query_block": { - "select_id": 2, - "filesort": { - "sort_key": "t1.a", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "1 in (0,t1.a) and 1 in (0,t1.a)" - } - } - } - } - } - }, - "block-nl-join": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - }, - "buffer_type": "flat", - "buffer_size": "256Kb", - "join_type": "BNL", - "attached_condition": "t1.a = dt1.a" - } - } -} -SELECT * FROM -( -SELECT t1.a,MAX(t1.b) -FROM t1 -GROUP BY t1.a -) AS dt, t1 -WHERE dt.a=t1.a AND dt.a IN (1,t1.a); -a MAX(t1.b) a b -1 3 1 2 -1 3 1 3 -EXPLAIN FORMAT=JSON SELECT * FROM -( -SELECT t1.a,MAX(t1.b) -FROM t1 -GROUP BY t1.a -) AS dt, t1 -WHERE dt.a=t1.a AND dt.a IN (1,t1.a); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "dt.a in (1,dt.a)", - "materialized": { - "query_block": { - "select_id": 2, - "filesort": { - "sort_key": "t1.a", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100, - "attached_condition": "t1.a in (1,t1.a)" - } - } - } - } - } - }, - "block-nl-join": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 2, - "filtered": 100 - }, - "buffer_type": "flat", - "buffer_size": "256Kb", - "join_type": "BNL", - "attached_condition": "t1.a = dt.a" - } - } -} -DROP TABLE t1; -# -# MDEV-10855: Pushdown into derived with window functions +# MDEV-10855: Pushdown into derived with window functions # set @save_optimizer_switch= @@optimizer_switch; set optimizer_switch='split_materialized=off'; @@ -13558,27 +14231,27 @@ insert into t2 values set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c, sum(b) over (partition by a,c) from t2) as t where t.a > 2 and t.c in ('aa','bb','cc'); a c sum(b) over (partition by a,c) -7 cc 28 -7 cc 28 3 aa 92 -7 bb 126 +3 aa 92 +3 bb 40 4 aa 15 7 bb 126 7 bb 126 -3 bb 40 -3 aa 92 +7 bb 126 +7 cc 28 +7 cc 28 select * from (select a, c, sum(b) over (partition by a,c) from t2) as t where t.a > 2 and t.c in ('aa','bb','cc'); a c sum(b) over (partition by a,c) -7 cc 28 -7 cc 28 3 aa 92 -7 bb 126 +3 aa 92 +3 bb 40 4 aa 15 7 bb 126 7 bb 126 -3 bb 40 -3 aa 92 +7 bb 126 +7 cc 28 +7 cc 28 explain select * from (select a, c, sum(b) over (partition by a,c) from t2) as t where t.a > 2 and t.c in ('aa','bb','cc'); id select_type table type possible_keys key key_len ref rows Extra @@ -13622,59 +14295,59 @@ EXPLAIN } } set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); n a c s -1 7 cc 28 -1 7 cc 28 1 3 aa 92 -1 7 bb 126 +1 3 aa 92 +1 3 bb 40 1 4 aa 15 1 7 bb 126 1 7 bb 126 -1 3 bb 40 -1 3 aa 92 -2 7 cc 154 -2 7 cc 154 +1 7 bb 126 +1 7 cc 28 +1 7 cc 28 2 3 aa 132 -2 7 bb 154 +2 3 aa 132 +2 3 bb 132 2 4 aa 139 2 7 bb 154 2 7 bb 154 -2 3 bb 132 -2 3 aa 132 +2 7 bb 154 +2 7 cc 154 +2 7 cc 154 select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); n a c s -1 7 cc 28 -1 7 cc 28 1 3 aa 92 -1 7 bb 126 +1 3 aa 92 +1 3 bb 40 1 4 aa 15 1 7 bb 126 1 7 bb 126 -1 3 bb 40 -1 3 aa 92 -2 7 cc 154 -2 7 cc 154 +1 7 bb 126 +1 7 cc 28 +1 7 cc 28 2 3 aa 132 -2 7 bb 154 +2 3 aa 132 +2 3 bb 132 2 4 aa 139 2 7 bb 154 2 7 bb 154 -2 3 bb 132 -2 3 aa 132 +2 7 bb 154 +2 7 cc 154 +2 7 cc 154 explain select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 @@ -13685,7 +14358,7 @@ id select_type table type possible_keys key key_len ref rows Extra 2 DERIVED t2 ALL idx NULL NULL NULL 20 Using where; Using temporary 3 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary explain format=json select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 @@ -13759,7 +14432,7 @@ EXPLAIN } } } -set statement optimizer_switch='condition_pushdown_for_derived=off' for select * +set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); a c s a c @@ -13767,7 +14440,7 @@ a c s a c 7 bb 126 7 bb 7 bb 126 7 bb 7 bb 126 7 bb -select * +select * from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); a c s a c @@ -13775,14 +14448,14 @@ a c s a c 7 bb 126 7 bb 7 bb 126 7 bb 7 bb 126 7 bb -explain select * +explain select * from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 8 Using where 1 PRIMARY ref key0 key0 24 test.t1.a,test.t1.c 2 2 DERIVED t2 ALL NULL NULL NULL NULL 20 Using where; Using temporary -explain format=json select * +explain format=json select * from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); EXPLAIN @@ -13831,7 +14504,7 @@ EXPLAIN } } set statement optimizer_switch='condition_pushdown_for_derived=off' for select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 @@ -13840,28 +14513,28 @@ select 3 as n, a, c, sum(b) as s from t2 group by a ) as t where t.a > 2 and t.c in ('aa','bb','cc'); n a c s -1 7 cc 28 -1 7 cc 28 1 3 aa 92 -1 7 bb 126 +1 3 aa 92 +1 3 bb 40 1 4 aa 15 1 7 bb 126 1 7 bb 126 -1 3 bb 40 -1 3 aa 92 -2 7 cc 154 -2 7 cc 154 +1 7 bb 126 +1 7 cc 28 +1 7 cc 28 2 3 aa 132 -2 7 bb 154 +2 3 aa 132 +2 3 bb 132 2 4 aa 139 2 7 bb 154 2 7 bb 154 -2 3 bb 132 -2 3 aa 132 +2 7 bb 154 +2 7 cc 154 +2 7 cc 154 3 3 aa 132 3 7 cc 154 select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 @@ -13870,28 +14543,28 @@ select 3 as n, a, c, sum(b) as s from t2 group by a ) as t where t.a > 2 and t.c in ('aa','bb','cc'); n a c s -1 7 cc 28 -1 7 cc 28 1 3 aa 92 -1 7 bb 126 +1 3 aa 92 +1 3 bb 40 1 4 aa 15 1 7 bb 126 1 7 bb 126 -1 3 bb 40 -1 3 aa 92 -2 7 cc 154 -2 7 cc 154 +1 7 bb 126 +1 7 cc 28 +1 7 cc 28 2 3 aa 132 -2 7 bb 154 +2 3 aa 132 +2 3 bb 132 2 4 aa 139 2 7 bb 154 2 7 bb 154 -2 3 bb 132 -2 3 aa 132 +2 7 bb 154 +2 7 cc 154 +2 7 cc 154 3 3 aa 132 3 7 cc 154 explain select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 @@ -13905,7 +14578,7 @@ id select_type table type possible_keys key key_len ref rows Extra 3 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary 4 UNION t2 ALL idx NULL NULL NULL 20 Using where; Using temporary; Using filesort explain format=json select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 @@ -14007,30 +14680,30 @@ avg(b) over (partition by a,c) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); a c sum_b avg_b -7 cc 28 14.0000 -7 cc 28 14.0000 3 aa 92 46.0000 -7 bb 126 42.0000 +3 aa 92 46.0000 +3 bb 40 40.0000 4 aa 15 15.0000 7 bb 126 42.0000 7 bb 126 42.0000 -3 bb 40 40.0000 -3 aa 92 46.0000 +7 bb 126 42.0000 +7 cc 28 14.0000 +7 cc 28 14.0000 select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by a,c) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); a c sum_b avg_b -7 cc 28 14.0000 -7 cc 28 14.0000 3 aa 92 46.0000 -7 bb 126 42.0000 +3 aa 92 46.0000 +3 bb 40 40.0000 4 aa 15 15.0000 7 bb 126 42.0000 7 bb 126 42.0000 -3 bb 40 40.0000 -3 aa 92 46.0000 +7 bb 126 42.0000 +7 cc 28 14.0000 +7 cc 28 14.0000 explain select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by a,c) as avg_b @@ -14085,30 +14758,30 @@ avg(b) over (partition by a) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); a c sum_b avg_b -7 cc 28 30.8000 -7 cc 28 30.8000 3 aa 92 44.0000 -7 bb 126 30.8000 +3 aa 92 44.0000 +3 bb 40 44.0000 4 aa 15 46.3333 7 bb 126 30.8000 7 bb 126 30.8000 -3 bb 40 44.0000 -3 aa 92 44.0000 +7 bb 126 30.8000 +7 cc 28 30.8000 +7 cc 28 30.8000 select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by a) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); a c sum_b avg_b -7 cc 28 30.8000 -7 cc 28 30.8000 3 aa 92 44.0000 -7 bb 126 30.8000 +3 aa 92 44.0000 +3 bb 40 44.0000 4 aa 15 46.3333 7 bb 126 30.8000 7 bb 126 30.8000 -3 bb 40 44.0000 -3 aa 92 44.0000 +7 bb 126 30.8000 +7 cc 28 30.8000 +7 cc 28 30.8000 explain select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by a) as avg_b @@ -14163,30 +14836,30 @@ avg(b) over (partition by c) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); a c sum_b avg_b -7 cc 28 14.0000 -7 cc 28 14.0000 3 aa 92 35.4000 -7 bb 126 36.5000 +3 aa 92 35.4000 +3 bb 40 36.5000 4 aa 15 35.4000 7 bb 126 36.5000 7 bb 126 36.5000 -3 bb 40 36.5000 -3 aa 92 35.4000 +7 bb 126 36.5000 +7 cc 28 14.0000 +7 cc 28 14.0000 select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by c) as avg_b from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); a c sum_b avg_b -7 cc 28 14.0000 -7 cc 28 14.0000 3 aa 92 35.4000 -7 bb 126 36.5000 +3 aa 92 35.4000 +3 bb 40 36.5000 4 aa 15 35.4000 7 bb 126 36.5000 7 bb 126 36.5000 -3 bb 40 36.5000 -3 aa 92 35.4000 +7 bb 126 36.5000 +7 cc 28 14.0000 +7 cc 28 14.0000 explain select * from (select a, c, sum(b) over (partition by a,c) as sum_b, avg(b) over (partition by c) as avg_b @@ -14240,7 +14913,7 @@ EXPLAIN drop table t1,t2; set optimizer_switch= @save_optimizer_switch; # -# MDEV-13369: Optimization for equi-joins of grouping derived tables +# MDEV-13369: Optimization for equi-joins of grouping derived tables # (Splitting derived tables / views with GROUP BY) # MDEV-13389: Optimization for equi-joins of derived tables with WF # (Splitting derived tables / views with window functions) @@ -14263,7 +14936,9 @@ insert into t2 values insert into t2 select a+10, b+10, concat(c,'f') from t2; analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK set statement optimizer_switch='split_materialized=off' for select t1.a,t.s,t.m from t1 join @@ -14293,7 +14968,7 @@ where t1.b < 3; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 range idx_b idx_b 5 NULL 4 100.00 Using index condition; Using where 1 PRIMARY ref key0 key0 5 test.t1.a 2 100.00 -2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 2 100.00 +2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`c`) AS `m` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` < 3 explain format=json select t1.a,t.s,t.m @@ -14339,7 +15014,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["a"], "ref": ["test.t1.a"], - "rows": 2, + "rows": 1, "filtered": 100 } } @@ -14402,10 +15077,10 @@ on t1.a=t.a where t1.b <= 5; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL idx_b NULL NULL NULL 12 75.00 Using where -1 PRIMARY ref key0 key0 5 test.t1.a 9 100.00 -2 DERIVED t2 ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort +1 PRIMARY ref key0 key0 5 test.t1.a 2 100.00 +2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 1 100.00 Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`b`) AS `m` from `test`.`t2` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <= 5 +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`s` AS `s`,`t`.`m` AS `m` from `test`.`t1` join (/* select#2 */ select `test`.`t2`.`a` AS `a`,sum(`test`.`t2`.`b`) AS `s`,min(`test`.`t2`.`b`) AS `m` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` where `t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`b` <= 5 explain format=json select t1.a,t.s,t.m from t1 join (select a, sum(t2.b) as s, min(t2.b) as m from t2 group by t2.a) t @@ -14431,22 +15106,22 @@ EXPLAIN "key_length": "5", "used_key_parts": ["a"], "ref": ["test.t1.a"], - "rows": 9, + "rows": 2, "filtered": 100, "materialized": { "query_block": { "select_id": 2, - "filesort": { - "sort_key": "t2.a", - "temporary_table": { - "table": { - "table_name": "t2", - "access_type": "ALL", - "possible_keys": ["idx_a"], - "rows": 90, - "filtered": 100 - } - } + "outer_ref_condition": "t1.a is not null", + "table": { + "table_name": "t2", + "access_type": "ref", + "possible_keys": ["idx_a"], + "key": "idx_a", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t1.a"], + "rows": 1, + "filtered": 100 } } } @@ -14505,11 +15180,11 @@ from t1 left join (select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t on t1.a=t.a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t1 ALL NULL NULL NULL NULL 4 100.00 -1 PRIMARY ref key0 key0 5 test.t1.a 2 100.00 Using where -2 LATERAL DERIVED t2 ref idx_a idx_a 5 test.t1.a 2 100.00 +1 PRIMARY t1 ALL NULL NULL NULL NULL 12 100.00 +1 PRIMARY ref key0 key0 5 test.t1.a 9 100.00 Using where +2 DERIVED t2 ALL idx_a NULL NULL NULL 90 100.00 Using temporary; Using filesort Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t1` left join (/* select#2 */ select `test`.`t2`.`a` AS `a`,max(`test`.`t2`.`b`) AS `max`,min(`test`.`t2`.`b`) AS `min` from `test`.`t2` where `test`.`t2`.`a` = `test`.`t1`.`a` group by `test`.`t2`.`a`) `t` on(`t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where 1 +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t1` left join (/* select#2 */ select `test`.`t2`.`a` AS `a`,max(`test`.`t2`.`b`) AS `max`,min(`test`.`t2`.`b`) AS `min` from `test`.`t2` group by `test`.`t2`.`a`) `t` on(`t`.`a` = `test`.`t1`.`a` and `test`.`t1`.`a` is not null) where 1 explain format=json select t1.a,t.max,t.min from t1 left join (select a, max(t2.b) max, min(t2.b) min from t2 group by t2.a) t @@ -14522,7 +15197,7 @@ EXPLAIN "table": { "table_name": "t1", "access_type": "ALL", - "rows": 4, + "rows": 12, "filtered": 100 }, "table": { @@ -14533,23 +15208,23 @@ EXPLAIN "key_length": "5", "used_key_parts": ["a"], "ref": ["test.t1.a"], - "rows": 2, + "rows": 9, "filtered": 100, "attached_condition": "trigcond(trigcond(t1.a is not null))", "materialized": { "query_block": { "select_id": 2, - "outer_ref_condition": "t1.a is not null", - "table": { - "table_name": "t2", - "access_type": "ref", - "possible_keys": ["idx_a"], - "key": "idx_a", - "key_length": "5", - "used_key_parts": ["a"], - "ref": ["test.t1.a"], - "rows": 2, - "filtered": 100 + "filesort": { + "sort_key": "t2.a", + "temporary_table": { + "table": { + "table_name": "t2", + "access_type": "ALL", + "possible_keys": ["idx_a"], + "rows": 90, + "filtered": 100 + } + } } } } @@ -14570,7 +15245,9 @@ insert into t4 values insert into t4 select a+10, b+10, concat(c,'f') from t4; analyze table t3,t4; Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK +test.t4 analyze status Engine-independent statistics collected test.t4 analyze status OK set statement optimizer_switch='split_materialized=off' for select t3.a,t3.c,t.max,t.min from t3 join @@ -14886,31 +15563,34 @@ insert into t4 select a+100, b+100, concat(c,'g') from t4; insert into t4 select a+1000, b+1000, concat(c,'h') from t4; analyze table t2,t3,t4; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK +test.t4 analyze status Engine-independent statistics collected test.t4 analyze status OK set statement optimizer_switch='split_materialized=off' for select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; a b c t_c max min -7 82 y cc 18 10 7 82 y aa 82 15 7 82 y bb 40 23 +7 82 y cc 18 10 select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; a b c t_c max min -7 82 y cc 18 10 7 82 y aa 82 15 7 82 y bb 40 23 +7 82 y cc 18 10 explain extended select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 range idx idx 133 NULL 2 100.00 Using index condition; Using where -1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where +1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where 1 PRIMARY ref key0 key0 128 test.t3.c 2 100.00 -2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 3 100.00 +2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 2 100.00 Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`t`.`c` AS `t_c`,`t`.`max` AS `max`,`t`.`min` AS `min` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,max(`test`.`t4`.`b`) AS `max`,min(`test`.`t4`.`b`) AS `min` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c` group by `test`.`t4`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` between 80 and 85 and `test`.`t2`.`c` in ('y','z') explain format=json select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min @@ -14940,7 +15620,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["a"], "ref": ["test.t2.a"], - "rows": 2, + "rows": 1, "filtered": 100, "attached_condition": "t3.c is not null" }, @@ -14966,7 +15646,7 @@ EXPLAIN "key_length": "128", "used_key_parts": ["c"], "ref": ["test.t3.c"], - "rows": 3, + "rows": 2, "filtered": 100 } } @@ -15054,8 +15734,8 @@ explain extended select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 90 100.00 Using where -1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 90 33.33 Using where +1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where 1 PRIMARY ref key0 key0 128 test.t3.c 10 100.00 2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary; Using filesort Warnings: @@ -15071,7 +15751,7 @@ EXPLAIN "table_name": "t2", "access_type": "ALL", "rows": 90, - "filtered": 100, + "filtered": 33.333, "attached_condition": "t2.b < 40 and t2.a is not null" }, "table": { @@ -15082,7 +15762,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["a"], "ref": ["test.t2.a"], - "rows": 2, + "rows": 1, "filtered": 100, "attached_condition": "t3.c is not null" }, @@ -15120,44 +15800,44 @@ set statement optimizer_switch='split_materialized=off' for select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; a b c a b c c b sum(b) over (partition by c) +7 82 y 7 10 bb bb 23 125 +7 82 y 7 10 bb bb 30 125 +7 82 y 7 10 bb bb 32 125 +7 82 y 7 10 bb bb 40 125 +7 82 y 7 17 cc cc 10 40 7 82 y 7 17 cc cc 12 40 7 82 y 7 17 cc cc 18 40 -7 82 y 7 17 cc cc 10 40 -7 82 y 7 18 aa aa 77 259 -7 82 y 7 18 aa aa 50 259 7 82 y 7 18 aa aa 15 259 -7 82 y 7 18 aa aa 82 259 7 82 y 7 18 aa aa 15 259 7 82 y 7 18 aa aa 20 259 -7 82 y 7 10 bb bb 40 125 -7 82 y 7 10 bb bb 32 125 -7 82 y 7 10 bb bb 30 125 -7 82 y 7 10 bb bb 23 125 +7 82 y 7 18 aa aa 50 259 +7 82 y 7 18 aa aa 77 259 +7 82 y 7 18 aa aa 82 259 select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; a b c a b c c b sum(b) over (partition by c) +7 82 y 7 10 bb bb 23 125 +7 82 y 7 10 bb bb 30 125 +7 82 y 7 10 bb bb 32 125 +7 82 y 7 10 bb bb 40 125 +7 82 y 7 17 cc cc 10 40 7 82 y 7 17 cc cc 12 40 7 82 y 7 17 cc cc 18 40 -7 82 y 7 17 cc cc 10 40 -7 82 y 7 18 aa aa 77 259 -7 82 y 7 18 aa aa 50 259 7 82 y 7 18 aa aa 15 259 -7 82 y 7 18 aa aa 82 259 7 82 y 7 18 aa aa 15 259 7 82 y 7 18 aa aa 20 259 -7 82 y 7 10 bb bb 40 125 -7 82 y 7 10 bb bb 32 125 -7 82 y 7 10 bb bb 30 125 -7 82 y 7 10 bb bb 23 125 +7 82 y 7 18 aa aa 50 259 +7 82 y 7 18 aa aa 77 259 +7 82 y 7 18 aa aa 82 259 explain extended select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 range idx idx 133 NULL 2 100.00 Using index condition; Using where -1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where +1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where 1 PRIMARY ref key0 key0 128 test.t3.c 2 100.00 -2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 3 100.00 Using temporary +2 LATERAL DERIVED t4 ref idx_c idx_c 128 test.t3.c 2 100.00 Using temporary Warnings: Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t3`.`c` AS `c`,`t`.`c` AS `c`,`t`.`b` AS `b`,`t`.`sum(b) over (partition by c)` AS `sum(b) over (partition by c)` from `test`.`t2` join `test`.`t3` join (/* select#2 */ select `test`.`t4`.`c` AS `c`,`test`.`t4`.`b` AS `b`,sum(`test`.`t4`.`b`) over ( partition by `test`.`t4`.`c`) AS `sum(b) over (partition by c)` from `test`.`t4` where `test`.`t4`.`c` = `test`.`t3`.`c`) `t` where `test`.`t3`.`a` = `test`.`t2`.`a` and `t`.`c` = `test`.`t3`.`c` and `test`.`t2`.`b` between 80 and 85 and `test`.`t2`.`c` in ('y','z') explain format=json select * @@ -15187,7 +15867,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["a"], "ref": ["test.t2.a"], - "rows": 2, + "rows": 1, "filtered": 100, "attached_condition": "t3.c is not null" }, @@ -15220,7 +15900,7 @@ EXPLAIN "key_length": "128", "used_key_parts": ["c"], "ref": ["test.t3.c"], - "rows": 3, + "rows": 2, "filtered": 100 } } @@ -15234,324 +15914,324 @@ set statement optimizer_switch='split_materialized=off' for select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; a b c a b c c b sum(b) over (partition by c) -7 10 x 7 17 cc cc 12 40 -7 10 x 7 17 cc cc 18 40 -7 10 x 7 17 cc cc 10 40 -7 10 x 7 18 aa aa 77 259 -7 10 x 7 18 aa aa 50 259 -7 10 x 7 18 aa aa 15 259 -7 10 x 7 18 aa aa 82 259 -7 10 x 7 18 aa aa 15 259 -7 10 x 7 18 aa aa 20 259 -7 10 x 7 10 bb bb 40 125 -7 10 x 7 10 bb bb 32 125 -7 10 x 7 10 bb bb 30 125 -7 10 x 7 10 bb bb 23 125 -1 20 a 1 14 bb bb 40 125 -1 20 a 1 14 bb bb 32 125 -1 20 a 1 14 bb bb 30 125 1 20 a 1 14 bb bb 23 125 -2 23 b 2 12 aa aa 77 259 -2 23 b 2 12 aa aa 50 259 -2 23 b 2 12 aa aa 15 259 -2 23 b 2 12 aa aa 82 259 -2 23 b 2 12 aa aa 15 259 -2 23 b 2 12 aa aa 20 259 -2 23 b 2 11 aa aa 77 259 -2 23 b 2 11 aa aa 50 259 -2 23 b 2 11 aa aa 15 259 -2 23 b 2 11 aa aa 82 259 -2 23 b 2 11 aa aa 15 259 -2 23 b 2 11 aa aa 20 259 -7 18 z 7 17 cc cc 12 40 -7 18 z 7 17 cc cc 18 40 -7 18 z 7 17 cc cc 10 40 -7 18 z 7 18 aa aa 77 259 -7 18 z 7 18 aa aa 50 259 -7 18 z 7 18 aa aa 15 259 -7 18 z 7 18 aa aa 82 259 -7 18 z 7 18 aa aa 15 259 -7 18 z 7 18 aa aa 20 259 -7 18 z 7 10 bb bb 40 125 -7 18 z 7 10 bb bb 32 125 -7 18 z 7 10 bb bb 30 125 -7 18 z 7 10 bb bb 23 125 -1 30 c 1 14 bb bb 40 125 -1 30 c 1 14 bb bb 32 125 -1 30 c 1 14 bb bb 30 125 +1 20 a 1 14 bb bb 30 125 +1 20 a 1 14 bb bb 32 125 +1 20 a 1 14 bb bb 40 125 1 30 c 1 14 bb bb 23 125 -3 15 x 3 11 dd dd 20 32 -3 15 x 3 11 dd dd 12 32 -8 12 t 8 11 aa aa 77 259 -8 12 t 8 11 aa aa 50 259 -8 12 t 8 11 aa aa 15 259 -8 12 t 8 11 aa aa 82 259 -8 12 t 8 11 aa aa 15 259 -8 12 t 8 11 aa aa 20 259 -11 33 a 11 24 bbf bbf 50 165 -11 33 a 11 24 bbf bbf 42 165 -11 33 a 11 24 bbf bbf 40 165 -11 33 a 11 24 bbf bbf 33 165 -17 10 s 17 27 ccf ccf 22 70 -17 10 s 17 27 ccf ccf 28 70 -17 10 s 17 27 ccf ccf 20 70 -17 10 s 17 28 aaf aaf 87 319 -17 10 s 17 28 aaf aaf 60 319 -17 10 s 17 28 aaf aaf 25 319 -17 10 s 17 28 aaf aaf 92 319 -17 10 s 17 28 aaf aaf 25 319 -17 10 s 17 28 aaf aaf 30 319 -17 10 s 17 20 bbf bbf 50 165 -17 10 s 17 20 bbf bbf 42 165 -17 10 s 17 20 bbf bbf 40 165 -17 10 s 17 20 bbf bbf 33 165 -11 20 v 11 24 bbf bbf 50 165 -11 20 v 11 24 bbf bbf 42 165 -11 20 v 11 24 bbf bbf 40 165 +1 30 c 1 14 bb bb 30 125 +1 30 c 1 14 bb bb 32 125 +1 30 c 1 14 bb bb 40 125 11 20 v 11 24 bbf bbf 33 165 -12 23 y 12 22 aaf aaf 87 319 -12 23 y 12 22 aaf aaf 60 319 -12 23 y 12 22 aaf aaf 25 319 -12 23 y 12 22 aaf aaf 92 319 -12 23 y 12 22 aaf aaf 25 319 -12 23 y 12 22 aaf aaf 30 319 -12 23 y 12 21 aaf aaf 87 319 -12 23 y 12 21 aaf aaf 60 319 +11 20 v 11 24 bbf bbf 40 165 +11 20 v 11 24 bbf bbf 42 165 +11 20 v 11 24 bbf bbf 50 165 +11 30 af 11 24 bbf bbf 33 165 +11 30 af 11 24 bbf bbf 40 165 +11 30 af 11 24 bbf bbf 42 165 +11 30 af 11 24 bbf bbf 50 165 +11 30 d 11 24 bbf bbf 33 165 +11 30 d 11 24 bbf bbf 40 165 +11 30 d 11 24 bbf bbf 42 165 +11 30 d 11 24 bbf bbf 50 165 +11 33 a 11 24 bbf bbf 33 165 +11 33 a 11 24 bbf bbf 40 165 +11 33 a 11 24 bbf bbf 42 165 +11 33 a 11 24 bbf bbf 50 165 12 23 y 12 21 aaf aaf 25 319 -12 23 y 12 21 aaf aaf 92 319 12 23 y 12 21 aaf aaf 25 319 12 23 y 12 21 aaf aaf 30 319 -17 18 a 17 27 ccf ccf 22 70 -17 18 a 17 27 ccf ccf 28 70 -17 18 a 17 27 ccf ccf 20 70 -17 18 a 17 28 aaf aaf 87 319 -17 18 a 17 28 aaf aaf 60 319 -17 18 a 17 28 aaf aaf 25 319 -17 18 a 17 28 aaf aaf 92 319 -17 18 a 17 28 aaf aaf 25 319 -17 18 a 17 28 aaf aaf 30 319 -17 18 a 17 20 bbf bbf 50 165 -17 18 a 17 20 bbf bbf 42 165 -17 18 a 17 20 bbf bbf 40 165 -17 18 a 17 20 bbf bbf 33 165 -11 30 d 11 24 bbf bbf 50 165 -11 30 d 11 24 bbf bbf 42 165 -11 30 d 11 24 bbf bbf 40 165 -11 30 d 11 24 bbf bbf 33 165 -17 20 xf 17 27 ccf ccf 22 70 -17 20 xf 17 27 ccf ccf 28 70 -17 20 xf 17 27 ccf ccf 20 70 -17 20 xf 17 28 aaf aaf 87 319 -17 20 xf 17 28 aaf aaf 60 319 -17 20 xf 17 28 aaf aaf 25 319 -17 20 xf 17 28 aaf aaf 92 319 -17 20 xf 17 28 aaf aaf 25 319 -17 20 xf 17 28 aaf aaf 30 319 -17 20 xf 17 20 bbf bbf 50 165 -17 20 xf 17 20 bbf bbf 42 165 -17 20 xf 17 20 bbf bbf 40 165 -17 20 xf 17 20 bbf bbf 33 165 -11 30 af 11 24 bbf bbf 50 165 -11 30 af 11 24 bbf bbf 42 165 -11 30 af 11 24 bbf bbf 40 165 -11 30 af 11 24 bbf bbf 33 165 -12 33 bf 12 22 aaf aaf 87 319 -12 33 bf 12 22 aaf aaf 60 319 -12 33 bf 12 22 aaf aaf 25 319 -12 33 bf 12 22 aaf aaf 92 319 -12 33 bf 12 22 aaf aaf 25 319 -12 33 bf 12 22 aaf aaf 30 319 -12 33 bf 12 21 aaf aaf 87 319 -12 33 bf 12 21 aaf aaf 60 319 +12 23 y 12 21 aaf aaf 60 319 +12 23 y 12 21 aaf aaf 87 319 +12 23 y 12 21 aaf aaf 92 319 +12 23 y 12 22 aaf aaf 25 319 +12 23 y 12 22 aaf aaf 25 319 +12 23 y 12 22 aaf aaf 30 319 +12 23 y 12 22 aaf aaf 60 319 +12 23 y 12 22 aaf aaf 87 319 +12 23 y 12 22 aaf aaf 92 319 12 33 bf 12 21 aaf aaf 25 319 -12 33 bf 12 21 aaf aaf 92 319 12 33 bf 12 21 aaf aaf 25 319 12 33 bf 12 21 aaf aaf 30 319 +12 33 bf 12 21 aaf aaf 60 319 +12 33 bf 12 21 aaf aaf 87 319 +12 33 bf 12 21 aaf aaf 92 319 +12 33 bf 12 22 aaf aaf 25 319 +12 33 bf 12 22 aaf aaf 25 319 +12 33 bf 12 22 aaf aaf 30 319 +12 33 bf 12 22 aaf aaf 60 319 +12 33 bf 12 22 aaf aaf 87 319 +12 33 bf 12 22 aaf aaf 92 319 +13 25 xf 13 21 ddf ddf 22 52 +13 25 xf 13 21 ddf ddf 30 52 +17 10 s 17 20 bbf bbf 33 165 +17 10 s 17 20 bbf bbf 40 165 +17 10 s 17 20 bbf bbf 42 165 +17 10 s 17 20 bbf bbf 50 165 +17 10 s 17 27 ccf ccf 20 70 +17 10 s 17 27 ccf ccf 22 70 +17 10 s 17 27 ccf ccf 28 70 +17 10 s 17 28 aaf aaf 25 319 +17 10 s 17 28 aaf aaf 25 319 +17 10 s 17 28 aaf aaf 30 319 +17 10 s 17 28 aaf aaf 60 319 +17 10 s 17 28 aaf aaf 87 319 +17 10 s 17 28 aaf aaf 92 319 +17 18 a 17 20 bbf bbf 33 165 +17 18 a 17 20 bbf bbf 40 165 +17 18 a 17 20 bbf bbf 42 165 +17 18 a 17 20 bbf bbf 50 165 +17 18 a 17 27 ccf ccf 20 70 +17 18 a 17 27 ccf ccf 22 70 +17 18 a 17 27 ccf ccf 28 70 +17 18 a 17 28 aaf aaf 25 319 +17 18 a 17 28 aaf aaf 25 319 +17 18 a 17 28 aaf aaf 30 319 +17 18 a 17 28 aaf aaf 60 319 +17 18 a 17 28 aaf aaf 87 319 +17 18 a 17 28 aaf aaf 92 319 +17 20 xf 17 20 bbf bbf 33 165 +17 20 xf 17 20 bbf bbf 40 165 +17 20 xf 17 20 bbf bbf 42 165 +17 20 xf 17 20 bbf bbf 50 165 +17 20 xf 17 27 ccf ccf 20 70 +17 20 xf 17 27 ccf ccf 22 70 +17 20 xf 17 27 ccf ccf 28 70 +17 20 xf 17 28 aaf aaf 25 319 +17 20 xf 17 28 aaf aaf 25 319 +17 20 xf 17 28 aaf aaf 30 319 +17 20 xf 17 28 aaf aaf 60 319 +17 20 xf 17 28 aaf aaf 87 319 +17 20 xf 17 28 aaf aaf 92 319 +17 28 zf 17 20 bbf bbf 33 165 +17 28 zf 17 20 bbf bbf 40 165 +17 28 zf 17 20 bbf bbf 42 165 +17 28 zf 17 20 bbf bbf 50 165 +17 28 zf 17 27 ccf ccf 20 70 17 28 zf 17 27 ccf ccf 22 70 17 28 zf 17 27 ccf ccf 28 70 -17 28 zf 17 27 ccf ccf 20 70 -17 28 zf 17 28 aaf aaf 87 319 -17 28 zf 17 28 aaf aaf 60 319 17 28 zf 17 28 aaf aaf 25 319 -17 28 zf 17 28 aaf aaf 92 319 17 28 zf 17 28 aaf aaf 25 319 17 28 zf 17 28 aaf aaf 30 319 -17 28 zf 17 20 bbf bbf 50 165 -17 28 zf 17 20 bbf bbf 42 165 -17 28 zf 17 20 bbf bbf 40 165 -17 28 zf 17 20 bbf bbf 33 165 -13 25 xf 13 21 ddf ddf 30 52 -13 25 xf 13 21 ddf ddf 22 52 -18 22 tf 18 21 aaf aaf 87 319 -18 22 tf 18 21 aaf aaf 60 319 +17 28 zf 17 28 aaf aaf 60 319 +17 28 zf 17 28 aaf aaf 87 319 +17 28 zf 17 28 aaf aaf 92 319 18 22 tf 18 21 aaf aaf 25 319 -18 22 tf 18 21 aaf aaf 92 319 18 22 tf 18 21 aaf aaf 25 319 18 22 tf 18 21 aaf aaf 30 319 +18 22 tf 18 21 aaf aaf 60 319 +18 22 tf 18 21 aaf aaf 87 319 +18 22 tf 18 21 aaf aaf 92 319 +2 23 b 2 11 aa aa 15 259 +2 23 b 2 11 aa aa 15 259 +2 23 b 2 11 aa aa 20 259 +2 23 b 2 11 aa aa 50 259 +2 23 b 2 11 aa aa 77 259 +2 23 b 2 11 aa aa 82 259 +2 23 b 2 12 aa aa 15 259 +2 23 b 2 12 aa aa 15 259 +2 23 b 2 12 aa aa 20 259 +2 23 b 2 12 aa aa 50 259 +2 23 b 2 12 aa aa 77 259 +2 23 b 2 12 aa aa 82 259 +3 15 x 3 11 dd dd 12 32 +3 15 x 3 11 dd dd 20 32 +7 10 x 7 10 bb bb 23 125 +7 10 x 7 10 bb bb 30 125 +7 10 x 7 10 bb bb 32 125 +7 10 x 7 10 bb bb 40 125 +7 10 x 7 17 cc cc 10 40 +7 10 x 7 17 cc cc 12 40 +7 10 x 7 17 cc cc 18 40 +7 10 x 7 18 aa aa 15 259 +7 10 x 7 18 aa aa 15 259 +7 10 x 7 18 aa aa 20 259 +7 10 x 7 18 aa aa 50 259 +7 10 x 7 18 aa aa 77 259 +7 10 x 7 18 aa aa 82 259 +7 18 z 7 10 bb bb 23 125 +7 18 z 7 10 bb bb 30 125 +7 18 z 7 10 bb bb 32 125 +7 18 z 7 10 bb bb 40 125 +7 18 z 7 17 cc cc 10 40 +7 18 z 7 17 cc cc 12 40 +7 18 z 7 17 cc cc 18 40 +7 18 z 7 18 aa aa 15 259 +7 18 z 7 18 aa aa 15 259 +7 18 z 7 18 aa aa 20 259 +7 18 z 7 18 aa aa 50 259 +7 18 z 7 18 aa aa 77 259 +7 18 z 7 18 aa aa 82 259 +8 12 t 8 11 aa aa 15 259 +8 12 t 8 11 aa aa 15 259 +8 12 t 8 11 aa aa 20 259 +8 12 t 8 11 aa aa 50 259 +8 12 t 8 11 aa aa 77 259 +8 12 t 8 11 aa aa 82 259 select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; a b c a b c c b sum(b) over (partition by c) -7 10 x 7 17 cc cc 12 40 -7 10 x 7 17 cc cc 18 40 -7 10 x 7 17 cc cc 10 40 -7 10 x 7 18 aa aa 77 259 -7 10 x 7 18 aa aa 50 259 -7 10 x 7 18 aa aa 15 259 -7 10 x 7 18 aa aa 82 259 -7 10 x 7 18 aa aa 15 259 -7 10 x 7 18 aa aa 20 259 -7 10 x 7 10 bb bb 40 125 -7 10 x 7 10 bb bb 32 125 -7 10 x 7 10 bb bb 30 125 -7 10 x 7 10 bb bb 23 125 -1 20 a 1 14 bb bb 40 125 -1 20 a 1 14 bb bb 32 125 -1 20 a 1 14 bb bb 30 125 1 20 a 1 14 bb bb 23 125 -2 23 b 2 12 aa aa 77 259 -2 23 b 2 12 aa aa 50 259 -2 23 b 2 12 aa aa 15 259 -2 23 b 2 12 aa aa 82 259 -2 23 b 2 12 aa aa 15 259 -2 23 b 2 12 aa aa 20 259 -2 23 b 2 11 aa aa 77 259 -2 23 b 2 11 aa aa 50 259 -2 23 b 2 11 aa aa 15 259 -2 23 b 2 11 aa aa 82 259 -2 23 b 2 11 aa aa 15 259 -2 23 b 2 11 aa aa 20 259 -7 18 z 7 17 cc cc 12 40 -7 18 z 7 17 cc cc 18 40 -7 18 z 7 17 cc cc 10 40 -7 18 z 7 18 aa aa 77 259 -7 18 z 7 18 aa aa 50 259 -7 18 z 7 18 aa aa 15 259 -7 18 z 7 18 aa aa 82 259 -7 18 z 7 18 aa aa 15 259 -7 18 z 7 18 aa aa 20 259 -7 18 z 7 10 bb bb 40 125 -7 18 z 7 10 bb bb 32 125 -7 18 z 7 10 bb bb 30 125 -7 18 z 7 10 bb bb 23 125 -1 30 c 1 14 bb bb 40 125 -1 30 c 1 14 bb bb 32 125 -1 30 c 1 14 bb bb 30 125 +1 20 a 1 14 bb bb 30 125 +1 20 a 1 14 bb bb 32 125 +1 20 a 1 14 bb bb 40 125 1 30 c 1 14 bb bb 23 125 -3 15 x 3 11 dd dd 20 32 -3 15 x 3 11 dd dd 12 32 -8 12 t 8 11 aa aa 77 259 -8 12 t 8 11 aa aa 50 259 -8 12 t 8 11 aa aa 15 259 -8 12 t 8 11 aa aa 82 259 -8 12 t 8 11 aa aa 15 259 -8 12 t 8 11 aa aa 20 259 -11 33 a 11 24 bbf bbf 50 165 -11 33 a 11 24 bbf bbf 42 165 -11 33 a 11 24 bbf bbf 40 165 -11 33 a 11 24 bbf bbf 33 165 -17 10 s 17 27 ccf ccf 22 70 -17 10 s 17 27 ccf ccf 28 70 -17 10 s 17 27 ccf ccf 20 70 -17 10 s 17 28 aaf aaf 87 319 -17 10 s 17 28 aaf aaf 60 319 -17 10 s 17 28 aaf aaf 25 319 -17 10 s 17 28 aaf aaf 92 319 -17 10 s 17 28 aaf aaf 25 319 -17 10 s 17 28 aaf aaf 30 319 -17 10 s 17 20 bbf bbf 50 165 -17 10 s 17 20 bbf bbf 42 165 -17 10 s 17 20 bbf bbf 40 165 -17 10 s 17 20 bbf bbf 33 165 -11 20 v 11 24 bbf bbf 50 165 -11 20 v 11 24 bbf bbf 42 165 -11 20 v 11 24 bbf bbf 40 165 +1 30 c 1 14 bb bb 30 125 +1 30 c 1 14 bb bb 32 125 +1 30 c 1 14 bb bb 40 125 11 20 v 11 24 bbf bbf 33 165 -12 23 y 12 22 aaf aaf 87 319 -12 23 y 12 22 aaf aaf 60 319 -12 23 y 12 22 aaf aaf 25 319 -12 23 y 12 22 aaf aaf 92 319 -12 23 y 12 22 aaf aaf 25 319 -12 23 y 12 22 aaf aaf 30 319 -12 23 y 12 21 aaf aaf 87 319 -12 23 y 12 21 aaf aaf 60 319 +11 20 v 11 24 bbf bbf 40 165 +11 20 v 11 24 bbf bbf 42 165 +11 20 v 11 24 bbf bbf 50 165 +11 30 af 11 24 bbf bbf 33 165 +11 30 af 11 24 bbf bbf 40 165 +11 30 af 11 24 bbf bbf 42 165 +11 30 af 11 24 bbf bbf 50 165 +11 30 d 11 24 bbf bbf 33 165 +11 30 d 11 24 bbf bbf 40 165 +11 30 d 11 24 bbf bbf 42 165 +11 30 d 11 24 bbf bbf 50 165 +11 33 a 11 24 bbf bbf 33 165 +11 33 a 11 24 bbf bbf 40 165 +11 33 a 11 24 bbf bbf 42 165 +11 33 a 11 24 bbf bbf 50 165 12 23 y 12 21 aaf aaf 25 319 -12 23 y 12 21 aaf aaf 92 319 12 23 y 12 21 aaf aaf 25 319 12 23 y 12 21 aaf aaf 30 319 -17 18 a 17 27 ccf ccf 22 70 -17 18 a 17 27 ccf ccf 28 70 -17 18 a 17 27 ccf ccf 20 70 -17 18 a 17 28 aaf aaf 87 319 -17 18 a 17 28 aaf aaf 60 319 -17 18 a 17 28 aaf aaf 25 319 -17 18 a 17 28 aaf aaf 92 319 -17 18 a 17 28 aaf aaf 25 319 -17 18 a 17 28 aaf aaf 30 319 -17 18 a 17 20 bbf bbf 50 165 -17 18 a 17 20 bbf bbf 42 165 -17 18 a 17 20 bbf bbf 40 165 -17 18 a 17 20 bbf bbf 33 165 -11 30 d 11 24 bbf bbf 50 165 -11 30 d 11 24 bbf bbf 42 165 -11 30 d 11 24 bbf bbf 40 165 -11 30 d 11 24 bbf bbf 33 165 -17 20 xf 17 27 ccf ccf 22 70 -17 20 xf 17 27 ccf ccf 28 70 -17 20 xf 17 27 ccf ccf 20 70 -17 20 xf 17 28 aaf aaf 87 319 -17 20 xf 17 28 aaf aaf 60 319 -17 20 xf 17 28 aaf aaf 25 319 -17 20 xf 17 28 aaf aaf 92 319 -17 20 xf 17 28 aaf aaf 25 319 -17 20 xf 17 28 aaf aaf 30 319 -17 20 xf 17 20 bbf bbf 50 165 -17 20 xf 17 20 bbf bbf 42 165 -17 20 xf 17 20 bbf bbf 40 165 -17 20 xf 17 20 bbf bbf 33 165 -11 30 af 11 24 bbf bbf 50 165 -11 30 af 11 24 bbf bbf 42 165 -11 30 af 11 24 bbf bbf 40 165 -11 30 af 11 24 bbf bbf 33 165 -12 33 bf 12 22 aaf aaf 87 319 -12 33 bf 12 22 aaf aaf 60 319 -12 33 bf 12 22 aaf aaf 25 319 -12 33 bf 12 22 aaf aaf 92 319 -12 33 bf 12 22 aaf aaf 25 319 -12 33 bf 12 22 aaf aaf 30 319 -12 33 bf 12 21 aaf aaf 87 319 -12 33 bf 12 21 aaf aaf 60 319 +12 23 y 12 21 aaf aaf 60 319 +12 23 y 12 21 aaf aaf 87 319 +12 23 y 12 21 aaf aaf 92 319 +12 23 y 12 22 aaf aaf 25 319 +12 23 y 12 22 aaf aaf 25 319 +12 23 y 12 22 aaf aaf 30 319 +12 23 y 12 22 aaf aaf 60 319 +12 23 y 12 22 aaf aaf 87 319 +12 23 y 12 22 aaf aaf 92 319 12 33 bf 12 21 aaf aaf 25 319 -12 33 bf 12 21 aaf aaf 92 319 12 33 bf 12 21 aaf aaf 25 319 12 33 bf 12 21 aaf aaf 30 319 +12 33 bf 12 21 aaf aaf 60 319 +12 33 bf 12 21 aaf aaf 87 319 +12 33 bf 12 21 aaf aaf 92 319 +12 33 bf 12 22 aaf aaf 25 319 +12 33 bf 12 22 aaf aaf 25 319 +12 33 bf 12 22 aaf aaf 30 319 +12 33 bf 12 22 aaf aaf 60 319 +12 33 bf 12 22 aaf aaf 87 319 +12 33 bf 12 22 aaf aaf 92 319 +13 25 xf 13 21 ddf ddf 22 52 +13 25 xf 13 21 ddf ddf 30 52 +17 10 s 17 20 bbf bbf 33 165 +17 10 s 17 20 bbf bbf 40 165 +17 10 s 17 20 bbf bbf 42 165 +17 10 s 17 20 bbf bbf 50 165 +17 10 s 17 27 ccf ccf 20 70 +17 10 s 17 27 ccf ccf 22 70 +17 10 s 17 27 ccf ccf 28 70 +17 10 s 17 28 aaf aaf 25 319 +17 10 s 17 28 aaf aaf 25 319 +17 10 s 17 28 aaf aaf 30 319 +17 10 s 17 28 aaf aaf 60 319 +17 10 s 17 28 aaf aaf 87 319 +17 10 s 17 28 aaf aaf 92 319 +17 18 a 17 20 bbf bbf 33 165 +17 18 a 17 20 bbf bbf 40 165 +17 18 a 17 20 bbf bbf 42 165 +17 18 a 17 20 bbf bbf 50 165 +17 18 a 17 27 ccf ccf 20 70 +17 18 a 17 27 ccf ccf 22 70 +17 18 a 17 27 ccf ccf 28 70 +17 18 a 17 28 aaf aaf 25 319 +17 18 a 17 28 aaf aaf 25 319 +17 18 a 17 28 aaf aaf 30 319 +17 18 a 17 28 aaf aaf 60 319 +17 18 a 17 28 aaf aaf 87 319 +17 18 a 17 28 aaf aaf 92 319 +17 20 xf 17 20 bbf bbf 33 165 +17 20 xf 17 20 bbf bbf 40 165 +17 20 xf 17 20 bbf bbf 42 165 +17 20 xf 17 20 bbf bbf 50 165 +17 20 xf 17 27 ccf ccf 20 70 +17 20 xf 17 27 ccf ccf 22 70 +17 20 xf 17 27 ccf ccf 28 70 +17 20 xf 17 28 aaf aaf 25 319 +17 20 xf 17 28 aaf aaf 25 319 +17 20 xf 17 28 aaf aaf 30 319 +17 20 xf 17 28 aaf aaf 60 319 +17 20 xf 17 28 aaf aaf 87 319 +17 20 xf 17 28 aaf aaf 92 319 +17 28 zf 17 20 bbf bbf 33 165 +17 28 zf 17 20 bbf bbf 40 165 +17 28 zf 17 20 bbf bbf 42 165 +17 28 zf 17 20 bbf bbf 50 165 +17 28 zf 17 27 ccf ccf 20 70 17 28 zf 17 27 ccf ccf 22 70 17 28 zf 17 27 ccf ccf 28 70 -17 28 zf 17 27 ccf ccf 20 70 -17 28 zf 17 28 aaf aaf 87 319 -17 28 zf 17 28 aaf aaf 60 319 17 28 zf 17 28 aaf aaf 25 319 -17 28 zf 17 28 aaf aaf 92 319 17 28 zf 17 28 aaf aaf 25 319 17 28 zf 17 28 aaf aaf 30 319 -17 28 zf 17 20 bbf bbf 50 165 -17 28 zf 17 20 bbf bbf 42 165 -17 28 zf 17 20 bbf bbf 40 165 -17 28 zf 17 20 bbf bbf 33 165 -13 25 xf 13 21 ddf ddf 30 52 -13 25 xf 13 21 ddf ddf 22 52 -18 22 tf 18 21 aaf aaf 87 319 -18 22 tf 18 21 aaf aaf 60 319 +17 28 zf 17 28 aaf aaf 60 319 +17 28 zf 17 28 aaf aaf 87 319 +17 28 zf 17 28 aaf aaf 92 319 18 22 tf 18 21 aaf aaf 25 319 -18 22 tf 18 21 aaf aaf 92 319 18 22 tf 18 21 aaf aaf 25 319 18 22 tf 18 21 aaf aaf 30 319 +18 22 tf 18 21 aaf aaf 60 319 +18 22 tf 18 21 aaf aaf 87 319 +18 22 tf 18 21 aaf aaf 92 319 +2 23 b 2 11 aa aa 15 259 +2 23 b 2 11 aa aa 15 259 +2 23 b 2 11 aa aa 20 259 +2 23 b 2 11 aa aa 50 259 +2 23 b 2 11 aa aa 77 259 +2 23 b 2 11 aa aa 82 259 +2 23 b 2 12 aa aa 15 259 +2 23 b 2 12 aa aa 15 259 +2 23 b 2 12 aa aa 20 259 +2 23 b 2 12 aa aa 50 259 +2 23 b 2 12 aa aa 77 259 +2 23 b 2 12 aa aa 82 259 +3 15 x 3 11 dd dd 12 32 +3 15 x 3 11 dd dd 20 32 +7 10 x 7 10 bb bb 23 125 +7 10 x 7 10 bb bb 30 125 +7 10 x 7 10 bb bb 32 125 +7 10 x 7 10 bb bb 40 125 +7 10 x 7 17 cc cc 10 40 +7 10 x 7 17 cc cc 12 40 +7 10 x 7 17 cc cc 18 40 +7 10 x 7 18 aa aa 15 259 +7 10 x 7 18 aa aa 15 259 +7 10 x 7 18 aa aa 20 259 +7 10 x 7 18 aa aa 50 259 +7 10 x 7 18 aa aa 77 259 +7 10 x 7 18 aa aa 82 259 +7 18 z 7 10 bb bb 23 125 +7 18 z 7 10 bb bb 30 125 +7 18 z 7 10 bb bb 32 125 +7 18 z 7 10 bb bb 40 125 +7 18 z 7 17 cc cc 10 40 +7 18 z 7 17 cc cc 12 40 +7 18 z 7 17 cc cc 18 40 +7 18 z 7 18 aa aa 15 259 +7 18 z 7 18 aa aa 15 259 +7 18 z 7 18 aa aa 20 259 +7 18 z 7 18 aa aa 50 259 +7 18 z 7 18 aa aa 77 259 +7 18 z 7 18 aa aa 82 259 +8 12 t 8 11 aa aa 15 259 +8 12 t 8 11 aa aa 15 259 +8 12 t 8 11 aa aa 20 259 +8 12 t 8 11 aa aa 50 259 +8 12 t 8 11 aa aa 77 259 +8 12 t 8 11 aa aa 82 259 explain extended select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; id select_type table type possible_keys key key_len ref rows filtered Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 90 100.00 Using where -1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 2 100.00 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 90 33.33 Using where +1 PRIMARY t3 ref idx_a idx_a 5 test.t2.a 1 100.00 Using where 1 PRIMARY ref key0 key0 128 test.t3.c 10 100.00 2 DERIVED t4 ALL idx_c NULL NULL NULL 160 100.00 Using temporary Warnings: @@ -15567,7 +16247,7 @@ EXPLAIN "table_name": "t2", "access_type": "ALL", "rows": 90, - "filtered": 100, + "filtered": 33.333, "attached_condition": "t2.b < 40 and t2.a is not null" }, "table": { @@ -15578,7 +16258,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["a"], "ref": ["test.t2.a"], - "rows": 2, + "rows": 1, "filtered": 100, "attached_condition": "t3.c is not null" }, @@ -15634,9 +16314,13 @@ INSERT INTO t4 VALUES (5,'zzz'),(9,'xyz'),(2,'yxz'),(5,'zxy'),(7,'zyx') ; ANALYZE TABLE t1,t2,t3,t4; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK +test.t4 analyze status Engine-independent statistics collected test.t4 analyze status OK CREATE VIEW v1 AS SELECT c FROM t3 @@ -15892,31 +16576,31 @@ cte as (select median(f2) over (partition by f1) as k1 from t1 order by f1), cte1 as (select median(f4) over (partition by f1) as k2 from t1) select k1,k2 from cte1, cte; k1 k2 -1.0000000000 9.0000000000 -1.0000000000 9.0000000000 -1.0000000000 8.0000000000 +0.0000000000 0.0000000000 +0.0000000000 0.0000000000 +0.0000000000 0.0000000000 +0.0000000000 0.0000000000 +0.0000000000 8.0000000000 +0.0000000000 8.0000000000 +0.0000000000 8.0000000000 +0.0000000000 8.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 +0.0000000000 9.0000000000 1.0000000000 0.0000000000 +1.0000000000 8.0000000000 +1.0000000000 9.0000000000 +1.0000000000 9.0000000000 1.0000000000 9.0000000000 -0.0000000000 9.0000000000 -0.0000000000 9.0000000000 -0.0000000000 8.0000000000 -0.0000000000 0.0000000000 -0.0000000000 9.0000000000 -0.0000000000 9.0000000000 -0.0000000000 9.0000000000 -0.0000000000 8.0000000000 -0.0000000000 0.0000000000 -0.0000000000 9.0000000000 -0.0000000000 9.0000000000 -0.0000000000 9.0000000000 -0.0000000000 8.0000000000 -0.0000000000 0.0000000000 -0.0000000000 9.0000000000 -0.0000000000 9.0000000000 -0.0000000000 9.0000000000 -0.0000000000 8.0000000000 -0.0000000000 0.0000000000 -0.0000000000 9.0000000000 explain with cte as (select median(f2) over (partition by f1) as k1 from t1 order by f1), cte1 as (select median(f4) over (partition by f1) as k2 from t1) @@ -15961,440 +16645,6 @@ f c DROP VIEW v1; DROP TABLE t1; # -# MDEV-15087: error from inexpensive subquery before check -# for condition pushdown into derived -# -CREATE TABLE t1 (i1 int, v1 varchar(1)); -INSERT INTO t1 VALUES (7,'x'); -CREATE TABLE t2 (i1 int); -INSERT INTO t2 VALUES (8); -CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1)); -INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL); -SELECT 1 -FROM (t1 AS a1 -JOIN (((SELECT DISTINCT t3.* -FROM t3) AS a2 -JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1)) -WHERE (SELECT BIT_COUNT(t2.i1) -FROM (t2 JOIN t3)) IS NULL; -ERROR 21000: Subquery returns more than 1 row -DROP TABLE t1, t2, t3; -# -# MDEV-16614 signal 7 after calling stored procedure, that uses regexp -# -CREATE PROCEDURE p1(m1 varchar(5), m2 varchar(5)) -BEGIN -SELECT a FROM -(SELECT "aa" a) t -JOIN (SELECT "aa" b) t1 on t.a=t1.b -WHERE t.a regexp m1 and t1.b regexp m2 -GROUP BY a; -END$$ -CALL p1('a','a'); -a -aa -DROP PROCEDURE p1; -CREATE PROCEDURE p1(m1 varchar(5)) -BEGIN -SELECT a FROM (SELECT "aa" a) t WHERE t.a regexp m1; -END$$ -CALL p1('a'); -a -aa -DROP PROCEDURE p1; -SELECT a FROM (SELECT "aa" a) t WHERE REGEXP_INSTR(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); -a -aa -CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT -BEGIN -RETURN 1; -END;$$ -CREATE OR REPLACE PROCEDURE p1(m1 varchar(5)) -BEGIN -SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, m1); -END$$ -CALL p1('a'); -a -aa -DROP PROCEDURE p1; -DROP FUNCTION f1; -CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT -BEGIN -RETURN 1; -END;$$ -SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); -a -aa -DROP FUNCTION f1; -# -# MDEV-17011: condition pushdown into materialized derived used -# in INSERT SELECT, multi-table UPDATE and DELETE -# -CREATE TABLE t1 (a int ,b int) ENGINE=MyISAM; -INSERT INTO t1 VALUES -(1, 1), (1, 2), (2, 1), (2, 2), (3,1), (3,3), (4,2); -CREATE TABLE t2 (a int) ENGINE MYISAM; -INSERT INTO t2 VALUES -(3), (7), (1), (4), (1); -CREATE TABLE t3 (a int, b int) ENGINE MYISAM; -EXPLAIN FORMAT=JSON INSERT INTO t3 -SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t.a <= 2", - "materialized": { - "query_block": { - "select_id": 2, - "filesort": { - "sort_key": "t1.a", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t1.a <= 2" - } - } - } - } - } - } - } -} -INSERT INTO t3 -SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; -SELECT * FROM t3; -a b -1 2 -2 2 -EXPLAIN FORMAT=JSON UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 -WHERE t2.a= t.c and t.a>=3; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 5, - "filtered": 100, - "attached_condition": "t2.a is not null" - }, - "table": { - "table_name": "", - "access_type": "ref", - "possible_keys": ["key0"], - "key": "key0", - "key_length": "8", - "used_key_parts": ["c"], - "ref": ["test.t2.a"], - "rows": 2, - "filtered": 100, - "attached_condition": "t2.a = t.c and t.a >= 3", - "materialized": { - "query_block": { - "select_id": 2, - "filesort": { - "sort_key": "t1.a", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t1.a >= 3" - } - } - } - } - } - } - } -} -UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 -WHERE t2.a= t.c and t.a>=3; -SELECT * FROM t2; -a -3 -7 -11 -4 -11 -EXPLAIN FORMAT=JSON DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t -WHERE t2.a= t.c+9 and t.a=2; -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "t2", - "access_type": "ALL", - "rows": 5, - "filtered": 100 - }, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t.a = 2 and t2.a = t.c + 9", - "materialized": { - "query_block": { - "select_id": 2, - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 7, - "filtered": 100, - "attached_condition": "t1.a = 2" - } - } - } - } - } -} -DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t -WHERE t2.a= t.c+9 and t.a=2; -SELECT * FROM t2; -a -3 -7 -4 -DROP TABLE t1,t2,t3; -# -# MDEV-16765: pushdown condition with the CASE structure -# defined with Item_cond item -# -CREATE TABLE t1(a INT, b INT); -INSERT INTO t1 VALUES (1,2), (3,4), (2,3); -SELECT * -FROM -( -SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) -THEN 1 ELSE 0 END AS max_a,b -FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -max_a b -1 2 -1 3 -EXPLAIN FORMAT=JSON SELECT * -FROM -( -SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) -THEN 1 ELSE 0 END AS max_a,b -FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "case when (tab2.max_a = 1 or tab2.max_a = 2) then 1 else 0 end = 1", - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "case when (max_a = 1 or max_a = 2) then 1 else 0 end = 1", - "filesort": { - "sort_key": "t1.b", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - } -} -SELECT * -FROM -( -SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) -THEN 1 ELSE 0 END AS max_a,b -FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -max_a b -1 2 -1 4 -EXPLAIN FORMAT=JSON SELECT * -FROM -( -SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) -THEN 1 ELSE 0 END AS max_a,b -FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "case when (tab2.max_a = 1 or tab2.max_a > 2 and tab2.max_a < 4) then 1 else 0 end = 1", - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "case when (max_a = 1 or max_a > 2 and max_a < 4) then 1 else 0 end = 1", - "filesort": { - "sort_key": "t1.b", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - } -} -SELECT * -FROM -( -SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) -THEN 1 ELSE 0 END AS max_a,b -FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -max_a b -1 3 -1 4 -EXPLAIN FORMAT=JSON SELECT * -FROM -( -SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) -THEN 1 ELSE 0 END AS max_a,b -FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "case when (tab2.max_a > 1 and (tab2.max_a = 2 or tab2.max_a > 2)) then 1 else 0 end = 1", - "materialized": { - "query_block": { - "select_id": 3, - "having_condition": "case when (max_a > 1 and (max_a = 2 or max_a > 2)) then 1 else 0 end = 1", - "filesort": { - "sort_key": "t1.b", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100 - } - } - } - } - } - } - } -} -SELECT * -FROM -( -SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) -THEN 1 ELSE 0 END AS max_a,b -FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -max_a b -1 2 -1 4 -EXPLAIN FORMAT=JSON SELECT * -FROM -( -SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) -THEN 1 ELSE 0 END AS max_a,b -FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -EXPLAIN -{ - "query_block": { - "select_id": 1, - "table": { - "table_name": "", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "case when (tab2.b = 2 or tab2.b = 4) then 1 else 0 end = 1", - "materialized": { - "query_block": { - "select_id": 3, - "filesort": { - "sort_key": "t1.b", - "temporary_table": { - "table": { - "table_name": "t1", - "access_type": "ALL", - "rows": 3, - "filtered": 100, - "attached_condition": "case when (t1.b = 2 or t1.b = 4) then 1 else 0 end = 1" - } - } - } - } - } - } - } -} -DROP TABLE t1; -# -# MDEV-16803: pushdown condition with IN predicate in the derived table -# defined with several SELECT statements -# -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 VALUES (1,2),(3,2),(1,1); -SELECT * FROM -( -SELECT a,b,1 as c -FROM t1 -UNION ALL -SELECT a,b,2 as c -FROM t1 -) AS tab -WHERE ((a,b) IN ((1,2),(3,2))); -a b c -1 2 1 -3 2 1 -1 2 2 -3 2 2 -DROP TABLE t1; -# Start of 10.3 tests -# # MDEV-16801: splittable materialized derived/views with # one grouping field from table without keys # @@ -16412,8 +16662,11 @@ INSERT INTO t3 VALUES (3), (4), (1), (8), (3); ANALYZE tables t1,t2,t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK SELECT * FROM t3, @@ -16443,8 +16696,49 @@ WHERE t3.d = dt.b; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t3 ALL NULL NULL NULL NULL 5 100.00 Using where 1 PRIMARY ref key0 key0 5 test.t3.d 2 100.00 -2 LATERAL DERIVED t1 ref idx_b idx_b 5 test.t3.d 2 100.00 Using index; Using temporary; Using filesort +2 LATERAL DERIVED t1 ref idx_b idx_b 5 test.t3.d 1 100.00 Using index; Using temporary; Using filesort 2 LATERAL DERIVED t2 ALL NULL NULL NULL NULL 5 100.00 Using join buffer (flat, BNL join) Warnings: Note 1003 /* select#1 */ select `test`.`t3`.`d` AS `d`,`dt`.`b` AS `b`,`dt`.`c` AS `c` from `test`.`t3` join (/* select#2 */ select `test`.`t1`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`b` = `test`.`t3`.`d` group by `test`.`t1`.`b`,`test`.`t2`.`c`) `dt` where `dt`.`b` = `test`.`t3`.`d` DROP TABLE t1,t2,t3; +# +# MDEV-17419: splittable materialized derived/view +# when join_cache_level = 4 +# +set join_cache_level = 4; +CREATE TABLE t1 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +username VARCHAR(50) NULL DEFAULT '0', +PRIMARY KEY (id) +) COLLATE='utf8_general_ci'; +CREATE TABLE t2 ( +id INT UNSIGNED NOT NULL AUTO_INCREMENT, +userid INT UNSIGNED NOT NULL, +logindate DATETIME NOT NULL, +PRIMARY KEY (id) +) COLLATE='utf8_general_ci'; +INSERT INTO t1 (id, username) VALUES +(1,"user1"), (2, "user2"); +INSERT INTO t2 (id, userid, logindate) VALUES +(1,1,"2015-06-19 12:17:02.828"), +(2,1,"2016-06-19 12:17:02.828"), +(3,2,"2017-06-19 12:17:02.828"), +(4,2,"2018-06-19 12:17:02.828"); +EXPLAIN select * from t1 as u +left join +(select * from t2 as au group by au.userid) as auditlastlogin +on u.id=auditlastlogin.userid; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY u ALL NULL NULL NULL NULL 2 +1 PRIMARY ref key0 key0 5 test.u.id 2 +2 DERIVED au ALL NULL NULL NULL NULL 4 Using temporary; Using filesort +select * from t1 as u +left join +(select * from t2 as au group by au.userid) as auditlastlogin +on u.id=auditlastlogin.userid; +id username id userid logindate +1 user1 1 1 2015-06-19 12:17:02 +2 user2 3 2 2017-06-19 12:17:02 +set join_cache_level=default; +DROP TABLE t1,t2; +# End of 10.3 tests diff --git a/mysql-test/main/derived_cond_pushdown.test b/mysql-test/main/derived_cond_pushdown.test index 61541d2cdf5..076d39c1abd 100644 --- a/mysql-test/main/derived_cond_pushdown.test +++ b/mysql-test/main/derived_cond_pushdown.test @@ -1,46 +1,46 @@ -let $no_pushdown= set statement optimizer_switch='condition_pushdown_for_derived=off' for; +let $no_pushdown= set statement optimizer_switch='condition_pushdown_for_derived=off' for; create table t1 (a int, b int, c int); create table t2 (a int, b int, c int, d decimal); -insert into t1 values +insert into t1 values (1,21,345), (1,33,7), (8,33,114), (1,21,500), (1,19,107), (5,14,787), (8,33,123), (9,10,211), (5,16,207), (1,33,988), (5,27,132), (1,21,104), (6,20,309), (6,20,315), (1,21,101), (8,33,404), (9,10,800), (1,21,123), (7,11,708), (6,20,214); insert into t2 values - (2,3,207,207.0000), (1,21,909,12.0000), (7,13,312,406.0000), + (2,3,207,207.0000), (1,21,909,12.0000), (7,13,312,406.0000), (8,64,248,107.0000), (6,20,315,279.3333), (1,19,203,107.0000), (8,80,800,314.0000), (3,12,231,190.0000), (6,23,303,909.0000); - + create table t1_double(a int, b double, c double); -insert into t1_double values +insert into t1_double values (1,23.4,14.3333), (1,12.5,18.9), (3,12.5,18.9), (4,33.4,14.3333), (4,14.3333,13.65), (5,17.89,7.22), (6,33.4,14.3), (10,33.4,13.65), (11,33.4,13.65); - + create table t2_double(a int, b double, c double); -insert into t2_double values +insert into t2_double values (1,22.4,14.3333), (1,12.5,18.9), (2,22.4,18.9), (4,33.4,14.3333), (5,22.4,13.65), (7,17.89,18.9), - (6,33.4,14.3333), (10,31.4,13.65), (12,33.4,13.65); - + (6,33.4,14.3333), (10,31.4,13.65), (12,33.4,13.65); + create table t1_char(a char, b char(8), c int); insert into t1_char values ('a','Ivan',1), ('b','Vika',2), ('b','Inga',6), ('c','Vika',7), ('b','Ivan',7), ('a','Alex',6), ('b','Inga',5), ('d','Ron',9), - ('d','Harry',2), ('d','Hermione',3), ('c','Ivan',3), ('c','Harry',4); - + ('d','Harry',2), ('d','Hermione',3), ('c','Ivan',3), ('c','Harry',4); + create table t2_char(a char, b char(8), c int); insert into t2_char values ('b','Ivan',1), ('c','Vinny',3), ('c','Inga',9), ('a','Vika',1), ('c','Ivan',2), ('b','Ali',6), ('c','Inga',2), ('a','Ron',9), ('d','Harry',1), ('b','Hermes',3), ('b','Ivan',11), ('b','Harry',4); - + create table t1_decimal (a decimal(3,1), b decimal(3,1), c int); insert into t1_decimal values (1,1,23),(2,2,11),(3,3,16), (1,1,12),(1,1,14),(2,3,15), - (2,1,13),(2,3,11),(3,3,16); + (2,1,13),(2,3,11),(3,3,16); create table t2_decimal (a decimal(3,1), b decimal(3,1), c int); insert into t2_decimal values @@ -48,27 +48,27 @@ insert into t2_decimal values (1,3,22),(1,3,14),(2,2,15), (2,1,43),(2,3,11),(2,3,16); -create view v1 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 +create view v1 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 group by a,b having max_c < 707; - -create view v2 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 - where t1.a>5 group by a,b having max_c < 707; - + +create view v2 as select a, b, max(c) as max_c, avg(c) as avg_c from t1 + where t1.a>5 group by a,b having max_c < 707; + create view v3 as select a, b, min(c) as min_c from t1 where t1.a<10 group by a,b having min_c > 109; - + create view v4 as select a, b, min(max_c) as min_c from v1 - where (v1.a<15) group by a,b; - -create view v_union as + where (v1.a<15) group by a,b; + +create view v_union as select a, b, min(c) as c from t1 where t1.a<10 group by a,b having c > 109 union select a, b, max(c) as c from t1 - where t1.b>10 group by a,b having c < 300; - -create view v2_union as + where t1.b>10 group by a,b having c < 300; + +create view v2_union as select a, b, min(c) as c from t1 where t1.a<10 group by a,b having c > 109 union @@ -76,117 +76,117 @@ create view v2_union as where t1.b>10 group by a,b having c < 300 union select a, b, avg(c) as c from t1 - where t1.c>300 group by a,b having c < 707; + where t1.c>300 group by a,b having c < 707; -create view v3_union as +create view v3_union as select a, b, (a+1) as c from t1 where t1.a<10 union select a, b, c from t1 - where t1.b>10 and t1.c>100; - -create view v4_union as + where t1.b>10 and t1.c>100; + +create view v4_union as select a, b, max(c)-100 as c from t1 where t1.a<10 group by a,b having c > 109 union select a, b, (c+100) as c from t1 - where t1.b>10; + where t1.b>10; create view v_double as select a, avg(a/4) as avg_a, b, c from t1_double - where (b>12.2) group by b,c having (avg_a<22.333); - -create view v_char as - select a, b, max(c) as max_c from t1_char - group by a,b having max_c < 9; - + where (b>12.2) group by b,c having (avg_a<22.333); + +create view v_char as + select a, b, max(c) as max_c from t1_char + group by a,b having max_c < 9; + create view v_decimal as select a, b, avg(c) as avg_c from t1_decimal - group by a,b having (avg_c>12); + group by a,b having (avg_c>12); ---echo # conjunctive subformula : pushing into HAVING +--echo # conjunctive subformula : pushing into HAVING let $query= select * from v1,t2 where (v1.max_c>214) and (t2.a>v1.a); eval $no_pushdown $query; eval $query; eval explain $query; eval explain format=json $query; -let $query= +let $query= select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 - group by a,b having max_c < 707) v1, + group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; ---echo # extracted or formula : pushing into HAVING -let $query= - select * from v1,t2 where +--echo # extracted or formula : pushing into HAVING +let $query= + select * from v1,t2 where ((v1.max_c>400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or + ((v1.max_c>300) and (v1.avg_c>t2.d) and (v1.b=t2.b)) or ((v1.max_c<135) and (v1.max_c6) and (t2.b>v1.b); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; let $query= select * from v2,t2 where (v2.b>25) and (t2.a7) and (t2.c7) and (t2.c5) and (t2.b4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or +eval explain format=json $query; + +let $query= + select * from v1,t2 where + ((v1.a>4) and (v1.b>t2.b) and (v1.max_c=t2.d)) or ((v1.a<2) and (v1.max_c400) and (t2.b>v1.b); +let $query= + select * from v1,t2 where (v1.a<2) and (v1.max_c>400) and (t2.b>v1.b); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; -let $query= +let $query= select * from v_double as v,t2_double as t where (v.a=t.a) and (v.avg_a>0.45) and (v.b>10); eval $no_pushdown $query; @@ -194,57 +194,57 @@ eval $query; eval explain $query; eval explain format=json $query; -let $query= +let $query= select * from v_decimal as v,t2_decimal as t where (v.a=t.a) and (v.avg_c>15) and (v.b>1); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - +eval explain format=json $query; + --echo # extracted or formula : pushing into HAVING and WHERE -let $query= - select * from v1,t2 where - ((v1.a>7) and (v1.max_c>300) and (t2.c7) and (v1.max_c>300) and (t2.c120)) or (v1.a>7); eval $no_pushdown $query; eval $query; eval explain $query; eval explain format=json $query; - ---echo # extracted or formulas : pushing into WHERE and HAVING -let $query= - select * from v1,t2 where + +--echo # extracted or formulas : pushing into WHERE and HAVING +let $query= + select * from v1,t2 where ((v1.a<2) and (v1.max_c>120) and (v1.b=t2.b)) or (v1.a>7); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - -let $query= +eval explain format=json $query; + +let $query= select * from v1,t2 where ((v1.a<2) and (v1.max_c<200) and (t2.c>v1.max_c) and (v1.max_c=t2.d)) or - ((v1.a>4) and (v1.max_c<500) and (t2.b4) and (v1.max_c<500) and (t2.b400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a400) and (t2.a>v1.a)) or ((v1.max_c<135) and (t2.a150) and (v1.max_c=t2.c); eval $no_pushdown $query; @@ -286,73 +286,73 @@ eval $query; eval explain $query; eval explain format=json $query; ---echo # extracted and formula : pushing into WHERE +--echo # extracted and formula : pushing into WHERE --echo # pushing equalities -let $query= +let $query= select * from v1,t2 where (v1.a=v1.b) and (v1.a=t2.a) and (v1.a=3); eval $no_pushdown $query; eval $query; eval explain $query; eval explain format=json $query; - -let $query= + +let $query= select * from v1,t2 where (v1.a=1) and (v1.b=21) and (t2.a=2); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; -let $query= - select * from v_char as v,t2_char as t where - (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); +let $query= + select * from v_char as v,t2_char as t where + (v.a='c') and (v.b<'Hermes') and ((v.b=t.b) or (v.max_c>20)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # extracted and formula : pushing into WHERE using equalities --echo # pushing equalities -let $query= +let $query= select * from v_decimal as v,t2_decimal as t where (v.a=v.b) and (v.b=t.b) and ((t.b>1) or (v.a=1)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; ---echo # extracted or formula : pushing into HAVING using equalities -let $query= +--echo # extracted or formula : pushing into HAVING using equalities +let $query= select * from v1,t2 - where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); + where ((t2.a<4) and (v1.a=t2.a)) or ((t2.c>150) and (v1.max_c=t2.c)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # conjunctive subformulas : pushing into WHERE and HAVING using equalities -let $query= +let $query= select * from v1,t2 where ((t2.a>5) and (v1.a=t2.a)) and ((t2.c>250) and (v1.max_c=t2.c)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # conjunctive subformulas : pushing into WHERE and HAVING ---echo # pushing equalities -let $query= +--echo # pushing equalities +let $query= select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 - group by a,b having max_c < 707) v1, + group by a,b having max_c < 707) v1, t2 where (v1.a=8) and (v1.a=t2.a) and (v1.max_c=404); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - ---echo # conjunctive subformulas : pushing into WHERE and HAVING -let $query= - select * from v1,t2 where +eval explain format=json $query; + +--echo # conjunctive subformulas : pushing into WHERE and HAVING +let $query= + select * from v1,t2 where (v1.a>3) and (v1.max_c>200) and (t2.b10) or (v.a=1)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # conjunctive subformula : pushing into WHERE ---echo # extracted or formula : pushing into HAVING using equalities -let $query= +--echo # extracted or formula : pushing into HAVING using equalities +let $query= select * from v_double as v,t2_double as t where (((v.a>0.2) or (v.b<17)) or (t.c>17)) and (t.c=v.c) and (v.c>18); eval $no_pushdown $query; @@ -383,146 +383,146 @@ eval explain format=json $query; --echo # extracted or formula : pushing into WHERE --echo # conjunctive subformula : pushing into HAVING --echo # pushing equalities -let $query= +let $query= select * from v_decimal as v,t2_decimal as t where - (((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); + (((v.a>4) or (v.a=2)) or (v.b>3)) and (v.avg_c=13); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; -let $query= +let $query= select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 - where t1.a>5 group by a,b having max_c < 707) v1, + where t1.a>5 group by a,b having max_c < 707) v1, t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.a=v1.b); eval $no_pushdown $query; eval $query; eval explain $query; eval explain format=json $query; - + --echo # nothing to push -let $query= +let $query= select * from v1,t2 where (t2.a<2) and (t2.c>900); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; let $query= select * from v1,t2 where (v1.a=t2.a) and (v1.b=t2.b); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - -let $query= - select * from v1,t2 where - (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); +eval explain format=json $query; + +let $query= + select * from v1,t2 where + (t2.a=v1.a) or (v1.b=t2.b) and ((v1.a=1) or (v1.a=6)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - -let $query= +eval explain format=json $query; + +let $query= select * from v1,t2 where (v1.a=1) or (v1.b=21) or (t2.a=2); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; -let $query= - select * from v1,t2 where +let $query= + select * from v1,t2 where (t2.a<2) and (t2.c>900) and ((v1.a13) and (t2.c<115)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using several derived tables : pushing in all tables --echo # conjunctive subformula : pushing into HAVING --echo # extracted or formula : pushing into WHERE ---echo # pushing equalities -let $query= - select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and +--echo # pushing equalities +let $query= + select * from v1,v2,t2 where ((v1.a=v2.a) or (v1.a=t2.a)) and ((v2.b<50) or (v2.b=19)) and (v1.max_c<300); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - +eval explain format=json $query; + --echo # using several derived tables : pushing only in one table --echo # conjunctive subformula : pushing into WHERE --echo # pushing equalities -let $query= - select * from v1,v2,t2 where - (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); +let $query= + select * from v1,v2,t2 where + (v1.a=t2.a) and (v1.a=v1.b) and (v1.a=v2.a) and (v2.max_c<300); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using several derived tables : pushing only in one table --echo # extracted and formula : pushing into WHERE --echo # conjunctive subformula : pushing into WHERE using equalities --echo # pushing equalities -let $query= +let $query= select * from v1,v2,t2 where (v1.a=1) and (v1.b>10) and (v1.b=v2.b); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # extracted or formula : pushing into WHERE --echo # conjunctive subformula : pushing into WHERE using equalities --echo # pushing equalities -let $query= - select * from v_char as v,t2_char as t where +let $query= + select * from v_char as v,t2_char as t where (v.a=t.a) and (t.a='b') and ((v.b='Vika') or (v.b='Ali')); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using several derived tables : pushing in all tables --echo # extracted or formula : pushing into WHERE ---echo # conjunctive subformulas : pushing into HAVING +--echo # conjunctive subformulas : pushing into HAVING --echo # pushing equalities -let $query= - select * from v1,v2,v3,t2 where - ((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) +let $query= + select * from v1,v2,v3,t2 where + ((v1.a=v2.a) or (v1.a=t2.a)) and ((v3.b<50) or (v3.b=33)) and (v1.max_c<500) and (v3.a=t2.a) and (v2.max_c>300); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using several derived tables : pushing in all tables ---echo # conjunctive subformulas : pushing into HAVING -let $query= +--echo # conjunctive subformulas : pushing into HAVING +let $query= select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 where t1.a>5 group by a,b having max_c < 707) v1, @@ -532,11 +532,11 @@ let $query= eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using several derived tables : pushing in all tables --echo # extracted or formulas : pushing into HAVING ---echo # conjunctive subformula : pushing into HAVING +--echo # conjunctive subformula : pushing into HAVING let $query= select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 @@ -550,51 +550,51 @@ let $query= eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - +eval explain format=json $query; + --echo # extracted or formula : pushing into HAVING ---echo # conjunctive subformula : pushing into WHERE -let $query= +--echo # conjunctive subformula : pushing into WHERE +let $query= select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 - group by a,b having max_c < 707) v1, - t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); + group by a,b having max_c < 707) v1, + t2 where ((v1.a=1) or (v1.max_c<300)) and (v1.b>25); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - +eval explain format=json $query; + --echo # extracted and formula : pushing into WHERE ---echo # conjunctive subformula : pushing into HAVING -let $query= +--echo # conjunctive subformula : pushing into HAVING +let $query= select * from (select a, b, max(c) as max_c, avg(c) as avg_c from t1 - where t1.a>5 group by a,b having max_c < 707) v1, - t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); + where t1.a>5 group by a,b having max_c < 707) v1, + t2 where (v1.a=t2.a) and (v1.max_c>300) and (v1.b<30); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using query with union --echo # conjunctive subformula : pushing into WHERE --echo # conjunctive subformulas : pushing into HAVING and WHERE -let $query= +let $query= select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (t2.c>800) union - select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); + select * from v1,t2 where (v1.max_c>100) and (v1.a>7) and (t2.d>800); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using query with union ---echo # extracted and formula : pushing into WHERE ---echo # extracted or formula : pushing into HAVING +--echo # extracted and formula : pushing into WHERE +--echo # extracted or formula : pushing into HAVING --echo # pushing equalities -let $query= +let $query= select * from v1,t2 where (v1.a<5) and (v1.b=t2.b) and (v1.b=19) - union + union select * from v1,t2 where ((v1.max_c>400) or (v1.avg_c>270)) and (v1.a3) and (v1.b>27)) or (v1.max_c>550); + select * from v1,t2 where ((v1.a>3) and (v1.b>27)) or (v1.max_c>550); eval $no_pushdown $query; eval $query; eval explain $query; eval explain format=json $query; --echo # using query with union ---echo # extracted or formula : pushing into HAVING ---echo # conjunctive subformulas : pushing into WHERE +--echo # extracted or formula : pushing into HAVING +--echo # conjunctive subformulas : pushing into WHERE --echo # pushing equalities -let $query= - select * from v1,t2 where +let $query= + select * from v1,t2 where ((v1.a=1) and (v1.a=t2.a)) and ((v1.max_c<500) or (v1.avg_c>500)) union select * from v2,t2 where @@ -643,8 +643,8 @@ eval explain format=json $query; --echo # using derived table with union --echo # conjunctive subformula : pushing into WHERE ---echo # extracted or formula : pushing into HAVING -let $query= +--echo # extracted or formula : pushing into HAVING +let $query= select * from v_union,t2 where ((v_union.a<2) or (v_union.c>800)) and (v_union.b>12); eval $no_pushdown $query; @@ -656,7 +656,7 @@ eval explain format=json $query; --echo # conjunctive subformula : pushing into HAVING --echo # conjunctive subformula : pushing into WHERE --echo # pushing equalities -let $query= +let $query= select * from v_union,t2 where (v_union.a=1) and (v_union.a=t2.a) and (v_union.c<200); eval $no_pushdown $query; @@ -664,221 +664,1446 @@ eval $query; eval explain $query; eval explain format=json $query; -let $query= - select * from v_char as v,t2_char as t where +let $query= + select * from v_char as v,t2_char as t where (v.a=t.a) and (v.b='Vika') and (v.max_c>2); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - ---echo # using derived table with union ---echo # using several derived tables : pushing in all tables ---echo # conjunctive subformula : pushing into WHERE using equalities ---echo # pushing equalities -let $query= - select * from v_union,v1,t2 where - (v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) - and ((v_union.c>800) or (v1.max_c>200)); -eval $no_pushdown $query; -eval $query; -eval explain $query; eval explain format=json $query; ---echo # using derived table with union ---echo # extracted or formula : pushing into WHERE +--echo # using derived table with union +--echo # using several derived tables : pushing in all tables +--echo # conjunctive subformula : pushing into WHERE using equalities +--echo # pushing equalities +let $query= + select * from v_union,v1,t2 where + (v_union.a=v1.a) and (v1.a=t2.a) and (t2.a=1) + and ((v_union.c>800) or (v1.max_c>200)); +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +--echo # using derived table with union +--echo # extracted or formula : pushing into WHERE --echo # conjunctive subformula : pushing into HAVING --echo # pushing equalities -let $query= - select * from v2_union as v,t2 where +let $query= + select * from v2_union as v,t2 where ((v.a=6) or (v.a=8)) and (v.c>200) and (v.a=t2.a); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using derived table with union of selects without aggregation --echo # extracted conjunctive predicate: pushing in WHERE of both selects -let $query= +let $query= select * from v3_union as v,t2 where (v.a=t2.a) and (v.c>6); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using derived table with union of selects without aggregation --echo # extracted conjunctive OR subformula: pushing in WHERE using equalities -let $query= +let $query= select * from v3_union as v,t2 where (v.a=t2.a) and ((t2.a>1) or (v.b<20)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using derived table with union of selects without aggregation --echo # extracted the whole condition: in WHERE of both selects -let $query= - select * from v3_union as v,t2 where +let $query= + select * from v3_union as v,t2 where (v.a=t2.a) and ((v.b=19) or (v.b=21)) and ((v.c<3) or (v.c>600)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; ---echo # using derived table with union of +--echo # using derived table with union of --echo # a select without aggregation and a select with aggregation --echo # extracted conjunctive predicate: pushing in WHERE of both selects -let $query= +let $query= select * from v4_union as v,t2 where (v.a=t2.a) and (v.b<20); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; ---echo # using derived table with union of +--echo # using derived table with union of --echo # a select without aggregation and a select with aggregation --echo # extracted subformula: pushing in WHERE of one select --echo # extracted subformula: pushing in HAVING of the other select --echo # extracted sub-subformula: pushing in WHERE of the other select --echo # using an equality in all pushdowns -let $query= - select * from v4_union as v,t2 where +let $query= + select * from v4_union as v,t2 where (v.a=t2.a) and ((t2.a<3) or (v.b<40)) and (v.c>500); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using embedded derived table : pushing the same conditions --echo # using several derived tables : pushing in all tables --echo # conjunctive subformula : pushing into WHERE --echo # extracted and formula : pushing into WHERE -let $query= +let $query= select * from v4,v1 where - (v4.a<13) and (v1.a>5) and (v1.b>12); + (v4.a<13) and (v1.a>5) and (v1.b>12); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using embedded view : nothing to push --echo # using several derived tables : pushing only in one table --echo # conjunctive subformula : pushing into WHERE -let $query= +let $query= select * from v4,v1,t2 where (v4.a=t2.a) and (v4.a=v1.a) and (v1.b>30); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using embedded view : pushing different conditions --echo # using several derived tables : pushing in all tables --echo # conjunctive subformula : pushing into WHERE using equalities --echo # extracted and formula : pushing into WHERE using equalities --echo # conjunctive subformula : pushing into HAVING -let $query= +let $query= select * from v4,v1,t2 where - (v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); + (v4.a=t2.a) and (v4.a>1) and (v4.a=v1.a) and (v4.min_c>100) and (v1.b<30); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using embedded view : pushing different conditions --echo # using several derived tables : pushing in all tables --echo # extracted or formula : pushing into WHERE --echo # conjunctive subformula : pushing into HAVING -let $query= +let $query= select * from v4,v1,t2 where (((v4.b>10) and (v4.a>1)) or (v4.b<20)) and (v1.max_c>200) and (v1.a=v4.a); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - +eval explain format=json $query; + --echo # using embedded view : pushing different conditions --echo # using several derived tables : pushing only in one table --echo # extracted or formula : pushing into WHERE --echo # extracted or formula : pushing into HAVING -let $query= +let $query= select * from v4,v2 where ((v4.a>12) and (v4.min_c<300) and (v4.b>13)) or (v4.a<1); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - +eval explain format=json $query; + --echo # using embedded view : pushing different conditions --echo # using several derived tables : pushing only in one table --echo # conjunctive subformula : pushing into WHERE --echo # conjunctive subformula : pushing into HAVING --echo # pushing equalities -let $query= +let $query= select * from v4,v2 where - (v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); + (v4.a=v2.b) and (v4.a=v4.b) and (v4.min_c<100); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - +eval explain format=json $query; + --echo # using embedded view : pushing the same conditions --echo # using several derived tables : pushing in all tables --echo # extracted and formula : pushing into WHERE using equalities --echo # conjunctive subformula : pushing into WHERE --echo # pushing equalities -let $query= +let $query= select * from v4,v2 where - (v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); + (v4.a=v2.b) and (v4.a=v4.b) and (v2.b<30); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using embedded view : pushing the same conditions --echo # using several derived tables : pushing in all tables --echo # extracted or formula : pushing into WHERE using equalities --echo # extracted and formula : pushing into WHERE using equalities --echo # pushing equalities -let $query= +let $query= select * from v4,v2 where (v4.a=v2.b) and (v4.a=v4.b) and ((v2.b<30) or (v4.a>2)); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; - +eval explain format=json $query; + --echo # using embedded view : pushing the same conditions --echo # using several derived tables : pushing in all tables --echo # extracted or formula : pushing into WHERE --echo # conjunctive subformula : pushing into WHERE ---echo # pushing equalities -let $query= +--echo # pushing equalities +let $query= select * from v4,v2 where (((v4.a<12) and (v4.b>13)) or (v4.a>10)) and (v4.min_c=v2.max_c) and (v4.min_c>100); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; --echo # using embedded view : pushing the same conditions --echo # using several derived tables : pushing only in one table --echo # extracted or formula : pushing into WHERE -let $query= +let $query= select * from v4,v2,t2 where (((v4.a<12) and (t2.b>13)) or (v4.a>10)) and (v4.min_c=t2.c) and (t2.c>100); eval $no_pushdown $query; eval $query; eval explain $query; -eval explain format=json $query; +eval explain format=json $query; drop view v1,v2,v3,v4; drop view v_union,v2_union,v3_union,v4_union; drop view v_double,v_char,v_decimal; drop table t1,t2,t1_double,t2_double,t1_char,t2_char,t1_decimal,t2_decimal; +--echo # +--echo # MDEV-10782: condition extracted from a multiple equality +--echo # pushed into HAVING +--echo # + +CREATE TABLE t1 (i int); +INSERT INTO t1 VALUES (1),(2); +EXPLAIN EXTENDED +SELECT * + FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 + WHERE f = 8; +SELECT * + FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 + WHERE f = 8; +SELECT * + FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 + WHERE f = 1; +DROP TABLE t1; + +--echo # +--echo # MDEV-10783: pushdown into constant view +--echo # + +CREATE TABLE t1 (i int) ENGINE=MyISAM; +CREATE VIEW v AS SELECT 5; +SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v ); +DROP VIEW v; +DROP TABLE t1; + +--echo # +--echo # MDEV-10785: second execution of a query with condition +--echo # pushed into view +--echo # + +CREATE TABLE t1 (i int); +CREATE VIEW v1 AS SELECT i FROM t1 WHERE i < 5; +CREATE FUNCTION f (in1 int) RETURNS int RETURN in1; +CREATE VIEW v2 AS SELECT * FROM v1 GROUP BY i; +PREPARE stmt FROM "SELECT * FROM v2 WHERE f(0) <> 2"; +EXECUTE stmt; +EXECUTE stmt; +DROP FUNCTION f; +DROP VIEW v2,v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-10884: condition pushdown into derived specified by +--echo # 1. unit with SELECT containing ORDER BY ... LIMIT +--echo # 2. unit containing global ORDER BY ... LIMIT +--echo # + +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +select a from t1 order by a limit 5; + +set statement optimizer_switch='condition_pushdown_for_derived=off' for +select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); +set statement optimizer_switch='condition_pushdown_for_derived=on' for +select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); + +select a from t1 where a < 4 union select a from t1 where a > 5 + order by a limit 5; +set statement optimizer_switch='condition_pushdown_for_derived=off' for +select * from +(select a from t1 where a < 4 union select a from t1 where a > 5 + order by a limit 5) t where t.a not in (2,9); +set statement optimizer_switch='condition_pushdown_for_derived=on' for +select * from +(select a from t1 where a < 4 union select a from t1 where a > 5 + order by a limit 5) t where t.a not in (2,9); + +drop table t1; + +--echo # +--echo # MDEV-11072: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; +CREATE TABLE t3 (c INT) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; + +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +INSERT INTO t1 VALUES (2); +INSERT INTO t2 VALUES (3), (2); +INSERT INTO t3 VALUES (4), (1), (2), (7); + +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +EXPLAIN FORMAT=JSON +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT c FROM v3 WHERE c = a + ) +); + +CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM; +INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE OR REPLACE VIEW v4 AS +SELECT d, sum(e) AS s FROM t4 GROUP BY d; + +let $query = +SELECT * FROM t1 WHERE a IN ( + SELECT b FROM v2 WHERE b < a OR b IN ( + SELECT d FROM v4 WHERE s > a + ) +); + +eval $no_pushdown $query; +eval $query; +eval explain $query; +eval explain format=json $query; + +DROP VIEW v2,v3,v4; +DROP TABLE t1,t2,t3,t4; + +--echo # +--echo # MDEV-10800: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1); + +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM +( SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; + +EXPLAIN FORMAT=JSON +SELECT * FROM +( SELECT * FROM t1 + WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11102: condition pushdown into materialized inner table +--echo # of outer join is not applied as not being valid +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (0),(2); + +CREATE TABLE t2 (b INT); +INSERT INTO t2 VALUES (1),(2); + +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL; + +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; + +EXPLAIN FORMAT=JSON +SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11103: pushdown condition with ANY subquery +--echo # + +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1),(2); + +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); + +SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-11315: condition with outer reference to mergeable derived +--echo # + +CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (10,7,1),(11,0,2); + +CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM; +INSERT INTO t2 VALUES + (1,4,'2008-09-27 00:34:58'), + (2,5,'2007-05-28 00:00:00'), + (3,6,'2009-07-25 09:21:20'); + +CREATE VIEW v1 AS SELECT * FROM t1; +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +SELECT * FROM v1 AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN FORMAT=JSON +SELECT * FROM v1 AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; + +SELECT * FROM ( SELECT * FROM t1 ) AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT * FROM t1 ) AS sq + WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; + +DROP VIEW v1,v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11313: pushdown of the condition obtained +--echo # after constant row substitution +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE TABLE t2 (b INT) ENGINE=MyISAM; +INSERT INTO t2 VALUES (50); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; + +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; + +CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM; +INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); +CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ; +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; +EXPLAIN FORMAT=JSON +SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; + + +DROP VIEW v1,v2; +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-10882: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM; +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (1,2),(3,4); + +CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM; +INSERT INTO t2 VALUES (5),(6); + +SELECT a, GROUP_CONCAT(b) FROM v1 + WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; + +EXPLAIN FORMAT=JSON +SELECT a, GROUP_CONCAT(b) FROM v1 + WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; + +DROP VIEW v1; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-10836: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM; +CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; +INSERT INTO t VALUES (1,1),(3,2); + +SELECT * FROM v AS v1, v AS v2 + WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); + +EXPLAIN FORMAT=JSON +SELECT * FROM v AS v1, v AS v2 + WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); + +DROP VIEW v; +DROP TABLE t; + +--echo # +--echo # MDEV-11488: pushdown of the predicate with cached value +--echo # + +CREATE TABLE t1 (i INT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(3),(2); + +CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3),(4); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +UPDATE t2 SET j = 2 WHERE j = 3; +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.2),(2.71); + +CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.2),(2.71); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1.5),(3.21),(2.47); + +CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES (3.21),(4.55); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('cc'),('aa'),('ddd'); + +CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('bbb'),('aa'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES + ('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20'); + +CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES + ('2007-05-28 00:00:00'), ('2010-08-25 00:00:00'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i DATE) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25'); + +CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +CREATE TABLE t1 (i TIME) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20'); + +CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM; +INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10'); + +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); +EXPLAIN FORMAT=JSON +SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq + WHERE i IN ( SELECT MIN(j) FROM t2 ); + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11593: pushdown of condition with NULLIF +--echo # + +CREATE TABLE t1 (i INT); +CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; + +INSERT INTO t1 VALUES (2), (1); + +SELECT * FROM v1 WHERE NULLIF(1, i); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE NULLIF(1, i); + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-11608: pushdown of the predicate with cached null value +--echo # + +CREATE TABLE t1 (c VARCHAR(3)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES ('foo'),('bar'); + +CREATE TABLE t2 (c VARCHAR(3)); +INSERT INTO t2 VALUES ('foo'),('xyz'); + +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); +EXPLAIN FORMAT=JSON +SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); + +DROP VIEW v1; +DROP TABLE t1,t2; + +CREATE TABLE t1 (d DECIMAL(10,2)); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +INSERT INTO t1 VALUES (5.37),(1.1); + +CREATE TABLE t2 (d DECIMAL(10,2)); +INSERT INTO t2 VALUES ('1.1'),('2.23'); + +SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 ); + +DROP VIEW v1; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-11820: second execution of PS for query +--echo # with false subquery predicate in WHERE +--echo # + +CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('foo'),('bar'); +CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; +CREATE TABLE t2 (a INT); +INSERT INTO t2 VALUES (3), (4); + +PREPARE stmt1 FROM +" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; +PREPARE stmt2 FROM +"EXPLAIN FORMAT=JSON + SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; +EXECUTE stmt1; +EXECUTE stmt2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +INSERT INTO t2 SELECT a+1 FROM t2; +EXECUTE stmt1; +EXECUTE stmt2; +DEALLOCATE PREPARE stmt1; +# the result here will change after the merge with the fix for mdev-11859 +DEALLOCATE PREPARE stmt2; + +DROP VIEW v1; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-12373: pushdown into derived with side effects is prohibited +--echo # + +CREATE TABLE sales_documents ( + id int NOT NULL AUTO_INCREMENT, + sale_id int NULL DEFAULT NULL, + type tinyint unsigned NULL DEFAULT NULL, + data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci', + date date NULL DEFAULT NULL, + order_number int unsigned NULL DEFAULT NULL, + created_at int NULL DEFAULT NULL, + updated_at int NULL DEFAULT NULL, + generated tinyint NOT NULL DEFAULT '0', + synced_at int NOT NULL DEFAULT '0', + sum decimal(13,2) NOT NULL DEFAULT '0', + PRIMARY KEY (id) +); + +INSERT INTO sales_documents +(id, sale_id, type, order_number, data, created_at, + updated_at, date, generated, synced_at, sum) +VALUES +(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00), +(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00), +(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00), +(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00), +(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00), +(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00), +(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00), +(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00), +(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00), +(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00), +(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00), +(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00), +(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00), +(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00), +(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00), +(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00), +(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00), +(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00), +(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00), +(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00), +(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00), +(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00), +(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00), +(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00), +(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00), +(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00), +(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00), +(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00), +(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00), +(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00), +(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00), +(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00), +(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00), +(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00), +(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00), +(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00), +(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00), +(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00), +(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00), +(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00), +(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00), +(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00), +(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00), +(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00), +(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00), +(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00), +(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00), +(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00), +(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00), +(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00), +(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00), +(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00), +(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00), +(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75), +(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00), +(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00), +(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00), +(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00), +(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00), +(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00); + +SELECT * FROM +(SELECT @row := @row + 1 as row, a.* from ( + SELECT t.order_number + FROM sales_documents t + WHERE + t.type = 2 AND + t.date >= '2017-01-01' AND + t.date <= '2017-12-31' AND + t.order_number IS NOT NULL AND + t.generated = 1 + GROUP BY t.order_number +) a, (SELECT @row := 0) r) t +WHERE row <> order_number; + +DROP TABLE sales_documents; + +--echo # +--echo # MDEV-12845: pushdown from merged derived using equalities +--echo # + +create table t1 (a int); +insert into t1 values + (4), (8), (5), (3), (10), (2), (7); + +create table t2 (b int, c int); +insert into t2 values + (2,1), (5,2), (2,2), (4,1), (4,3), + (5,3), (2,4), (4,6), (2,1); + +create view v1 as +select b, sum(c) as s from t2 group by b; + +create view v2 as +select distinct b, c from t2; + +create view v3 as +select b, max(c) as m from t2 group by b; + +let $q1= +select b +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where b > 2; + +eval $q1; +eval explain format=json $q1; + +let $q2= +select a +from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t +where a > 2; + +eval $q2; +eval explain format=json $q2; + +let $q3= +select a +from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t +where a > 2; + +eval $q3; +eval explain format=json $q3; + +let $q4= +select a +from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t +where a > 2; + +eval $q4; +eval explain format=json $q4; + +drop view v1,v2,v3; +drop table t1,t2; + +--echo # +--echo # MDEV-13166: pushdown from merged derived +--echo # + +CREATE TABLE t1 (i int) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); +CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1; + +let $q= +SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; + +eval $q; +eval explain format=json $q; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-13193: pushdown of equality extracted from multiple equality +--echo # + +CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1),(2); + +CREATE TABLE t2 (i2 int) ENGINE=MyISAM; +INSERT INTO t2 VALUES (2),(4); + +CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; + +let $q= +SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq + WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); + +eval $q; +eval explain format=json $q; + +DROP VIEW v2; +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-14237: derived with regexp_substr() in select list +--echo # + +create table t1 (a char(8)); +insert into t1 values ('b'), ('a'), ('xx'); + +let $q= +select * +from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t +where t.f = 'a' or t.f = 'b'; + +eval $q; +eval explain format=json $q; + +drop table t1; + +--echo # +--echo # MDEV-13454: consequence of mdev-14368 fixed for 5.5 +--echo # + +SET sql_mode = 'ONLY_FULL_GROUP_BY'; + +create table t1 (id int, id2 int); +insert into t1 values (1,1),(2,3),(3,4),(7,2); + +create table t2(id2 int); +insert t2 values (1),(2),(3); + +let $q= +SELECT * FROM t1 + LEFT OUTER JOIN + (SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) +WHERE (vc.ct>0); + +eval $q; +eval EXPLAIN FORMAT=JSON $q; + +DROP TABLE t1,t2; + +SET sql_mode = DEFAULT; + +--echo # +--echo # MDEV-15579: incorrect removal of sub-formulas to be pushed +--echo # into WHERE of materialized derived with GROUP BY +--echo # + +CREATE TABLE t1 (a INT, b INT, c INT, d INT); +CREATE TABLE t2 (x INT, y INT, z INT); + +INSERT INTO t1 VALUES (1,1,66,1), (1,1,56,2), (3,2,42,3); +INSERT INTO t2 VALUES (1,1,66), (1,12,32); + +let $query= +SELECT * +FROM t2, +( + SELECT a, b, max(c) AS max_c + FROM t1 + GROUP BY a + HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND + (v1.a=t2.x) AND (v1.max_c>30); +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * +FROM t2, +( + SELECT a, b, d, max(c) AS max_c + FROM t1 + GROUP BY a,d + HAVING max_c > 37 +) AS v1 +WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND + (v1.a=t2.x) AND (v1.max_c>30); +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-15765: pushing condition with temporal constants +--echo # into constant tables +--echo # + +select * from (select date('2018-01-01') as d + union all + select date('2018-01-01') as d) as t + where t.d between date ('2017-01-01') and date ('2019-01-01'); + +select * from (select date('2018-01-01') as d) as t + where t.d between date ('2017-01-01') and date ('2019-01-01'); + +--echo # +--echo # MDEV-16088: pushdown into derived defined in the IN subquery +--echo # + +CREATE TABLE t1 (a INT, b INT); +CREATE TABLE t2 (e INT, f INT, g INT); +INSERT INTO t1 VALUES (1,14),(2,13),(1,19),(2,32),(3,24); +INSERT INTO t2 VALUES (1,19,2),(3,24,1),(1,12,2),(3,11,3),(2,32,1); + +let $query= +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN + ( + SELECT d_tab.e,d_tab.max_f + FROM ( + SELECT t2.e, MAX(t2.f) AS max_f + FROM t2 + GROUP BY t2.e + HAVING max_f>18 + ) as d_tab + WHERE d_tab.e>1 + ) +; +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN + ( + SELECT d_tab.e,d_tab.max_f + FROM ( + SELECT t2.e, MAX(t2.f) AS max_f + FROM t2 + GROUP BY t2.e + HAVING max_f>18 + ) as d_tab + WHERE d_tab.max_f<25 + ) +; +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN + ( + SELECT d_tab.e, MAX(d_tab.max_f) AS max_f + FROM ( + SELECT t2.e, MAX(t2.f) as max_f, t2.g + FROM t2 + GROUP BY t2.e + ) as d_tab + WHERE d_tab.e>1 + GROUP BY d_tab.g + ) +; +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM t1 +WHERE (t1.a,t1.b) IN + ( + SELECT d_tab.e, MAX(d_tab.max_f) AS max_f + FROM ( + SELECT t2.e, MAX(t2.f) as max_f, t2.g + FROM t2 + GROUP BY t2.e + ) as d_tab + WHERE d_tab.max_f>20 + GROUP BY d_tab.g + ) +; +eval $query; +eval EXPLAIN $query; +eval EXPLAIN FORMAT=JSON $query; + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-15765: pushing condition with IN subquery defined with constants +--echo # using substitution +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM +( + SELECT DISTINCT * FROM t1 +) der_tab +WHERE (a>0 AND a<2 OR a IN (2,3)) AND + (a=2 OR 0); + +DROP TABLE t1; + +--echo # +--echo # MDEV-16386: pushing condition into the HAVING clause when ambiguous +--echo # fields warning appears +--echo # + +CREATE TABLE t1 (a INT, b INT); + +INSERT INTO t1 VALUES (1,2),(2,3),(3,4); + +let $query= +SELECT * FROM +( + SELECT t1.b AS a + FROM t1 + GROUP BY t1.a +) dt +WHERE (dt.a=2); +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM +( + SELECT t1.b AS a + FROM t1 + GROUP BY t1.a + HAVING (t1.a<3) +) dt +WHERE (dt.a>1); +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM +( + SELECT 'ab' AS a + FROM t1 + GROUP BY t1.a +) dt +WHERE (dt.a='ab'); +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM +( + SELECT 1 AS a + FROM t1 + GROUP BY t1.a +) dt +WHERE (dt.a=1); +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +DROP TABLE t1; + +--echo # +--echo # MDEV-16517: pushdown condition with the IN predicate defined +--echo # with non-constant values +--echo # + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(1,3); + +let $query= +SELECT * FROM +( + SELECT t1.a + FROM t1 + WHERE 1 IN (0,t1.a) + GROUP BY t1.a +) AS dt1 +JOIN +( + SELECT t1.a + FROM t1 + WHERE 1 IN (0,t1.a) +) AS dt2 +ON dt1.a = dt2.a; +eval $query; +eval EXPLAIN FORMAT=JSON $query; + +let $query= +SELECT * FROM +( + SELECT t1.a,MAX(t1.b) + FROM t1 + GROUP BY t1.a +) AS dt, t1 +WHERE dt.a=t1.a AND dt.a IN (1,t1.a); +eval $query; +eval EXPLAIN FORMAT=JSON $query; +DROP TABLE t1; + +--echo # +--echo # MDEV-15087: error from inexpensive subquery before check +--echo # for condition pushdown into derived +--echo # + +CREATE TABLE t1 (i1 int, v1 varchar(1)); +INSERT INTO t1 VALUES (7,'x'); + +CREATE TABLE t2 (i1 int); +INSERT INTO t2 VALUES (8); + +CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1)); +INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL); + +--error ER_SUBQUERY_NO_1_ROW +SELECT 1 +FROM (t1 AS a1 + JOIN (((SELECT DISTINCT t3.* + FROM t3) AS a2 + JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1)) +WHERE (SELECT BIT_COUNT(t2.i1) + FROM (t2 JOIN t3)) IS NULL; + +DROP TABLE t1, t2, t3; + +--echo # +--echo # MDEV-16614 signal 7 after calling stored procedure, that uses regexp +--echo # + +DELIMITER $$; +CREATE PROCEDURE p1(m1 varchar(5), m2 varchar(5)) +BEGIN +SELECT a FROM + (SELECT "aa" a) t + JOIN (SELECT "aa" b) t1 on t.a=t1.b +WHERE t.a regexp m1 and t1.b regexp m2 +GROUP BY a; +END$$ +DELIMITER ;$$ +CALL p1('a','a'); +DROP PROCEDURE p1; + + +DELIMITER $$; +CREATE PROCEDURE p1(m1 varchar(5)) +BEGIN + SELECT a FROM (SELECT "aa" a) t WHERE t.a regexp m1; +END$$ +DELIMITER ;$$ +CALL p1('a'); +DROP PROCEDURE p1; + + +SELECT a FROM (SELECT "aa" a) t WHERE REGEXP_INSTR(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); + + +DELIMITER $$; +CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT +BEGIN + RETURN 1; +END;$$ +CREATE OR REPLACE PROCEDURE p1(m1 varchar(5)) +BEGIN + SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, m1); +END$$ +DELIMITER ;$$ +CALL p1('a'); +DROP PROCEDURE p1; +DROP FUNCTION f1; + + +DELIMITER $$; +CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT +BEGIN + RETURN 1; +END;$$ +DELIMITER ;$$ +SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); +DROP FUNCTION f1; + +--echo # +--echo # MDEV-17011: condition pushdown into materialized derived used +--echo # in INSERT SELECT, multi-table UPDATE and DELETE +--echo # + +CREATE TABLE t1 (a int ,b int) ENGINE=MyISAM; +INSERT INTO t1 VALUES + (1, 1), (1, 2), (2, 1), (2, 2), (3,1), (3,3), (4,2); + +CREATE TABLE t2 (a int) ENGINE MYISAM; +INSERT INTO t2 VALUES + (3), (7), (1), (4), (1); + +CREATE TABLE t3 (a int, b int) ENGINE MYISAM; + +let $q1= +INSERT INTO t3 +SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; + +eval EXPLAIN FORMAT=JSON $q1; +eval $q1; + +SELECT * FROM t3; + +let $q2= +UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 + WHERE t2.a= t.c and t.a>=3; + +eval EXPLAIN FORMAT=JSON $q2; +eval $q2; + +SELECT * FROM t2; + +let $q3= +DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t + WHERE t2.a= t.c+9 and t.a=2; + +eval EXPLAIN FORMAT=JSON $q3; +eval $q3; + +SELECT * FROM t2; + +DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-16765: pushdown condition with the CASE structure +--echo # defined with Item_cond item +--echo # + +CREATE TABLE t1(a INT, b INT); +INSERT INTO t1 VALUES (1,2), (3,4), (2,3); + +LET $query= +SELECT * +FROM +( + SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) + THEN 1 ELSE 0 END AS max_a,b + FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EVAL $query; +EVAL EXPLAIN FORMAT=JSON $query; + +LET $query= +SELECT * +FROM +( + SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) + THEN 1 ELSE 0 END AS max_a,b + FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EVAL $query; +EVAL EXPLAIN FORMAT=JSON $query; + +LET $query= +SELECT * +FROM +( + SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) + THEN 1 ELSE 0 END AS max_a,b + FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EVAL $query; +EVAL EXPLAIN FORMAT=JSON $query; + +LET $query= +SELECT * +FROM +( + SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) + THEN 1 ELSE 0 END AS max_a,b + FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 +) AS tab1 +WHERE (tab1.max_a=1); +EVAL $query; +EVAL EXPLAIN FORMAT=JSON $query; + +DROP TABLE t1; + +--echo # +--echo # MDEV-16803: pushdown condition with IN predicate in the derived table +--echo # defined with several SELECT statements +--echo # + +CREATE TABLE t1 (a INT, b INT); +INSERT INTO t1 VALUES (1,2),(3,2),(1,1); + +SELECT * FROM +( + SELECT a,b,1 as c + FROM t1 + UNION ALL + SELECT a,b,2 as c + FROM t1 +) AS tab +WHERE ((a,b) IN ((1,2),(3,2))); + +DROP TABLE t1; + +--echo # +--echo # MDEV-17354: INSERT SELECT with condition pushdown into derived +--echo # + +CREATE TABLE t1 (f INT NOT NULL); +INSERT INTO t1 VALUES (3), (7), (3); + +CREATE ALGORITHM= TEMPTABLE VIEW v1 AS SELECT * FROM ( SELECT * FROM t1 ) AS sq; + +let $q1= +INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ) AS t WHERE f IS NOT NULL; + +eval $q1; +eval EXPLAIN $q1; +eval EXPLAIN FORMAT=JSON $q1; +SELECT * FROM t1; + +DELETE FROM t1; +INSERT INTO t1 VALUES (3), (7), (3); + +let $q2= +INSERT INTO t1 +SELECT * FROM ( SELECT t1.f FROM v1 JOIN t1 ON v1.f=t1.f) AS t + WHERE f IS NOT NULL; + +eval $q2; +eval EXPLAIN FORMAT=JSON $q2; +SELECT * FROM t1; + +DROP VIEW v1; +DROP TABLE t1; + +--echo # +--echo # MDEV-17574: pushdown into derived from mergeable view +--echo # used in multi-table UPDATE +--echo # pushdown into materialized derived from mergeable view +--echo # used in SELECT +--echo # + +CREATE TABLE t1 (f1 text, f2 int); +INSERT INTO t1 VALUES ('x',1), ('y',2); + +CREATE VIEW v1 AS SELECT f2 FROM ( SELECT f2 FROM t1 ) AS t; +let $q1 = +UPDATE v1, t1 SET t1.f1 = 'z' WHERE v1.f2 < 2 AND t1.f2 = v1.f2; +eval $q1; +eval EXPLAIN FORMAT=JSON $q1; + +SELECT * FROM t1; + +CREATE VIEW v2 AS SELECT f2 FROM ( SELECT DISTINCT f2 FROM t1 ) AS t; +let $q2 = +SELECT * FROM v2, t1 WHERE v2.f2 < 2 AND t1.f2 = v2.f2; +eval $q2; +eval EXPLAIN FORMAT=JSON $q2; + +DROP VIEW v1,v2; +DROP TABLE t1; + +--echo # End of 10.2 tests + --echo # --echo # MDEV-14579: pushdown conditions into materialized views/derived tables --echo # that are defined with EXIST or/and INTERSECT @@ -1454,980 +2679,17 @@ alter table t3 drop index i1; drop table t1,t2,t3; --echo # ---echo # MDEV-10782: condition extracted from a multiple equality ---echo # pushed into HAVING ---echo # - -CREATE TABLE t1 (i int); -INSERT INTO t1 VALUES (1),(2); -EXPLAIN EXTENDED -SELECT * - FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 - WHERE f = 8; -SELECT * - FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 - WHERE f = 8; -SELECT * - FROM ( SELECT * FROM ( SELECT MIN(i) as f FROM t1 ) sq1 ) AS sq2 - WHERE f = 1; -DROP TABLE t1; - ---echo # ---echo # MDEV-10783: pushdown into constant view ---echo # - -CREATE TABLE t1 (i int) ENGINE=MyISAM; -CREATE VIEW v AS SELECT 5; -SELECT * FROM t1 WHERE 1 IN ( SELECT * FROM v ); -DROP VIEW v; -DROP TABLE t1; - ---echo # ---echo # MDEV-10785: second execution of a query with condition ---echo # pushed into view ---echo # - -CREATE TABLE t1 (i int); -CREATE VIEW v1 AS SELECT i FROM t1 WHERE i < 5; -CREATE FUNCTION f (in1 int) RETURNS int RETURN in1; -CREATE VIEW v2 AS SELECT * FROM v1 GROUP BY i; -PREPARE stmt FROM "SELECT * FROM v2 WHERE f(0) <> 2"; -EXECUTE stmt; -EXECUTE stmt; -DROP FUNCTION f; -DROP VIEW v2,v1; -DROP TABLE t1; - ---echo # ---echo # MDEV-10884: condition pushdown into derived specified by ---echo # 1. unit with SELECT containing ORDER BY ... LIMIT ---echo # 2. unit containing global ORDER BY ... LIMIT ---echo # - -create table t1(a int); -insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); -select a from t1 order by a limit 5; - -set statement optimizer_switch='condition_pushdown_for_derived=off' for -select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); -set statement optimizer_switch='condition_pushdown_for_derived=on' for -select * from (select a from t1 order by a limit 5) t where t.a not in (1,2,3); - -select a from t1 where a < 4 union select a from t1 where a > 5 - order by a limit 5; -set statement optimizer_switch='condition_pushdown_for_derived=off' for -select * from -(select a from t1 where a < 4 union select a from t1 where a > 5 - order by a limit 5) t where t.a not in (2,9); -set statement optimizer_switch='condition_pushdown_for_derived=on' for -select * from -(select a from t1 where a < 4 union select a from t1 where a > 5 - order by a limit 5) t where t.a not in (2,9); - -drop table t1; - ---echo # ---echo # MDEV-11072: pushdown of the condition obtained ---echo # after constant row substitution ---echo # - -CREATE TABLE t1 (a INT) ENGINE=MyISAM; -CREATE TABLE t2 (b INT) ENGINE=MyISAM; -CREATE OR REPLACE VIEW v2 AS SELECT * FROM t2; -CREATE TABLE t3 (c INT) ENGINE=MyISAM; -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v3 AS SELECT * FROM t3; - -SELECT * FROM t1 WHERE a IN ( - SELECT b FROM v2 WHERE b < a OR b IN ( - SELECT c FROM v3 WHERE c = a - ) -); - -INSERT INTO t1 VALUES (2); -INSERT INTO t2 VALUES (3), (2); -INSERT INTO t3 VALUES (4), (1), (2), (7); - -SELECT * FROM t1 WHERE a IN ( - SELECT b FROM v2 WHERE b < a OR b IN ( - SELECT c FROM v3 WHERE c = a - ) -); - -EXPLAIN FORMAT=JSON -SELECT * FROM t1 WHERE a IN ( - SELECT b FROM v2 WHERE b < a OR b IN ( - SELECT c FROM v3 WHERE c = a - ) -); - -CREATE TABLE t4 (d INT, e INT) ENGINE=MyISAM; -INSERT INTO t4 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); -CREATE OR REPLACE VIEW v4 AS -SELECT d, sum(e) AS s FROM t4 GROUP BY d; - -let $query = -SELECT * FROM t1 WHERE a IN ( - SELECT b FROM v2 WHERE b < a OR b IN ( - SELECT d FROM v4 WHERE s > a - ) -); - -eval $no_pushdown $query; -eval $query; -eval explain $query; -eval explain format=json $query; - -DROP VIEW v2,v3,v4; -DROP TABLE t1,t2,t3,t4; - ---echo # ---echo # MDEV-10800: pushdown of the condition obtained ---echo # after constant row substitution ---echo # - - -CREATE TABLE t1 (a INT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1); - -CREATE TABLE t2 (b INT) ENGINE=MyISAM; -INSERT INTO t2 VALUES (3),(4); -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; - -SELECT * FROM -( SELECT * FROM t1 - WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; - -EXPLAIN FORMAT=JSON -SELECT * FROM -( SELECT * FROM t1 - WHERE EXISTS ( SELECT * FROM v2 WHERE b = a ) ) AS sq; - -DROP VIEW v2; -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-11102: condition pushdown into materialized inner table ---echo # of outer join is not applied as not being valid ---echo # - -CREATE TABLE t1 (a INT); -INSERT INTO t1 VALUES (0),(2); - -CREATE TABLE t2 (b INT); -INSERT INTO t2 VALUES (1),(2); - -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; - -SELECT * FROM t1 LEFT JOIN t2 ON a = b WHERE b IS NULL; - -SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; - -EXPLAIN FORMAT=JSON -SELECT * FROM t1 LEFT JOIN v2 ON a = b WHERE b IS NULL; - -DROP VIEW v2; -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-11103: pushdown condition with ANY subquery ---echo # - -CREATE TABLE t1 (i INT); -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES (1),(2); - -EXPLAIN FORMAT=JSON -SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); - -SELECT * FROM v1 WHERE i <= ANY ( SELECT 3 ); - -DROP VIEW v1; -DROP TABLE t1; - ---echo # ---echo # MDEV-11315: condition with outer reference to mergeable derived ---echo # - -CREATE TABLE t1 (pk1 INT PRIMARY KEY, a INT, b INT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (10,7,1),(11,0,2); - -CREATE TABLE t2 (pk2 INT PRIMARY KEY, c INT, d DATETIME) ENGINE=MyISAM; -INSERT INTO t2 VALUES - (1,4,'2008-09-27 00:34:58'), - (2,5,'2007-05-28 00:00:00'), - (3,6,'2009-07-25 09:21:20'); - -CREATE VIEW v1 AS SELECT * FROM t1; -CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; - -SELECT * FROM v1 AS sq - WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; -EXPLAIN FORMAT=JSON -SELECT * FROM v1 AS sq - WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; - -SELECT * FROM ( SELECT * FROM t1 ) AS sq - WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT * FROM t1 ) AS sq - WHERE b IN ( SELECT pk2 FROM v2 WHERE c > sq.b ) OR b = 100; - -DROP VIEW v1,v2; -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-11313: pushdown of the condition obtained ---echo # after constant row substitution ---echo # - -CREATE TABLE t1 (a INT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1),(2); -CREATE TABLE t2 (b INT) ENGINE=MyISAM; -INSERT INTO t2 VALUES (50); -CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; - -SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; -EXPLAIN FORMAT=JSON -SELECT ( SELECT COUNT(*) FROM v1 WHERE a = t2.b ) AS f FROM t2 GROUP BY f; - -CREATE TABLE t3 (a INT, b INT) ENGINE=MYISAM; -INSERT INTO t3 VALUES (1,10),(3,11),(2,10),(2,20),(3,21); -CREATE VIEW v2 AS SELECT a, sum(b) AS s FROM t3 GROUP BY a ; -SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; -EXPLAIN FORMAT=JSON -SELECT ( SELECT COUNT(*) FROM v2 WHERE s < t2.b ) AS f FROM t2 GROUP BY f; - - -DROP VIEW v1,v2; -DROP TABLE t1,t2,t3; - ---echo # ---echo # MDEV-10882: pushdown of the predicate with cached value ---echo # - -CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL) ENGINE=MyISAM; -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES (1,2),(3,4); - -CREATE TABLE t2 (c INT NOT NULL) ENGINE=MyISAM; -INSERT INTO t2 VALUES (5),(6); - -SELECT a, GROUP_CONCAT(b) FROM v1 - WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; - -EXPLAIN FORMAT=JSON -SELECT a, GROUP_CONCAT(b) FROM v1 - WHERE b IN ( SELECT COUNT(c) FROM t2 ) GROUP BY a; - -DROP VIEW v1; -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-10836: pushdown of the predicate with cached value ---echo # - -CREATE TABLE t (pk INT PRIMARY KEY, f INT) ENGINE=MyISAM; -CREATE ALGORITHM=TEMPTABLE VIEW v AS SELECT * FROM t; -INSERT INTO t VALUES (1,1),(3,2); - -SELECT * FROM v AS v1, v AS v2 - WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); - -EXPLAIN FORMAT=JSON -SELECT * FROM v AS v1, v AS v2 - WHERE v2.pk > v1.f AND v1.f IN ( SELECT COUNT(pk) FROM t ); - -DROP VIEW v; -DROP TABLE t; - ---echo # ---echo # MDEV-11488: pushdown of the predicate with cached value ---echo # - -CREATE TABLE t1 (i INT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1),(3),(2); - -CREATE TABLE t2 (j INT, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (3),(4); - -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); - -UPDATE t2 SET j = 2 WHERE j = 3; -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); - -DROP TABLE t1,t2; - -CREATE TABLE t1 (i FLOAT) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1.5),(3.2),(2.71); - -CREATE TABLE t2 (j FLOAT, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (3.2),(2.71); - -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); - -DROP TABLE t1,t2; - -CREATE TABLE t1 (i DECIMAL(10,2)) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1.5),(3.21),(2.47); - -CREATE TABLE t2 (j DECIMAL(10,2), KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES (3.21),(4.55); - -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); - -DROP TABLE t1,t2; - -CREATE TABLE t1 (i VARCHAR(32)) ENGINE=MyISAM; -INSERT INTO t1 VALUES ('cc'),('aa'),('ddd'); - -CREATE TABLE t2 (j VARCHAR(16), KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES ('bbb'),('aa'); - -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); - -DROP TABLE t1,t2; - -CREATE TABLE t1 (i DATETIME) ENGINE=MyISAM; -INSERT INTO t1 VALUES - ('2008-09-27 00:34:58'),('2007-05-28 00:00:00'), ('2009-07-25 09:21:20'); - -CREATE TABLE t2 (j DATETIME, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES - ('2007-05-28 00:00:00'), ('2010-08-25 00:00:00'); - -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); - -DROP TABLE t1,t2; - -CREATE TABLE t1 (i DATE) ENGINE=MyISAM; -INSERT INTO t1 VALUES ('2008-09-27'),('2007-05-28'), ('2009-07-25'); - -CREATE TABLE t2 (j DATE, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES ('2007-05-28'), ('2010-08-25'); - -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); - -DROP TABLE t1,t2; - -CREATE TABLE t1 (i TIME) ENGINE=MyISAM; -INSERT INTO t1 VALUES ('00:34:58'),('10:00:02'), ('09:21:20'); - -CREATE TABLE t2 (j TIME, KEY(j)) ENGINE=MyISAM; -INSERT INTO t2 VALUES ('10:00:02'), ('11:00:10'); - -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); -EXPLAIN FORMAT=JSON -SELECT * FROM ( SELECT DISTINCT * FROM t1 ) AS sq - WHERE i IN ( SELECT MIN(j) FROM t2 ); - -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-11593: pushdown of condition with NULLIF ---echo # - -CREATE TABLE t1 (i INT); -CREATE OR REPLACE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; - -INSERT INTO t1 VALUES (2), (1); - -SELECT * FROM v1 WHERE NULLIF(1, i); -EXPLAIN FORMAT=JSON -SELECT * FROM v1 WHERE NULLIF(1, i); - -DROP VIEW v1; -DROP TABLE t1; - ---echo # ---echo # MDEV-11608: pushdown of the predicate with cached null value ---echo # - -CREATE TABLE t1 (c VARCHAR(3)); -CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES ('foo'),('bar'); - -CREATE TABLE t2 (c VARCHAR(3)); -INSERT INTO t2 VALUES ('foo'),('xyz'); - -SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); -EXPLAIN FORMAT=JSON -SELECT * FROM v1 WHERE v1.c IN ( SELECT MIN(c) FROM t2 WHERE 0 ); - -DROP VIEW v1; -DROP TABLE t1,t2; - -CREATE TABLE t1 (d DECIMAL(10,2)); -CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -INSERT INTO t1 VALUES (5.37),(1.1); - -CREATE TABLE t2 (d DECIMAL(10,2)); -INSERT INTO t2 VALUES ('1.1'),('2.23'); - -SELECT * FROM v1 WHERE v1.d IN ( SELECT MIN(d) FROM t2 WHERE 0 ); - -DROP VIEW v1; -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-11820: second execution of PS for query ---echo # with false subquery predicate in WHERE ---echo # - -CREATE TABLE t1 (c VARCHAR(3)) ENGINE=MyISAM; -INSERT INTO t1 VALUES ('foo'),('bar'); -CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT * FROM t1; -CREATE TABLE t2 (a INT); -INSERT INTO t2 VALUES (3), (4); - -PREPARE stmt1 FROM -" SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; -PREPARE stmt2 FROM -"EXPLAIN FORMAT=JSON - SELECT * FROM v1 WHERE 1 IN (SELECT a FROM t2) OR c = 'foo'"; -EXECUTE stmt1; -EXECUTE stmt2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -INSERT INTO t2 SELECT a+1 FROM t2; -EXECUTE stmt1; -EXECUTE stmt2; -DEALLOCATE PREPARE stmt1; -# the result here will change after the merge with the fix for mdev-11859 -DEALLOCATE PREPARE stmt2; - -DROP VIEW v1; -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-12373: pushdown into derived with side effects is prohibited ---echo # - -CREATE TABLE sales_documents ( - id int NOT NULL AUTO_INCREMENT, - sale_id int NULL DEFAULT NULL, - type tinyint unsigned NULL DEFAULT NULL, - data text NULL DEFAULT NULL COLLATE 'utf8_unicode_ci', - date date NULL DEFAULT NULL, - order_number int unsigned NULL DEFAULT NULL, - created_at int NULL DEFAULT NULL, - updated_at int NULL DEFAULT NULL, - generated tinyint NOT NULL DEFAULT '0', - synced_at int NOT NULL DEFAULT '0', - sum decimal(13,2) NOT NULL DEFAULT '0', - PRIMARY KEY (id) -); - -INSERT INTO sales_documents -(id, sale_id, type, order_number, data, created_at, - updated_at, date, generated, synced_at, sum) -VALUES -(555, 165, 3, 5, '{}', 1486538300, 1486722835, '2017-02-17', 0, 1486538313, 2320.00), -(556, 165, 2, 3, '{}', 1486538304, 1486563125, '2017-02-08', 1, 1486538302, 2320.00), -(557, 158, 2, 2, '{}', 1486538661, 1486538661, '2017-02-08', 0, 1486538660, 2320.00), -(558, 171, 1, 3, '{}', 1486539104, 1488203405, '2017-02-08', 1, 1486539102, 23230.00), -(559, 171, 2, 5, '{}', 1486549233, 1487146010, '2017-02-08', 1, 1486549225, 37690.00), -(560, 172, 1, 1, '{}', 1486658260, 1488203409, '2017-02-09', 1, 1486658256, 40312.00), -(561, 172, 2, 1, '{}', 1486711997, 1486711997, '2017-02-10', 1, 1486711996, 40312.00), -(562, 172, 3, 1, '{}', 1486712104, 1486721395, '2017-02-10', 1, 1486712101, 40312.00), -(563, 171, 3, 2, '{}', 1486712953, 1486720244, '2017-02-10', 1, 1486712910, 23230.00), -(564, 170, 1, 2, '{}', 1486715948, 1488203410, '2017-02-10', 1, 1486715930, 28873.00), -(565, 170, 3, 3, '{}', 1486716782, 1486717426, '2017-02-10', 1, 1486716779, 61948.00), -(566, 166, 3, 4, '{}', 1486720947, 1486720947, '2017-02-10', 1, 1486720945, 4640.00), -(567, 167, 3, 5, '{}', 1486722741, 1486722783, '2017-02-26', 0, 1486722738, 14755.00), -(568, 165, 1, 4, '{}', 1486722849, 1486722849, '2017-02-10', 0, 1486722846, 2320.00), -(569, 173, 2, 2, '{}', 1486723073, 1487071275, '2017-02-10', 1, 1486723071, 14282.00), -(570, 173, 1, 4, '{}', 1486723100, 1488203412, '2017-02-10', 1, 1486723099, 14282.00), -(571, 167, 2, 4, '{}', 1486730859, 1486730859, '2017-02-10', 1, 1486730856, 18655.00), -(572, 167, 1, 5, '{}', 1486730883, 1488203412, '2017-02-10', 1, 1486730877, 18655.00), -(573, 174, 2, 51, '{}', 1486731622, 1487060259, '2017-02-10', 1, 1486731620, 7140.00), -(574, 174, 3, 5, '{}', 1486993472, 1486993472, '2017-02-13', 1, 1488216147, 28020.00), -(575, 174, 1, 6, '{}', 1486993530, 1488203412, '2017-02-13', 1, 1486993505, 7140.00), -(576, 173, 3, 6, '{}', 1487071425, 1487071425, '2017-02-14', 0, 1487071422, 14282.00), -(577, 178, 2, 6, '{}', 1487327372, 1487327372, '2017-02-17', 1, 1487327370, 12321.00), -(578, 177, 2, 7, '{}', 1487327394, 1487327394, '2017-02-17', 0, 1487327391, 4270.00), -(579, 182, 3, 6, '{}', 1487750589, 1487751693, '2017-02-22', 1, 1487751688, 4270.00), -(580, 182, 2, 7, '{}', 1487750601, 1487750663, '2017-02-22', 1, 1487750598, 4270.00), -(581, 182, 1, 7, '{}', 1487750694, 1488203412, '2017-02-22', 1, 1487750692, 4270.00), -(582, 185, 3, 7, '{}', 1487774051, 1487774051, '2017-02-22', 0, 1487774043, 8913.00), -(583, 184, 3, 7, '{}', 1487774071, 1487774235, '2017-02-22', 0, 1487774093, 3285.00), -(584, 184, 2, 8, '{}', 1487774074, 1487774074, '2017-02-22', 0, 1487774073, 3285.00), -(585, 184, 1, 8, '{}', 1487774081, 1487774081, '2017-02-22', 0, 1487774075, 3285.00), -(586, 193, 2, 8, '{}', 1487955294, 1487955318, '2017-02-24', 0, 1487955311, 4270.00), -(587, 193, 1, 8, '{}', 1487955324, 1487955324, '2017-02-24', 0, 1487955320, 4270.00), -(588, 193, 3, 7, '{}', 1487955341, 1487955341, '2017-02-24', 0, 1487955325, 4270.00), -(589, 186, 1, 8, '{}', 1487957291, 1487957464, '2017-02-24', 0, 1487957459, 6960.00), -(590, 186, 2, 8, '{}', 1487957308, 1487957468, '2017-02-24', 0, 1487957465, 6960.00), -(591, 186, 3, 7, '{}', 1487957312, 1487957473, '2017-02-24', 0, 1487957469, 6960.00), -(592, 194, 1, 8, '{}', 1488193293, 1488203412, '2017-02-27', 1, 1488193280, 2320.00), -(593, 194, 2, 8, '{}', 1488193304, 1488193304, '2017-02-27', 1, 1488193303, 2320.00), -(594, 210, 1, 9, '{}', 1488198896, 1488198896, '2017-02-27', 0, 1488198885, 4270.00), -(595, 210, 2, 12, '{}', 1488198901, 1488198901, '2017-02-27', 1, 1488532585, 4270.00), -(596, 210, 3, 10, '{}', 1488198904, 1488198904, '2017-02-27', 1, 1488532565, 4270.00), -(597, 209, 2, 9, '{}', 1488200016, 1488450772, '2017-02-27', 1, 1488450449, 4270.00), -(598, 209, 1, 9, '{}', 1488200020, 1488200063, '2017-02-27', 1, 1488200017, 4271.00), -(599, 209, 3, 7, '{}', 1488200053, 1488200053, '2017-02-27', 0, 1488200021, 4271.00), -(600, 211, 2, 10, '{}', 1488216265, 1489402027, '2017-02-27', 1, 1488216264, 2320.00), -(601, 211, 3, 7, '{}', 1488216281, 1488216281, '2017-02-27', 1, 1488216276, 2320.00), -(602, 211, 1, 10, '{}', 1488216283, 1488216283, '2017-02-27', 1, 1488216282, 2320.00), -(603, 198, 2, 11, '{}', 1488280125, 1488280125, '2017-02-28', 0, 1488280095, 4270.00), -(604, 198, 1, 11, '{}', 1488280160, 1488280160, '2017-02-28', 0, 1488280126, 4270.00), -(605, 198, 3, 8, '{}', 1488280440, 1488280440, '2017-02-28', 0, 1488280435, 4270.00), -(606, 212, 1, 12, '{}', 1488286301, 1489402168, '2017-02-28', 1, 1488286295, 13825.00), -(607, 212, 3, 8, '{}', 1488289644, 1488289690, '2017-02-28', 1, 1488289642, 25295.00), -(608, 212, 2, 13, '{}', 1488290350, 1488290431, '2017-02-28', 1, 1488290347, 13133.75), -(609, 213, 1, 11, '{}', 1488529470, 1488529470, '2017-03-03', 1, 1488529461, 5660.00), -(610, 213, 2, 11, '{}', 1488529484, 1488529484, '2017-03-03', 1, 1488529479, 5660.00), -(611, 213, 3, 9, '{}', 1488529493, 1488529493, '2017-03-03', 1, 1488529489, 5660.00), -(612, 197, 2, 13, '{}', 1489400715, 1489400715, '2017-03-13', 0, 1489398959, 4270.00), -(613, 219, 3, 11, '{}', 1490084337, 1490181958, '2017-03-21', 1, 1490084334, 73526.00), -(614, 216, 3, 11, '{}', 1490085757, 1490086717, '2017-03-21', 0, 1490085755, 5377.00); - -SELECT * FROM -(SELECT @row := @row + 1 as row, a.* from ( - SELECT t.order_number - FROM sales_documents t - WHERE - t.type = 2 AND - t.date >= '2017-01-01' AND - t.date <= '2017-12-31' AND - t.order_number IS NOT NULL AND - t.generated = 1 - GROUP BY t.order_number -) a, (SELECT @row := 0) r) t -WHERE row <> order_number; - -DROP TABLE sales_documents; - ---echo # ---echo # MDEV-12845: pushdown from merged derived using equalities ---echo # - -create table t1 (a int); -insert into t1 values - (4), (8), (5), (3), (10), (2), (7); - -create table t2 (b int, c int); -insert into t2 values - (2,1), (5,2), (2,2), (4,1), (4,3), - (5,3), (2,4), (4,6), (2,1); - -create view v1 as -select b, sum(c) as s from t2 group by b; - -create view v2 as -select distinct b, c from t2; - -create view v3 as -select b, max(c) as m from t2 group by b; - -let $q1= -select b -from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t -where b > 2; - -eval $q1; -eval explain format=json $q1; - -let $q2= -select a -from ( select t1.a, v1.b, v1.s from t1, v1 where t1.a = v1.b ) as t -where a > 2; - -eval $q2; -eval explain format=json $q2; - -let $q3= -select a -from ( select t1.a, v2.b, v2.c from t1, v2 where t1.a = v2.b ) as t -where a > 2; - -eval $q3; -eval explain format=json $q3; - -let $q4= -select a -from ( select t1.a, v3.b, v3.m from t1, v3 where t1.a = v3.m ) as t -where a > 2; - -eval $q4; -eval explain format=json $q4; - -drop view v1,v2,v3; -drop table t1,t2; - ---echo # ---echo # MDEV-13166: pushdown from merged derived ---echo # - -CREATE TABLE t1 (i int) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1),(2); -CREATE VIEW v1 AS SELECT MAX(i) AS f FROM t1; - -let $q= -SELECT * FROM ( SELECT * FROM v1 ) AS sq WHERE f > 0; - -eval $q; -eval explain format=json $q; - -DROP VIEW v1; -DROP TABLE t1; - ---echo # ---echo # MDEV-13193: pushdown of equality extracted from multiple equality ---echo # - -CREATE TABLE t1 (i1 int, KEY(i1)) ENGINE=MyISAM; -INSERT INTO t1 VALUES (1),(2); - -CREATE TABLE t2 (i2 int) ENGINE=MyISAM; -INSERT INTO t2 VALUES (2),(4); - -CREATE ALGORITHM=TEMPTABLE VIEW v2 AS SELECT * FROM t2; - -let $q= -SELECT * FROM t1, ( SELECT * FROM v2 ) AS sq - WHERE i1 = 1 AND ( i1 = i2 OR i1 = 2 ); - -eval $q; -eval explain format=json $q; - -DROP VIEW v2; -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-14237: derived with regexp_substr() in select list ---echo # - -create table t1 (a char(8)); -insert into t1 values ('b'), ('a'), ('xx'); - -let $q= -select * -from ( select distinct regexp_substr(t1.a,'^[A-Za-z]+') as f from t1) as t -where t.f = 'a' or t.f = 'b'; - -eval $q; -eval explain format=json $q; - -drop table t1; - ---echo # ---echo # MDEV-13454: consequence of mdev-14368 fixed for 5.5 ---echo # - -SET sql_mode = 'ONLY_FULL_GROUP_BY'; - -create table t1 (id int, id2 int); -insert into t1 values (1,1),(2,3),(3,4),(7,2); - -create table t2(id2 int); -insert t2 values (1),(2),(3); - -let $q= -SELECT * FROM t1 - LEFT OUTER JOIN - (SELECT id2, COUNT(*) as ct FROM t2 GROUP BY id2) vc USING (id2) -WHERE (vc.ct>0); - -eval $q; -eval EXPLAIN FORMAT=JSON $q; - -DROP TABLE t1,t2; - -SET sql_mode = DEFAULT; - ---echo # ---echo # MDEV-15579: incorrect removal of sub-formulas to be pushed ---echo # into WHERE of materialized derived with GROUP BY ---echo # - -CREATE TABLE t1 (a INT, b INT, c INT, d INT); -CREATE TABLE t2 (x INT, y INT, z INT); - -INSERT INTO t1 VALUES (1,1,66,1), (1,1,56,2), (3,2,42,3); -INSERT INTO t2 VALUES (1,1,66), (1,12,32); - -let $query= -SELECT * -FROM t2, -( - SELECT a, b, max(c) AS max_c - FROM t1 - GROUP BY a - HAVING max_c > 37 -) AS v1 -WHERE (v1.a=1) AND (v1.b=v1.a) AND - (v1.a=t2.x) AND (v1.max_c>30); -eval $query; -eval EXPLAIN $query; -eval EXPLAIN FORMAT=JSON $query; - -let $query= -SELECT * -FROM t2, -( - SELECT a, b, d, max(c) AS max_c - FROM t1 - GROUP BY a,d - HAVING max_c > 37 -) AS v1 -WHERE (v1.a=1) AND (v1.b=v1.a) AND (v1.b=v1.d) AND - (v1.a=t2.x) AND (v1.max_c>30); -eval $query; -eval EXPLAIN $query; -eval EXPLAIN FORMAT=JSON $query; - -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-15765: pushing condition with temporal constants ---echo # into constant tables ---echo # - -select * from (select date('2018-01-01') as d - union all - select date('2018-01-01') as d) as t - where t.d between date ('2017-01-01') and date ('2019-01-01'); - -select * from (select date('2018-01-01') as d) as t - where t.d between date ('2017-01-01') and date ('2019-01-01'); - ---echo # ---echo # MDEV-16088: pushdown into derived defined in the IN subquery ---echo # - -CREATE TABLE t1 (a INT, b INT); -CREATE TABLE t2 (e INT, f INT, g INT); -INSERT INTO t1 VALUES (1,14),(2,13),(1,19),(2,32),(3,24); -INSERT INTO t2 VALUES (1,19,2),(3,24,1),(1,12,2),(3,11,3),(2,32,1); - -let $query= -SELECT * FROM t1 -WHERE (t1.a,t1.b) IN - ( - SELECT d_tab.e,d_tab.max_f - FROM ( - SELECT t2.e, MAX(t2.f) AS max_f - FROM t2 - GROUP BY t2.e - HAVING max_f>18 - ) as d_tab - WHERE d_tab.e>1 - ) -; -eval $query; -eval EXPLAIN $query; -eval EXPLAIN FORMAT=JSON $query; - -let $query= -SELECT * FROM t1 -WHERE (t1.a,t1.b) IN - ( - SELECT d_tab.e,d_tab.max_f - FROM ( - SELECT t2.e, MAX(t2.f) AS max_f - FROM t2 - GROUP BY t2.e - HAVING max_f>18 - ) as d_tab - WHERE d_tab.max_f<25 - ) -; -eval $query; -eval EXPLAIN $query; -eval EXPLAIN FORMAT=JSON $query; - -let $query= -SELECT * FROM t1 -WHERE (t1.a,t1.b) IN - ( - SELECT d_tab.e, MAX(d_tab.max_f) AS max_f - FROM ( - SELECT t2.e, MAX(t2.f) as max_f, t2.g - FROM t2 - GROUP BY t2.e - ) as d_tab - WHERE d_tab.e>1 - GROUP BY d_tab.g - ) -; -eval $query; -eval EXPLAIN $query; -eval EXPLAIN FORMAT=JSON $query; - -let $query= -SELECT * FROM t1 -WHERE (t1.a,t1.b) IN - ( - SELECT d_tab.e, MAX(d_tab.max_f) AS max_f - FROM ( - SELECT t2.e, MAX(t2.f) as max_f, t2.g - FROM t2 - GROUP BY t2.e - ) as d_tab - WHERE d_tab.max_f>20 - GROUP BY d_tab.g - ) -; -eval $query; -eval EXPLAIN $query; -eval EXPLAIN FORMAT=JSON $query; - -DROP TABLE t1,t2; - ---echo # ---echo # MDEV-15765: pushing condition with IN subquery defined with constants ---echo # using substitution ---echo # - -CREATE TABLE t1 (a INT); -INSERT INTO t1 VALUES (1),(2); -SELECT * FROM -( - SELECT DISTINCT * FROM t1 -) der_tab -WHERE (a>0 AND a<2 OR a IN (2,3)) AND - (a=2 OR 0); - -DROP TABLE t1; - ---echo # ---echo # MDEV-16386: pushing condition into the HAVING clause when ambiguous ---echo # fields warning appears ---echo # - -CREATE TABLE t1 (a INT, b INT); - -INSERT INTO t1 VALUES (1,2),(2,3),(3,4); - -let $query= -SELECT * FROM -( - SELECT t1.b AS a - FROM t1 - GROUP BY t1.a -) dt -WHERE (dt.a=2); -eval $query; -eval EXPLAIN FORMAT=JSON $query; - -let $query= -SELECT * FROM -( - SELECT t1.b AS a - FROM t1 - GROUP BY t1.a - HAVING (t1.a<3) -) dt -WHERE (dt.a>1); -eval $query; -eval EXPLAIN FORMAT=JSON $query; - -let $query= -SELECT * FROM -( - SELECT 'ab' AS a - FROM t1 - GROUP BY t1.a -) dt -WHERE (dt.a='ab'); -eval $query; -eval EXPLAIN FORMAT=JSON $query; - -let $query= -SELECT * FROM -( - SELECT 1 AS a - FROM t1 - GROUP BY t1.a -) dt -WHERE (dt.a=1); -eval $query; -eval EXPLAIN FORMAT=JSON $query; - -DROP TABLE t1; - ---echo # ---echo # MDEV-16517: pushdown condition with the IN predicate defined ---echo # with non-constant values ---echo # - -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 VALUES (1,2),(1,3); - -let $query= -SELECT * FROM -( - SELECT t1.a - FROM t1 - WHERE 1 IN (0,t1.a) - GROUP BY t1.a -) AS dt1 -JOIN -( - SELECT t1.a - FROM t1 - WHERE 1 IN (0,t1.a) -) AS dt2 -ON dt1.a = dt2.a; -eval $query; -eval EXPLAIN FORMAT=JSON $query; - -let $query= -SELECT * FROM -( - SELECT t1.a,MAX(t1.b) - FROM t1 - GROUP BY t1.a -) AS dt, t1 -WHERE dt.a=t1.a AND dt.a IN (1,t1.a); -eval $query; -eval EXPLAIN FORMAT=JSON $query; -DROP TABLE t1; - -# Start of 10.3 tests - ---echo # ---echo # MDEV-10855: Pushdown into derived with window functions +--echo # MDEV-10855: Pushdown into derived with window functions --echo # set @save_optimizer_switch= @@optimizer_switch; set optimizer_switch='split_materialized=off'; - + create table t1 (a int, c varchar(16)); insert into t1 values (8,'aa'), (5,'cc'), (1,'bb'), (2,'aa'), (9,'cc'), (7,'aa'), (2,'aa'), (7,'bb'); - + create table t2 (a int, b int, c varchar(16), index idx(a,c)); insert into t2 values (7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'), @@ -2439,27 +2701,31 @@ let $q1= select * from (select a, c, sum(b) over (partition by a,c) from t2) as t where t.a > 2 and t.c in ('aa','bb','cc'); +--sorted_result eval $no_pushdown $q1; +--sorted_result eval $q1; eval explain $q1; eval explain format=json $q1; let $q2= select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); +--sorted_result eval $no_pushdown $q2; +--sorted_result eval $q2; eval explain $q2; eval explain format=json $q2; let $q3= -select * +select * from (select a, c, sum(b) over (partition by a,c) as s from t2) as t, t1 where t1.a=t.a and t1.c=t.c and t1.c in ('aa','bb','cc'); @@ -2467,10 +2733,10 @@ eval $no_pushdown $q3; eval $q3; eval explain $q3; eval explain format=json $q3; - + let $q4= select * from -( +( select 1 as n, a, c, sum(b) over (partition by a,c) as s from t2 union all select 2 as n, a, c, sum(b) over (partition by a) as s from t2 @@ -2479,7 +2745,9 @@ select * from ) as t where t.a > 2 and t.c in ('aa','bb','cc'); +--sorted_result eval $no_pushdown $q4; +--sorted_result eval $q4; eval explain $q4; eval explain format=json $q4; @@ -2491,7 +2759,9 @@ select * from (select a, c, from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); +--sorted_result eval $no_pushdown $q5; +--sorted_result eval $q5; eval explain $q5; eval explain format=json $q5; @@ -2503,7 +2773,9 @@ select * from (select a, c, from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); +--sorted_result eval $no_pushdown $q6; +--sorted_result eval $q6; eval explain $q6; eval explain format=json $q6; @@ -2515,7 +2787,9 @@ select * from (select a, c, from t2 ) as t where t.a > 2 and t.c in ('aa','bb','cc'); +--sorted_result eval $no_pushdown $q7; +--sorted_result eval $q7; eval explain $q7; eval explain format=json $q7; @@ -2525,14 +2799,14 @@ drop table t1,t2; set optimizer_switch= @save_optimizer_switch; --echo # ---echo # MDEV-13369: Optimization for equi-joins of grouping derived tables +--echo # MDEV-13369: Optimization for equi-joins of grouping derived tables --echo # (Splitting derived tables / views with GROUP BY) --echo # MDEV-13389: Optimization for equi-joins of derived tables with WF --echo # (Splitting derived tables / views with window functions) --echo # let -$no_splitting= set statement optimizer_switch='split_materialized=off' for; +$no_splitting= set statement optimizer_switch='split_materialized=off' for; create table t1 (a int, b int, index idx_b(b)) engine=myisam; insert into t1 values @@ -2605,7 +2879,7 @@ insert into t3 values (8,11,'aa'), (5,15,'cc'), (1,14,'bb'), (2,12,'aa'), (7,17,'cc'), (7,18,'aa'), (2,11,'aa'), (7,10,'bb'), (3,11,'dd'), (4,12,'ee'), (5,14,'dd'), (9,12,'ee'); - + create table t4 (a int, b int, c char(127), index idx(a,c)) engine=myisam; insert into t4 values (7,10,'cc'), (1,20,'aa'), (2,23,'bb'), (7,18,'cc'), (1,30,'bb'), @@ -2627,7 +2901,7 @@ where t3.b > 15; eval $no_splitting $q3; eval $q3; eval explain extended $q3; -eval explain format=json $q3; +eval explain format=json $q3; let $q30= select t3.a,t3.c,t.max,t.min @@ -2639,7 +2913,7 @@ where t3.b <= 15; eval $no_splitting $q30; eval $q30; eval explain extended $q30; -eval explain format=json $q30; +eval explain format=json $q30; let $q4= select t3.a,t3.c,t.max,t.min @@ -2651,7 +2925,7 @@ where t3.b > 15; eval $no_splitting $q4; eval $q4; eval explain extended $q4; -eval explain format=json $q4; +eval explain format=json $q4; let $q40= select t3.a,t3.c,t.max,t.min @@ -2663,7 +2937,7 @@ where t3.b <= 15; eval $no_splitting $q40; eval $q40; eval explain extended $q40; -eval explain format=json $q40; +eval explain format=json $q40; drop index idx_a on t2; create index idx on t2(c,b); @@ -2681,7 +2955,9 @@ select t2.a,t2.b,t2.c,t.c as t_c,t.max,t.min from t2, t3, (select c, max(b) max, min(b) min from t4 group by c) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +--sorted_result eval $no_splitting $q5; +--sorted_result eval $q5; eval explain extended $q5; eval explain format=json $q5; @@ -2701,7 +2977,9 @@ select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b between 80 and 85 and t2.c in ('y','z') and t2.a=t3.a and t3.c=t.c; +--sorted_result eval $no_splitting $q6; +--sorted_result eval $q6; eval explain extended $q6; eval explain format=json $q6; @@ -2711,7 +2989,9 @@ select * from t2, t3, (select c, b, sum(b) over (partition by c) from t4 ) t where t2.b < 40 and t2.a=t3.a and t3.c=t.c; +--sorted_result eval $no_splitting $q60; +--sorted_result eval $q60; eval explain extended $q60; eval explain format=json $q60; @@ -2879,6 +3159,7 @@ cte as (select median(f2) over (partition by f1) as k1 from t1 order by f1), cte1 as (select median(f4) over (partition by f1) as k2 from t1) select k1,k2 from cte1, cte; +--sorted_result eval $q; eval explain $q; @@ -2907,210 +3188,6 @@ SELECT * FROM ( SELECT STRAIGHT_JOIN f, COUNT(*) as c FROM v1 GROUP BY f ) AS s; DROP VIEW v1; DROP TABLE t1; ---echo # ---echo # MDEV-15087: error from inexpensive subquery before check ---echo # for condition pushdown into derived ---echo # - -CREATE TABLE t1 (i1 int, v1 varchar(1)); -INSERT INTO t1 VALUES (7,'x'); - -CREATE TABLE t2 (i1 int); -INSERT INTO t2 VALUES (8); - -CREATE TABLE t3 (i1 int ,v1 varchar(1), v2 varchar(1)); -INSERT INTO t3 VALUES (4, 'v','v'),(62,'v','k'),(7, 'n', NULL); - ---error ER_SUBQUERY_NO_1_ROW -SELECT 1 -FROM (t1 AS a1 - JOIN (((SELECT DISTINCT t3.* - FROM t3) AS a2 - JOIN t1 ON (t1.v1 = a2.v2))) ON (t1.v1 = a2.v1)) -WHERE (SELECT BIT_COUNT(t2.i1) - FROM (t2 JOIN t3)) IS NULL; - -DROP TABLE t1, t2, t3; - ---echo # ---echo # MDEV-16614 signal 7 after calling stored procedure, that uses regexp ---echo # - -DELIMITER $$; -CREATE PROCEDURE p1(m1 varchar(5), m2 varchar(5)) -BEGIN -SELECT a FROM - (SELECT "aa" a) t - JOIN (SELECT "aa" b) t1 on t.a=t1.b -WHERE t.a regexp m1 and t1.b regexp m2 -GROUP BY a; -END$$ -DELIMITER ;$$ -CALL p1('a','a'); -DROP PROCEDURE p1; - - -DELIMITER $$; -CREATE PROCEDURE p1(m1 varchar(5)) -BEGIN - SELECT a FROM (SELECT "aa" a) t WHERE t.a regexp m1; -END$$ -DELIMITER ;$$ -CALL p1('a'); -DROP PROCEDURE p1; - - -SELECT a FROM (SELECT "aa" a) t WHERE REGEXP_INSTR(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); - - -DELIMITER $$; -CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT -BEGIN - RETURN 1; -END;$$ -CREATE OR REPLACE PROCEDURE p1(m1 varchar(5)) -BEGIN - SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, m1); -END$$ -DELIMITER ;$$ -CALL p1('a'); -DROP PROCEDURE p1; -DROP FUNCTION f1; - - -DELIMITER $$; -CREATE OR REPLACE FUNCTION f1(a VARCHAR(10), b VARCHAR(10)) RETURNS INT -BEGIN - RETURN 1; -END;$$ -DELIMITER ;$$ -SELECT a FROM (SELECT "aa" a) t WHERE f1(t.a, (SELECT MAX('aa') FROM DUAL LIMIT 1)); -DROP FUNCTION f1; - ---echo # ---echo # MDEV-17011: condition pushdown into materialized derived used ---echo # in INSERT SELECT, multi-table UPDATE and DELETE ---echo # - -CREATE TABLE t1 (a int ,b int) ENGINE=MyISAM; -INSERT INTO t1 VALUES - (1, 1), (1, 2), (2, 1), (2, 2), (3,1), (3,3), (4,2); - -CREATE TABLE t2 (a int) ENGINE MYISAM; -INSERT INTO t2 VALUES - (3), (7), (1), (4), (1); - -CREATE TABLE t3 (a int, b int) ENGINE MYISAM; - -let $q1= -INSERT INTO t3 -SELECT * FROM (SELECT a, count(*) as c FROM t1 GROUP BY a) t WHERE a<=2; - -eval EXPLAIN FORMAT=JSON $q1; -eval $q1; - -SELECT * FROM t3; - -let $q2= -UPDATE t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t SET t2.a=t.c+10 - WHERE t2.a= t.c and t.a>=3; - -eval EXPLAIN FORMAT=JSON $q2; -eval $q2; - -SELECT * FROM t2; - -let $q3= -DELETE t2 FROM t2, (SELECT a, count(*) as c FROM t1 GROUP BY a) t - WHERE t2.a= t.c+9 and t.a=2; - -eval EXPLAIN FORMAT=JSON $q3; -eval $q3; - -SELECT * FROM t2; - -DROP TABLE t1,t2,t3; - ---echo # ---echo # MDEV-16765: pushdown condition with the CASE structure ---echo # defined with Item_cond item ---echo # - -CREATE TABLE t1(a INT, b INT); -INSERT INTO t1 VALUES (1,2), (3,4), (2,3); - -LET $query= -SELECT * -FROM -( - SELECT CASE WHEN ((tab2.max_a=1) OR (tab2.max_a=2)) - THEN 1 ELSE 0 END AS max_a,b - FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -EVAL $query; -EVAL EXPLAIN FORMAT=JSON $query; - -LET $query= -SELECT * -FROM -( - SELECT CASE WHEN ((tab2.max_a=1) OR ((tab2.max_a>2) AND (tab2.max_a<4))) - THEN 1 ELSE 0 END AS max_a,b - FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -EVAL $query; -EVAL EXPLAIN FORMAT=JSON $query; - -LET $query= -SELECT * -FROM -( - SELECT CASE WHEN ((tab2.max_a>1) AND ((tab2.max_a=2) OR (tab2.max_a>2))) - THEN 1 ELSE 0 END AS max_a,b - FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -EVAL $query; -EVAL EXPLAIN FORMAT=JSON $query; - -LET $query= -SELECT * -FROM -( - SELECT CASE WHEN ((tab2.b=2) OR (tab2.b=4)) - THEN 1 ELSE 0 END AS max_a,b - FROM (SELECT MAX(a) as max_a,b FROM t1 GROUP BY t1.b) AS tab2 -) AS tab1 -WHERE (tab1.max_a=1); -EVAL $query; -EVAL EXPLAIN FORMAT=JSON $query; - -DROP TABLE t1; - ---echo # ---echo # MDEV-16803: pushdown condition with IN predicate in the derived table ---echo # defined with several SELECT statements ---echo # - -CREATE TABLE t1 (a INT, b INT); -INSERT INTO t1 VALUES (1,2),(3,2),(1,1); - -SELECT * FROM -( - SELECT a,b,1 as c - FROM t1 - UNION ALL - SELECT a,b,2 as c - FROM t1 -) AS tab -WHERE ((a,b) IN ((1,2),(3,2))); - -DROP TABLE t1; - ---echo # Start of 10.3 tests - --echo # --echo # MDEV-16801: splittable materialized derived/views with --echo # one grouping field from table without keys @@ -3143,3 +3220,46 @@ eval $q; eval EXPLAIN EXTENDED $q; DROP TABLE t1,t2,t3; + +--echo # +--echo # MDEV-17419: splittable materialized derived/view +--echo # when join_cache_level = 4 +--echo # + +set join_cache_level = 4; + +CREATE TABLE t1 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + username VARCHAR(50) NULL DEFAULT '0', + PRIMARY KEY (id) +) COLLATE='utf8_general_ci'; + +CREATE TABLE t2 ( + id INT UNSIGNED NOT NULL AUTO_INCREMENT, + userid INT UNSIGNED NOT NULL, + logindate DATETIME NOT NULL, + PRIMARY KEY (id) +) COLLATE='utf8_general_ci'; + +INSERT INTO t1 (id, username) VALUES + (1,"user1"), (2, "user2"); +INSERT INTO t2 (id, userid, logindate) VALUES + (1,1,"2015-06-19 12:17:02.828"), + (2,1,"2016-06-19 12:17:02.828"), + (3,2,"2017-06-19 12:17:02.828"), + (4,2,"2018-06-19 12:17:02.828"); + +let $q= +select * from t1 as u + left join + (select * from t2 as au group by au.userid) as auditlastlogin + on u.id=auditlastlogin.userid; + +eval EXPLAIN $q; +eval $q; + +set join_cache_level=default; + +DROP TABLE t1,t2; + +--echo # End of 10.3 tests diff --git a/mysql-test/main/derived_opt.result b/mysql-test/main/derived_opt.result index 6e4ea1b5d36..48ac7e62653 100644 --- a/mysql-test/main/derived_opt.result +++ b/mysql-test/main/derived_opt.result @@ -499,9 +499,45 @@ where D1.a= t1.a; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 10 Using where -1 PRIMARY hash_ALL key0 #hash#key0 5 test.t1.a 100 Using join buffer (flat, BNLH join) +1 PRIMARY ref key0 key0 5 test.t1.a 10 2 DERIVED t2 ALL NULL NULL NULL NULL 100 Using filesort set join_cache_level=@tmp_jcl; set optimizer_switch=@tmp_os; drop table t1, t2; +# +# Bug mdev-17382: equi-join of derived table with join_cache_level=4 +# +CREATE TABLE t1 ( +id int NOT NULL, +amount decimal DEFAULT NULL, +PRIMARY KEY (id) +); +CREATE TABLE t2 ( +id int NOT NULL, +name varchar(50) DEFAULT NULL, +PRIMARY KEY (id) +); +INSERT INTO t1 VALUES +(1, 10.0000), (2, 20.0000), (3, 30.0000), (4, 40.0000), +(5, NULL), (6, NULL), (7, 70.0000), (8, 80.0000); +INSERT INTO t2 VALUES +(1,'A'), (2,'B'), (3,'C'), (4,'D'), (5, NULL), (6, NULL), +(7,'E'), (8,'F'), (9,'G'), (10,'H'), (11, NULL), (12, NULL); +set @save_optimizer_switch= @@optimizer_switch; +set optimizer_switch='split_materialized=off'; +set join_cache_level=4; +EXPLAIN +SELECT t2.id,t2.name,t.total_amt +FROM t2 +LEFT JOIN +(SELECT id, sum(amount) total_amt FROM t1 GROUP BY id) AS t +ON t2.id=t.id +WHERE t2.id < 3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 3 Using index condition +1 PRIMARY ref key0 key0 5 test.t2.id 2 +2 DERIVED t1 ALL NULL NULL NULL NULL 8 Using temporary; Using filesort +set join_cache_level=default; +set optimizer_switch= @save_optimizer_switch; +DROP TABLE t1,t2; set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/main/derived_opt.test b/mysql-test/main/derived_opt.test index 7f19553e4e5..eccf4c13020 100644 --- a/mysql-test/main/derived_opt.test +++ b/mysql-test/main/derived_opt.test @@ -363,5 +363,48 @@ set join_cache_level=@tmp_jcl; set optimizer_switch=@tmp_os; drop table t1, t2; +--echo # +--echo # Bug mdev-17382: equi-join of derived table with join_cache_level=4 +--echo # + +CREATE TABLE t1 ( + id int NOT NULL, + amount decimal DEFAULT NULL, +PRIMARY KEY (id) +); + +CREATE TABLE t2 ( + id int NOT NULL, + name varchar(50) DEFAULT NULL, +PRIMARY KEY (id) +); + +INSERT INTO t1 VALUES +(1, 10.0000), (2, 20.0000), (3, 30.0000), (4, 40.0000), +(5, NULL), (6, NULL), (7, 70.0000), (8, 80.0000); + +INSERT INTO t2 VALUES +(1,'A'), (2,'B'), (3,'C'), (4,'D'), (5, NULL), (6, NULL), +(7,'E'), (8,'F'), (9,'G'), (10,'H'), (11, NULL), (12, NULL); + +set @save_optimizer_switch= @@optimizer_switch; +set optimizer_switch='split_materialized=off'; + +set join_cache_level=4; + +EXPLAIN +SELECT t2.id,t2.name,t.total_amt + FROM t2 + LEFT JOIN + (SELECT id, sum(amount) total_amt FROM t1 GROUP BY id) AS t + ON t2.id=t.id + WHERE t2.id < 3; + +set join_cache_level=default; + +set optimizer_switch= @save_optimizer_switch; + +DROP TABLE t1,t2; + # The following command must be the last one the file set optimizer_switch=@exit_optimizer_switch; diff --git a/mysql-test/main/derived_split_innodb.result b/mysql-test/main/derived_split_innodb.result new file mode 100644 index 00000000000..5073aa84c13 --- /dev/null +++ b/mysql-test/main/derived_split_innodb.result @@ -0,0 +1,102 @@ +# +# MDEV-16917: do not use splitting for derived with join cache +# +CREATE TABLE t1 ( +n1 int(10) NOT NULL, +n2 int(10) NOT NULL, +c1 char(1) NOT NULL, +KEY c1 (c1), +KEY n1_c1_n2 (n1,c1,n2) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (0, 2, 'a'), (1, 3, 'a'); +ANALYZE TABLE t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +EXPLAIN SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t +WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index c1,n1_c1_n2 n1_c1_n2 9 NULL 2 Using where; Using index +1 PRIMARY ref key0 key0 8 test.t1.n1,test.t1.n2 2 +2 LATERAL DERIVED t1 ref c1,n1_c1_n2 n1_c1_n2 4 test.t1.n1 1 Using where; Using index +SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t +WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1; +n1 +0 +1 +DROP TABLE t1; +# +# MDEV-17211: splittable materialized derived joining 3 tables with +# GROUP BY list containing fields from 2 of them +# +CREATE TABLE t1 ( +id1 int, i1 int, id2 int, +PRIMARY KEY (id1), KEY (i1), KEY (id2) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1); +CREATE TABLE t2 (id2 int, i2 int) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1, 1); +CREATE TABLE t3 (id3 int, i3 int, PRIMARY KEY (id3)) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1,1); +EXPLAIN SELECT id3 +FROM (SELECT t3.id3, t2.i2, t1.id2 FROM t3,t1,t2 +WHERE t3.i3=t1.id1 AND t2.id2=t1.id2 +GROUP BY t3.id3, t1.id2) AS t, +t2 +WHERE t2.id2=t.id2; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 ALL NULL NULL NULL NULL 1 Using where +1 PRIMARY ref key0 key0 5 test.t2.id2 2 +2 DERIVED t3 ALL NULL NULL NULL NULL 1 Using where; Using temporary; Using filesort +2 DERIVED t1 eq_ref PRIMARY,id2 PRIMARY 4 test.t3.i3 1 +2 DERIVED t2 ALL NULL NULL NULL NULL 1 Using where; Using join buffer (flat, BNL join) +SELECT id3 +FROM (SELECT t3.id3, t2.i2, t1.id2 FROM t3,t1,t2 +WHERE t3.i3=t1.id1 AND t2.id2=t1.id2 +GROUP BY t3.id3, t1.id2) AS t, +t2 +WHERE t2.id2=t.id2; +id3 +1 +DROP TABLE t1,t2,t3; +# +# Bug mdev-17381: equi-join of derived table with join_cache_level=4 +# +CREATE TABLE t1 ( +id int NOT NULL, +amount decimal DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=INNODB; +CREATE TABLE t2 ( +id int NOT NULL, +name varchar(50) DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=INNODB; +INSERT INTO t1 VALUES +(1, 10.0000), (2, 20.0000), (3, 30.0000), (4, 40.0000), +(5, NULL), (6, NULL), (7, 70.0000), (8, 80.0000); +INSERT INTO t2 VALUES +(1,'A'), (2,'B'), (3,'C'), (4,'D'), (5, NULL), (6, NULL), +(7,'E'), (8,'F'), (9,'G'), (10,'H'), (11, NULL), (12, NULL); +set join_cache_level=4; +SELECT t2.id,t2.name,t.total_amt +FROM t2 +LEFT JOIN +(SELECT id, sum(amount) total_amt FROM t1 GROUP BY id) AS t +ON t2.id=t.id +WHERE t2.id < 3; +id name total_amt +1 A 10 +2 B 20 +EXPLAIN SELECT t2.id,t2.name,t.total_amt +FROM t2 +LEFT JOIN +(SELECT id, sum(amount) total_amt FROM t1 GROUP BY id) AS t +ON t2.id=t.id +WHERE t2.id < 3; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t2 range PRIMARY PRIMARY 4 NULL 2 Using where +1 PRIMARY ref key0 key0 5 test.t2.id 2 +2 LATERAL DERIVED t1 eq_ref PRIMARY PRIMARY 4 test.t2.id 1 +set join_cache_level=default; +DROP TABLE t1,t2; diff --git a/mysql-test/main/derived_split_innodb.test b/mysql-test/main/derived_split_innodb.test new file mode 100644 index 00000000000..c3b3bcabede --- /dev/null +++ b/mysql-test/main/derived_split_innodb.test @@ -0,0 +1,96 @@ +--source include/have_innodb.inc + +--echo # +--echo # MDEV-16917: do not use splitting for derived with join cache +--echo # + +CREATE TABLE t1 ( + n1 int(10) NOT NULL, + n2 int(10) NOT NULL, + c1 char(1) NOT NULL, + KEY c1 (c1), + KEY n1_c1_n2 (n1,c1,n2) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (0, 2, 'a'), (1, 3, 'a'); + +ANALYZE TABLE t1; + +Let $q= +SELECT t1.n1 FROM t1, (SELECT n1, n2 FROM t1 WHERE c1 = 'a' GROUP BY n1) as t + WHERE t.n1 = t1.n1 AND t.n2 = t1.n2 AND c1 = 'a' GROUP BY n1; + +eval EXPLAIN $q; +eval $q; + +DROP TABLE t1; + +--echo # +--echo # MDEV-17211: splittable materialized derived joining 3 tables with +--echo # GROUP BY list containing fields from 2 of them +--echo # + +CREATE TABLE t1 ( + id1 int, i1 int, id2 int, + PRIMARY KEY (id1), KEY (i1), KEY (id2) +) ENGINE=InnoDB; +INSERT INTO t1 VALUES (1,1,1); + +CREATE TABLE t2 (id2 int, i2 int) ENGINE=InnoDB; +INSERT INTO t2 VALUES (1, 1); + +CREATE TABLE t3 (id3 int, i3 int, PRIMARY KEY (id3)) ENGINE=InnoDB; +INSERT INTO t3 VALUES (1,1); + +let $q= +SELECT id3 + FROM (SELECT t3.id3, t2.i2, t1.id2 FROM t3,t1,t2 + WHERE t3.i3=t1.id1 AND t2.id2=t1.id2 + GROUP BY t3.id3, t1.id2) AS t, + t2 + WHERE t2.id2=t.id2; + +eval EXPLAIN $q; +eval $q; + +DROP TABLE t1,t2,t3; + +--echo # +--echo # Bug mdev-17381: equi-join of derived table with join_cache_level=4 +--echo # + +CREATE TABLE t1 ( + id int NOT NULL, + amount decimal DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=INNODB; + +CREATE TABLE t2 ( + id int NOT NULL, + name varchar(50) DEFAULT NULL, +PRIMARY KEY (id) +) ENGINE=INNODB; + +INSERT INTO t1 VALUES +(1, 10.0000), (2, 20.0000), (3, 30.0000), (4, 40.0000), +(5, NULL), (6, NULL), (7, 70.0000), (8, 80.0000); + +INSERT INTO t2 VALUES +(1,'A'), (2,'B'), (3,'C'), (4,'D'), (5, NULL), (6, NULL), +(7,'E'), (8,'F'), (9,'G'), (10,'H'), (11, NULL), (12, NULL); + +set join_cache_level=4; + +let $q= +SELECT t2.id,t2.name,t.total_amt + FROM t2 + LEFT JOIN + (SELECT id, sum(amount) total_amt FROM t1 GROUP BY id) AS t + ON t2.id=t.id + WHERE t2.id < 3; + +eval $q; +eval EXPLAIN $q; + +set join_cache_level=default; + +DROP TABLE t1,t2; diff --git a/mysql-test/main/derived_view.result b/mysql-test/main/derived_view.result index 86dd73f5733..45de32d1ee1 100644 --- a/mysql-test/main/derived_view.result +++ b/mysql-test/main/derived_view.result @@ -2939,21 +2939,23 @@ insert into t2 select b+10 from t2; insert into t2 select b+10 from t2; analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select a from t1 where a in (select b from t2); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1) +1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) explain select * from (select a from t1 where a in (select b from t2)) t; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1) +1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) create view v1 as select a from t1 where a in (select b from t2); explain select * from v1; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 7 Using where -1 PRIMARY t2 ref idx idx 5 test.t1.a 140 Using index; FirstMatch(t1) +1 PRIMARY t2 ref idx idx 5 test.t1.a 139 Using index; FirstMatch(t1) drop view v1; drop table t1,t2; # diff --git a/mysql-test/main/disabled.def b/mysql-test/main/disabled.def index e83ff00d10b..eecee845a35 100644 --- a/mysql-test/main/disabled.def +++ b/mysql-test/main/disabled.def @@ -14,11 +14,10 @@ events_time_zone : Test is not predictable as it depends on precise timi read_many_rows_innodb : Bug#11748886 2010-11-15 mattiasj report already exists mysql_embedded : Bug#12561297 2011-05-14 Anitha Dependent on PB2 changes - eventum#41836 #show_explain : Psergey: random timeout in range-checked-for-each record query. -ssl_crl_clients_valid : broken upstream -ssl_crl : broken upstream -ssl_crl_clrpath : broken upstream innodb-wl5522-debug-zip : broken upstream innodb_bug12902967 : broken upstream file_contents : MDEV-6526 these files are not installed anymore max_statement_time : cannot possibly work, depends on timing -connect-abstract : waiting for libmariadb update +mysqlcheck : special tables like proxy , host specific to a system are shown +flush_read_lock : special tables like proxy , host specific to a system are shown +join_cache : enable after MDEV-17752 is fixed diff --git a/mysql-test/main/distinct.result b/mysql-test/main/distinct.result index 70bce519ad2..8fcc45e740a 100644 --- a/mysql-test/main/distinct.result +++ b/mysql-test/main/distinct.result @@ -173,9 +173,9 @@ INSERT INTO t2 values (1),(2),(3); INSERT INTO t3 VALUES (1,'1'),(2,'2'),(1,'1'),(2,'2'); explain SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL PRIMARY NULL NULL NULL 4 Using where; Using temporary +1 SIMPLE t2 index a a 4 NULL 5 Using index; Using temporary +1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 Using where 1 SIMPLE t3 ref a a 5 test.t1.b 2 Using index -1 SIMPLE t2 index a a 4 NULL 5 Using where; Using index; Using join buffer (flat, BNL join) SELECT distinct t3.a FROM t3,t2,t1 WHERE t3.a=t1.b AND t1.a=t2.a; a 1 @@ -1049,4 +1049,24 @@ b1+'0' b2+'0' b3+'0' b4+'0' b5+'0' b6 +'0' 1 0 0 1 0 1 0 1 0 0 1 0 DROP TABLE t1; +# +# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free +# or Invalid write in JOIN::make_aggr_tables_info +# +CREATE TABLE t1 (pk INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +explain +( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ) +UNION +( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary +2 UNCACHEABLE UNION t1 index NULL PRIMARY 4 NULL 2 Using index; Using temporary +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ) +UNION +( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ); +1 +1 +drop table t1; End of 5.5 tests diff --git a/mysql-test/main/distinct.test b/mysql-test/main/distinct.test index c11f8b501bc..d41340c29fd 100644 --- a/mysql-test/main/distinct.test +++ b/mysql-test/main/distinct.test @@ -798,4 +798,22 @@ CREATE TABLE t1 (b1 BIT, b2 BIT, b3 BIT, b4 BIT , b5 BIT, b6 BIT); INSERT INTO t1 VALUES (1,0,0,1,0,1),(0,1,0,0,1,0); SELECT DISTINCT b1+'0', b2+'0', b3+'0', b4+'0', b5+'0', b6 +'0' FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free +--echo # or Invalid write in JOIN::make_aggr_tables_info +--echo # + +CREATE TABLE t1 (pk INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +explain +( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ) +UNION +( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ); + +( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ) +UNION +( SELECT DISTINCT 1 FROM t1 ORDER BY BENCHMARK(1, MIN(pk)) ); +drop table t1; + --echo End of 5.5 tests diff --git a/mysql-test/main/dyncol.result b/mysql-test/main/dyncol.result index 7a5eeac67cc..cc9a94e74be 100644 --- a/mysql-test/main/dyncol.result +++ b/mysql-test/main/dyncol.result @@ -1028,12 +1028,12 @@ select column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as tim column_get(column_create(1, "2011-02-32 8:46:06.23434" AS CHAR), 1 as time) NULL Warnings: -Warning 1292 Truncated incorrect time value: '2011-02-32 8:46:06.23434' +Warning 1292 Incorrect time value: '2011-02-32 8:46:06.23434' select column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as time); column_get(column_create(1, "2011-13-01 8:46:06.23434" AS CHAR), 1 as time) NULL Warnings: -Warning 1292 Truncated incorrect time value: '2011-13-01 8:46:06.23434' +Warning 1292 Incorrect time value: '2011-13-01 8:46:06.23434' select column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as time); column_get(column_create(1, "2011-02-30 8:46:06.23434" AS CHAR), 1 as time) 08:46:06 diff --git a/mysql-test/main/empty_user_table.result b/mysql-test/main/empty_user_table.result index 54a7fd4907b..924e4cd8ea5 100644 --- a/mysql-test/main/empty_user_table.result +++ b/mysql-test/main/empty_user_table.result @@ -1,9 +1,14 @@ -create table t1 as select * from mysql.user; +create table t1 as select * from mysql.global_priv; +truncate table mysql.global_priv; +flush privileges; +connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); +connect fail,localhost,u1; +Got one of the listed errors +insert mysql.global_priv select * from t1; +drop table t1; +flush privileges; truncate table mysql.user; flush privileges; connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); connect fail,localhost,u1; Got one of the listed errors -insert mysql.user select * from t1; -drop table t1; -flush privileges; diff --git a/mysql-test/main/empty_user_table.test b/mysql-test/main/empty_user_table.test index b54f2109e30..8a544fece83 100644 --- a/mysql-test/main/empty_user_table.test +++ b/mysql-test/main/empty_user_table.test @@ -4,8 +4,8 @@ source include/not_embedded.inc; -create table t1 as select * from mysql.user; -truncate table mysql.user; +create table t1 as select * from mysql.global_priv; +truncate table mysql.global_priv; flush privileges; # connecting via unix socket gives ER_ACCESS_DENIED_ERROR @@ -14,7 +14,23 @@ flush privileges; --error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED connect (fail,localhost,u1); -insert mysql.user select * from t1; +insert mysql.global_priv select * from t1; drop table t1; flush privileges; +# +# same with mysql.user +# + +source include/switch_to_mysql_user.inc; +truncate table mysql.user; + +flush privileges; + +# connecting via unix socket gives ER_ACCESS_DENIED_ERROR +# connecting via tcp/ip gives ER_HOST_NOT_PRIVILEGED +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR,ER_HOST_NOT_PRIVILEGED +connect (fail,localhost,u1); + +source include/switch_to_mysql_global_priv.inc; diff --git a/mysql-test/main/events_bugs.result b/mysql-test/main/events_bugs.result index b56912dea7e..3e770451735 100644 --- a/mysql-test/main/events_bugs.result +++ b/mysql-test/main/events_bugs.result @@ -96,7 +96,7 @@ select release_lock('ee_16407_2'); insert into events_test.events_smode_test values('ee_16407_2','1980-19-02'); end| insert into events_test.events_smode_test values ('test','1980-19-02')| -ERROR 22007: Incorrect date value: '1980-19-02' for column 'a' at row 1 +ERROR 22007: Incorrect date value: '1980-19-02' for column `events_test`.`events_smode_test`.`a` at row 1 "This is ok" create event ee_16407_3 on schedule every 60 second do begin diff --git a/mysql-test/main/explain_json.result b/mysql-test/main/explain_json.result index ef6b70aff71..3ca3ac200af 100644 --- a/mysql-test/main/explain_json.result +++ b/mysql-test/main/explain_json.result @@ -1029,6 +1029,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c); create index idx_t1_2 on t1 (a1,a2,b); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date explain select count(distinct a1,a2,b) from t1 where (a2 >= 'b') and (b = 'a'); id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/main/explain_non_select.result b/mysql-test/main/explain_non_select.result index 5a6b9f841c2..51414d0c196 100644 --- a/mysql-test/main/explain_non_select.result +++ b/mysql-test/main/explain_non_select.result @@ -229,7 +229,7 @@ INSERT INTO t1 VALUES (1),(2); EXPLAIN UPDATE v1, mysql.user SET v1.a = v1.a + 1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 -1 SIMPLE user index NULL PRIMARY 420 NULL 4 Using index +1 SIMPLE global_priv index NULL PRIMARY 420 NULL 4 Using index DROP TABLE t1; DROP VIEW v1; # diff --git a/mysql-test/main/failed_auth_3909.result b/mysql-test/main/failed_auth_3909.result index d0fd2c41221..19951415585 100644 --- a/mysql-test/main/failed_auth_3909.result +++ b/mysql-test/main/failed_auth_3909.result @@ -1,24 +1,17 @@ -optimize table mysql.user; -Table Op Msg_type Msg_text -mysql.user optimize status OK -insert ignore mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar'); -Warnings: -Warning 1364 Field 'ssl_cipher' doesn't have a default value -Warning 1364 Field 'x509_issuer' doesn't have a default value -Warning 1364 Field 'x509_subject' doesn't have a default value -Warning 1364 Field 'authentication_string' doesn't have a default value -flush privileges; +create user foo identified via mysql_old_password; +create user bar identified via mysql_old_password; +create user baz identified via mysql_old_password; connect(localhost,u1,,test,MASTER_PORT,MASTER_SOCKET); connect fail,localhost,u1; -ERROR HY000: Plugin 'bar' is not loaded +ERROR 28000: Access denied for user 'u1'@'localhost' (using password: NO) connect(localhost,u2,,test,MASTER_PORT,MASTER_SOCKET); connect fail,localhost,u2; -ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO) +ERROR HY000: Server is running in --secure-auth mode, but 'u2'@'localhost' has a password in the old format; please change the password to the new format connect(localhost,u2,password,test,MASTER_PORT,MASTER_SOCKET); connect fail,localhost,u2,password; -ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES) -ERROR HY000: Plugin 'bar' is not loaded -ERROR 28000: Access denied for user 'u2'@'localhost' (using password: NO) -ERROR 28000: Access denied for user 'u2'@'localhost' (using password: YES) -delete from mysql.user where plugin = 'bar'; +ERROR HY000: Server is running in --secure-auth mode, but 'u2'@'localhost' has a password in the old format; please change the password to the new format +ERROR 28000: Access denied for user 'u1'@'localhost' (using password: NO) +ERROR HY000: Server is running in --secure-auth mode, but 'u2'@'localhost' has a password in the old format; please change the password to the new format +ERROR HY000: Server is running in --secure-auth mode, but 'u2'@'localhost' has a password in the old format; please change the password to the new format +delete from mysql.user where plugin = 'mysql_old_password'; flush privileges; diff --git a/mysql-test/main/failed_auth_3909.test b/mysql-test/main/failed_auth_3909.test index f72460691ea..25e45e49a0e 100644 --- a/mysql-test/main/failed_auth_3909.test +++ b/mysql-test/main/failed_auth_3909.test @@ -6,32 +6,32 @@ source include/not_embedded.inc; # verify that for some failed login attemps (with wrong user names) # the server requests a plugin # -optimize table mysql.user; -insert ignore mysql.user (user,plugin) values ('foo','bar'),('bar','bar'),('baz','bar'); -flush privileges; +create user foo identified via mysql_old_password; +create user bar identified via mysql_old_password; +create user baz identified via mysql_old_password; --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT ---error ER_PLUGIN_IS_NOT_LOADED +--error ER_ACCESS_DENIED_ERROR connect (fail,localhost,u1); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT ---error ER_ACCESS_DENIED_ERROR +--error ER_SERVER_IS_IN_SECURE_AUTH_MODE connect (fail,localhost,u2); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT ---error ER_ACCESS_DENIED_ERROR +--error ER_SERVER_IS_IN_SECURE_AUTH_MODE connect (fail,localhost,u2,password); ---error ER_PLUGIN_IS_NOT_LOADED +--error ER_ACCESS_DENIED_ERROR change_user u1; ---error ER_ACCESS_DENIED_ERROR +--error ER_SERVER_IS_IN_SECURE_AUTH_MODE change_user u2; ---error ER_ACCESS_DENIED_ERROR +--error ER_SERVER_IS_IN_SECURE_AUTH_MODE change_user u2,password; -delete from mysql.user where plugin = 'bar'; +delete from mysql.user where plugin = 'mysql_old_password'; flush privileges; diff --git a/mysql-test/main/failed_auth_unixsocket.result b/mysql-test/main/failed_auth_unixsocket.result index 680d3b48a33..690476cd753 100644 --- a/mysql-test/main/failed_auth_unixsocket.result +++ b/mysql-test/main/failed_auth_unixsocket.result @@ -1,13 +1,13 @@ -update mysql.user set plugin='unix_socket'; +update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket'); flush privileges; connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET); -connect fail,localhost,$USER; ERROR HY000: Plugin 'unix_socket' is not loaded ERROR HY000: Plugin 'unix_socket' is not loaded install plugin unix_socket soname 'auth_socket.so'; +flush privileges; connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET); ERROR 28000: Access denied for user 'USER'@'localhost' ERROR 28000: Access denied for user 'USER'@'localhost' -update mysql.user set plugin=''; +update mysql.global_priv set priv=json_remove(priv, '$.plugin'); flush privileges; uninstall plugin unix_socket; diff --git a/mysql-test/main/failed_auth_unixsocket.test b/mysql-test/main/failed_auth_unixsocket.test index f7345f44698..a7ae7d64a6b 100644 --- a/mysql-test/main/failed_auth_unixsocket.test +++ b/mysql-test/main/failed_auth_unixsocket.test @@ -4,23 +4,29 @@ # MDEV-3909 remote user enumeration # unix_socket tests # -update mysql.user set plugin='unix_socket'; +update mysql.global_priv set priv=json_insert(priv, '$.plugin', 'unix_socket'); flush privileges; ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $USER USER +# Make sure that the replace works, even if $USER is 'user' or something else +# that matches other parts of the error message. +let $replace=Access denied for user '$USER'; + +--echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET); +--replace_result $replace "Access denied for user 'USER'" +--disable_query_log --error ER_PLUGIN_IS_NOT_LOADED connect (fail,localhost,$USER); +--enable_query_log +--replace_result $replace "Access denied for user 'USER'" --error ER_PLUGIN_IS_NOT_LOADED change_user $USER; eval install plugin unix_socket soname '$AUTH_SOCKET_SO'; +flush privileges; -# Make sure that the replace works, even if $USER is 'user' or something else -# that matches other parts of the error message. --echo connect(localhost,USER,,test,MASTER_PORT,MASTER_SOCKET); ---let $replace=Access denied for user '$USER' ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT $replace "Access denied for user 'USER'" +--replace_result $replace "Access denied for user 'USER'" --disable_query_log --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR connect (fail,localhost,$USER); @@ -30,7 +36,7 @@ connect (fail,localhost,$USER); --error ER_ACCESS_DENIED_NO_PASSWORD_ERROR change_user $USER; -update mysql.user set plugin=''; +update mysql.global_priv set priv=json_remove(priv, '$.plugin'); flush privileges; uninstall plugin unix_socket; diff --git a/mysql-test/main/flush.result b/mysql-test/main/flush.result index 5cd4fde477d..8149ce29dec 100644 --- a/mysql-test/main/flush.result +++ b/mysql-test/main/flush.result @@ -364,16 +364,19 @@ flush table t1; connection default; # Let flush table sync in. select * from t1; +a connection con1; select * from t1; a unlock tables; +connection default; +select count(*) from information_schema.processlist where state = "Waiting for table metadata lock"; +count(*) +1 +commit; connection con2; # Reaping 'flush table t1'... connection default; -# Reaping 'select * from t1'... -a -commit; # # Repeat the same test but with FLUSH TABLES # @@ -386,13 +389,10 @@ connection con1; # lock table t1 read; connection con2; -# -# FLUSH TABLES expels the table definition from the cache. -# Sending 'flush tables'... flush tables; connection default; -# Let flush table sync in. select * from t1; +a connection con1; select * from t1; a @@ -400,8 +400,6 @@ unlock tables; connection con2; # Reaping 'flush tables'... connection default; -# Reaping 'select * from t1'... -a commit; # Cleanup connection con1; @@ -472,10 +470,7 @@ create table t1 (i int); create table t2 (i int); handler t1 open; connection con1; -# Sending: flush tables with read lock; -connection con2; -# Wait until FTWRL starts waiting for 't1' to be closed. connection default; # The below statement should not cause deadlock. # Sending: @@ -483,8 +478,6 @@ insert into t2 values (1); connection con2; # Wait until INSERT starts to wait for FTWRL to go away. connection con1; -# FTWRL should be able to continue now. -# Reap FTWRL. unlock tables; connection default; # Reap INSERT. @@ -542,3 +535,26 @@ flush relay logs,relay logs; ERROR HY000: Incorrect usage of FLUSH and RELAY LOGS flush slave,slave; ERROR HY000: Incorrect usage of FLUSH and SLAVE +# +# MDEV-15890 Strange error message if you try to +# FLUSH TABLES after LOCK TABLES . +# +CREATE TABLE t1 (qty INT, price INT); +CREATE VIEW v1 AS SELECT qty, price, qty*price AS value FROM t1; +LOCK TABLES v1 READ; +FLUSH TABLES v1; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +UNLOCK TABLES; +LOCK TABLES v1 WRITE; +FLUSH TABLES v1; +UNLOCK TABLES; +LOCK TABLES v1 READ; +FLUSH TABLES t1; +ERROR HY000: Table 't1' was locked with a READ lock and can't be updated +UNLOCK TABLES; +LOCK TABLES t1 READ; +FLUSH TABLES v1; +ERROR HY000: Table 'v1' was not locked with LOCK TABLES +UNLOCK TABLES; +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/main/flush.test b/mysql-test/main/flush.test index 81834b7de10..17f9241a122 100644 --- a/mysql-test/main/flush.test +++ b/mysql-test/main/flush.test @@ -449,24 +449,20 @@ connection default; --echo # Let flush table sync in. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" + where state = "Waiting for table metadata lock" and info = "flush table t1"; --source include/wait_condition.inc -send select * from t1; +select * from t1; connection con1; -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" - and info = "select * from t1"; select * from t1; unlock tables; +connection default; +select count(*) from information_schema.processlist where state = "Waiting for table metadata lock"; +commit; connection con2; --echo # Reaping 'flush table t1'... reap; connection default; ---echo # Reaping 'select * from t1'... -reap; -commit; --echo # --echo # Repeat the same test but with FLUSH TABLES @@ -480,31 +476,16 @@ connection con1; --echo # lock table t1 read; connection con2; ---echo # ---echo # FLUSH TABLES expels the table definition from the cache. ---echo # Sending 'flush tables'... send flush tables; connection default; ---echo # Let flush table sync in. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" - and info = "flush tables"; ---source include/wait_condition.inc -send select * from t1; +select * from t1; connection con1; -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" - and info = "select * from t1"; select * from t1; unlock tables; connection con2; --echo # Reaping 'flush tables'... reap; connection default; ---echo # Reaping 'select * from t1'... -reap; commit; --echo # Cleanup @@ -566,17 +547,7 @@ create table t2 (i int); handler t1 open; connection con1; ---echo # Sending: ---send flush tables with read lock - -connection con2; ---echo # Wait until FTWRL starts waiting for 't1' to be closed. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" - and info = "flush tables with read lock"; ---source include/wait_condition.inc - +flush tables with read lock; connection default; --echo # The below statement should not cause deadlock. --echo # Sending: @@ -586,14 +557,11 @@ connection con2; --echo # Wait until INSERT starts to wait for FTWRL to go away. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" + where state = "Waiting for backup lock" and info = "insert into t2 values (1)"; --source include/wait_condition.inc connection con1; ---echo # FTWRL should be able to continue now. ---echo # Reap FTWRL. ---reap unlock tables; connection default; @@ -673,3 +641,34 @@ DROP TABLE t1; flush relay logs,relay logs; --error ER_WRONG_USAGE flush slave,slave; + +--echo # +--echo # MDEV-15890 Strange error message if you try to +--echo # FLUSH TABLES after LOCK TABLES . +--echo # + +CREATE TABLE t1 (qty INT, price INT); +CREATE VIEW v1 AS SELECT qty, price, qty*price AS value FROM t1; + +LOCK TABLES v1 READ; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +FLUSH TABLES v1; +UNLOCK TABLES; + +LOCK TABLES v1 WRITE; +FLUSH TABLES v1; +UNLOCK TABLES; + +LOCK TABLES v1 READ; +--error ER_TABLE_NOT_LOCKED_FOR_WRITE +FLUSH TABLES t1; +UNLOCK TABLES; + +LOCK TABLES t1 READ; +--error ER_TABLE_NOT_LOCKED +FLUSH TABLES v1; +UNLOCK TABLES; + +DROP VIEW v1; +DROP TABLE t1; + diff --git a/mysql-test/main/flush_block_commit.test b/mysql-test/main/flush_block_commit.test index 6a6120ce63f..0280aedf2ca 100644 --- a/mysql-test/main/flush_block_commit.test +++ b/mysql-test/main/flush_block_commit.test @@ -32,7 +32,7 @@ connection con2; --echo # Wait until COMMIT gets blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and info = "COMMIT"; + where state = "Waiting for backup lock" and info = "COMMIT"; --source include/wait_condition.inc --echo # Verify that 'con1' was blocked and data did not move. SELECT * FROM t1; diff --git a/mysql-test/main/flush_block_commit_notembedded.test b/mysql-test/main/flush_block_commit_notembedded.test index 3d894c5f16c..5be9e50e58b 100644 --- a/mysql-test/main/flush_block_commit_notembedded.test +++ b/mysql-test/main/flush_block_commit_notembedded.test @@ -46,7 +46,7 @@ begin; connection con1; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "insert into t1 values (1)"; --source include/wait_condition.inc unlock tables; diff --git a/mysql-test/main/flush_read_lock.result b/mysql-test/main/flush_read_lock.result index 55c31ae8d12..33dc1092190 100644 --- a/mysql-test/main/flush_read_lock.result +++ b/mysql-test/main/flush_read_lock.result @@ -652,6 +652,7 @@ connection default; # 14.2) FLUSH TABLES WITH READ LOCK is not blocked by # active FTWRL. But since the latter keeps tables open # FTWRL is blocked by FLUSH TABLES WITH READ LOCK. +# Fixed by MDEV-5336 flush tables with read lock; # FT WRL is allowed under FTWRL at the moment. # It does not make much sense though. @@ -668,12 +669,9 @@ connection default; flush tables t1_base, t2_base with read lock; connection con1; flush tables with read lock; -connection con2; -# Wait until FTWRL is blocked. connection default; unlock tables; connection con1; -# Reap FTWRL. unlock tables; connection default; # @@ -1677,3 +1675,57 @@ disconnect con1; disconnect con2; disconnect con3; set global sql_mode=default; +# +# Deadlock between FTWRL under open handler and DDL/LOCK TABLES +# +CREATE TABLE t1(a INT); +HANDLER t1 OPEN; +# +connect con1,localhost,root,,; +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready'; +LOCK TABLE t1 WRITE; +# +# we need to do it in a separate connection, +# because SET DEBUG_SYNC call open_tables()/mysql_ha_flush() :( +connect con2,localhost,root,,; +SET DEBUG_SYNC= 'now WAIT_FOR ready'; +disconnect con2; +# +connection default; +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +HANDLER t1 CLOSE; +# +connection con1; +UNLOCK TABLES; +disconnect con1; +# +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; +# +# Make sure pending LOCK TABLES doesn't block FTWRL +# +CREATE TABLE t1(a INT); +LOCK TABLE t1 READ; +# +connect con1,localhost,root,,; +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready'; +LOCK TABLE t1 WRITE; +# +connect con2,localhost,root,,; +SET DEBUG_SYNC= 'now WAIT_FOR ready'; +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +disconnect con2; +# +connection default; +UNLOCK TABLES; +# +connection con1; +UNLOCK TABLES; +disconnect con1; +# +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/flush_read_lock.test b/mysql-test/main/flush_read_lock.test index 4a9752ae9f1..f39dbecf4a9 100644 --- a/mysql-test/main/flush_read_lock.test +++ b/mysql-test/main/flush_read_lock.test @@ -259,7 +259,7 @@ connection $con_aux1; --echo # Wait until COMMIT is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "commit"; --source include/wait_condition.inc unlock tables; @@ -281,7 +281,7 @@ connection $con_aux2; --echo # Wait until FTWRL is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc set debug_sync='now SIGNAL go'; @@ -565,7 +565,7 @@ connection $con_aux1; --echo # Check that EXECUTE is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "insert into t1_base values (1)"; --source include/wait_condition.inc unlock tables; @@ -582,7 +582,7 @@ connection $con_aux2; --echo # Wait until FTWRL is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc set debug_sync='now SIGNAL go'; @@ -800,6 +800,8 @@ connection default; --echo # 14.2) FLUSH TABLES WITH READ LOCK is not blocked by --echo # active FTWRL. But since the latter keeps tables open --echo # FTWRL is blocked by FLUSH TABLES WITH READ LOCK. +--echo # Fixed by MDEV-5336 + flush tables with read lock; --echo # FT WRL is allowed under FTWRL at the moment. --echo # It does not make much sense though. @@ -815,19 +817,10 @@ unlock tables; connection default; flush tables t1_base, t2_base with read lock; connection $con_aux1; ---send flush tables with read lock -connection $con_aux2; ---echo # Wait until FTWRL is blocked. -let $wait_condition= - select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" and - info = "flush tables with read lock"; ---source include/wait_condition.inc +flush tables with read lock; connection default; unlock tables; connection $con_aux1; ---echo # Reap FTWRL. ---reap unlock tables; connection default; @@ -1018,7 +1011,7 @@ connection $con_aux1; --echo # Check that LOCK TABLES WRITE is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "lock tables t1_base write"; --source include/wait_condition.inc unlock tables; @@ -1062,7 +1055,7 @@ connection $con_aux1; --echo # Check that OPTIMIZE TABLE is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "optimize table t1_base"; --source include/wait_condition.inc unlock tables; @@ -1228,7 +1221,7 @@ connection $con_aux1; --echo # Check that REPAIR TABLE is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "repair table t1_base"; --source include/wait_condition.inc unlock tables; @@ -1427,7 +1420,7 @@ connection $con_aux1; --echo # Wait until SET AUTOCOMMIT=1 is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "set autocommit= 1"; --source include/wait_condition.inc unlock tables; @@ -1449,7 +1442,7 @@ connection $con_aux2; --echo # Wait until FTWRL is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc set debug_sync='now SIGNAL go'; @@ -1628,7 +1621,7 @@ connection $con_aux1; --echo # Wait until XA COMMIT is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "xa commit 'test1'"; --source include/wait_condition.inc unlock tables; @@ -1652,7 +1645,7 @@ connection $con_aux2; --echo # Wait until FTWRL is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc set debug_sync='now SIGNAL go'; @@ -1731,7 +1724,7 @@ connection $con_aux1; --echo # Check that ANALYZE TABLE is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "analyze table t3_trans"; --source include/wait_condition.inc unlock tables; @@ -1806,7 +1799,7 @@ connection $con_aux1; --echo # Check that CHECK TABLE is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "check table t1_base"; --source include/wait_condition.inc unlock tables; @@ -1824,7 +1817,7 @@ connection $con_aux1; --echo # Check that ALTER TABLE is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" and + where state = "Waiting for backup lock" and info = "alter table t1_temp add column c1 int"; --source include/wait_condition.inc unlock tables; @@ -1877,7 +1870,7 @@ connection $con_aux2; --echo # Wait until FTWRL is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc --echo # Try to run another INSERT and see that it is blocked. @@ -1886,7 +1879,7 @@ connection con3; --echo # Wait until new INSERT is blocked. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "insert into t2_base values (1)"; --echo # Unblock INSERT in the first connection. set debug_sync='now SIGNAL go'; @@ -2022,3 +2015,73 @@ set global sql_mode=default; # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc + + +--echo # +--echo # Deadlock between FTWRL under open handler and DDL/LOCK TABLES +--echo # +CREATE TABLE t1(a INT); +HANDLER t1 OPEN; + +--echo # +connect (con1,localhost,root,,); +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready'; +--send LOCK TABLE t1 WRITE + +--echo # +--echo # we need to do it in a separate connection, +--echo # because SET DEBUG_SYNC call open_tables()/mysql_ha_flush() :( +connect (con2,localhost,root,,); +SET DEBUG_SYNC= 'now WAIT_FOR ready'; +disconnect con2; + +--echo # +connection default; +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +HANDLER t1 CLOSE; + +--echo # +connection con1; +reap; +UNLOCK TABLES; +disconnect con1; + +--echo # +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; + + +--echo # +--echo # Make sure pending LOCK TABLES doesn't block FTWRL +--echo # +CREATE TABLE t1(a INT); +LOCK TABLE t1 READ; + +--echo # +connect (con1,localhost,root,,); +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL ready'; +--send LOCK TABLE t1 WRITE + +--echo # +connect (con2,localhost,root,,); +SET DEBUG_SYNC= 'now WAIT_FOR ready'; +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +disconnect con2; + +--echo # +connection default; +UNLOCK TABLES; + +--echo # +connection con1; +reap; +UNLOCK TABLES; +disconnect con1; + +--echo # +connection default; +DROP TABLE t1; +SET DEBUG_SYNC= 'RESET'; diff --git a/mysql-test/main/flush_read_lock_kill.test b/mysql-test/main/flush_read_lock_kill.test index d83e5b3f1df..bd3efd7bdc4 100644 --- a/mysql-test/main/flush_read_lock_kill.test +++ b/mysql-test/main/flush_read_lock_kill.test @@ -51,7 +51,7 @@ SELECT ((@id := kill_id) - kill_id) FROM t1 LIMIT 1; --echo # to active COMMIT let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for commit lock" + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc diff --git a/mysql-test/main/flush_ssl.result b/mysql-test/main/flush_ssl.result new file mode 100644 index 00000000000..e2941db9f95 --- /dev/null +++ b/mysql-test/main/flush_ssl.result @@ -0,0 +1,26 @@ +# Kill the server +connect ssl_con,localhost,root,,,,,SSL; +SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; +# Use a different certificate ("Not after" certificate field changed) +FLUSH SSL; +# Check new certificate used by new connection +Result +OK +# Check that existing SSL connection still works, and uses old certificate, even if new one is loaded in FLUSH SSL +connection ssl_con; +SELECT IF(VARIABLE_VALUE=@ssl_not_after,'OK','FAIL') as Result FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; +Result +OK +disconnect ssl_con; +connection default; +SELECT VARIABLE_NAME NAME, VARIABLE_VALUE VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME in ('Ssl_accepts', 'Ssl_finished_accepts'); +NAME VALUE +SSL_ACCEPTS 1 +SSL_FINISHED_ACCEPTS 1 +FLUSH SSL; +SELECT VARIABLE_NAME NAME, VARIABLE_VALUE VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME in ('Ssl_accepts', 'Ssl_finished_accepts'); +NAME VALUE +SSL_ACCEPTS 0 +SSL_FINISHED_ACCEPTS 0 +# Cleanup +# Kill the server diff --git a/mysql-test/main/flush_ssl.test b/mysql-test/main/flush_ssl.test new file mode 100644 index 00000000000..e7bd57b156a --- /dev/null +++ b/mysql-test/main/flush_ssl.test @@ -0,0 +1,61 @@ +# MDEV-16266 Reload SSL certificate +# This test reloads server SSL certs FLUSH SSL, and checks that +# 1. old SSL connections (that existed before FLUSH) still work and use old certificate +# 2. new SSL connection use new certificate +# 3. if FLUSH SSL runs into error, SSL is still functioning +# SWtatus variable Ssl_server_not_after is used to tell the old certificate from new. + + +source include/have_ssl_communication.inc; + +# Restart server with cert. files located in temp directory +# We are going to remove / replace them within the test, +# so we can't use the ones in std_data directly. + +let $ssl_cert=$MYSQLTEST_VARDIR/tmp/ssl_cert.pem; +let $ssl_key=$MYSQLTEST_VARDIR/tmp/ssl_key.pem; + +copy_file $MYSQL_TEST_DIR/std_data/server-key.pem $ssl_key; +copy_file $MYSQL_TEST_DIR/std_data/server-cert.pem $ssl_cert; + +let $restart_parameters=--ssl-key=$ssl_key --ssl-cert=$ssl_cert; +--source include/kill_mysqld.inc +--source include/start_mysqld.inc + +connect ssl_con,localhost,root,,,,,SSL; +SELECT VARIABLE_VALUE INTO @ssl_not_after FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; +let $ssl_not_after=`SELECT @ssl_not_after`; + +remove_file $ssl_cert; +remove_file $ssl_key; + +--echo # Use a different certificate ("Not after" certificate field changed) +copy_file $MYSQL_TEST_DIR/std_data/server-new-key.pem $ssl_key; +copy_file $MYSQL_TEST_DIR/std_data/server-new-cert.pem $ssl_cert; + +FLUSH SSL; + +--echo # Check new certificate used by new connection +exec $MYSQL --ssl -e "SELECT IF(VARIABLE_VALUE <> '$ssl_not_after', 'OK', 'FAIL') as Result FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'"; + +--echo # Check that existing SSL connection still works, and uses old certificate, even if new one is loaded in FLUSH SSL +connection ssl_con; +SELECT IF(VARIABLE_VALUE=@ssl_not_after,'OK','FAIL') as Result FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_server_not_after'; + +disconnect ssl_con; +connection default; + +SELECT VARIABLE_NAME NAME, VARIABLE_VALUE VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME in ('Ssl_accepts', 'Ssl_finished_accepts'); +FLUSH SSL; +#Check that accepts are zeroed by FLUSH SSL. +SELECT VARIABLE_NAME NAME, VARIABLE_VALUE VALUE FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE VARIABLE_NAME in ('Ssl_accepts', 'Ssl_finished_accepts'); + +--echo # Cleanup +remove_file $ssl_cert; +remove_file $ssl_key; +# restart with usuall SSL +let $restart_parameters=; +--source include/kill_mysqld.inc +--source include/start_mysqld.inc + + diff --git a/mysql-test/main/fulltext.result b/mysql-test/main/fulltext.result index 308d1d7fcb9..3f4223eee07 100644 --- a/mysql-test/main/fulltext.result +++ b/mysql-test/main/fulltext.result @@ -382,10 +382,10 @@ aus Osnabr SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR alter table t1 modify t varchar(200) collate latin1_german2_ci not null; Warnings: -Warning 1366 Incorrect string value: '\xD0\xAD\xD1\x82\xD0\xBE...' for column 't' at row 3 -Warning 1366 Incorrect string value: '\xD0\x9E\xD1\x82\xD0\xBB...' for column 't' at row 4 -Warning 1366 Incorrect string value: '\xD0\x9D\xD0\xB5 \xD0...' for column 't' at row 5 -Warning 1366 Incorrect string value: '\xD0\xB8 \xD0\xB1\xD1...' for column 't' at row 6 +Warning 1366 Incorrect string value: '\xD0\xAD\xD1\x82\xD0\xBE...' for column `test`.`t1`.`t` at row 3 +Warning 1366 Incorrect string value: '\xD0\x9E\xD1\x82\xD0\xBB...' for column `test`.`t1`.`t` at row 4 +Warning 1366 Incorrect string value: '\xD0\x9D\xD0\xB5 \xD0...' for column `test`.`t1`.`t` at row 5 +Warning 1366 Incorrect string value: '\xD0\xB8 \xD0\xB1\xD1...' for column `test`.`t1`.`t` at row 6 SELECT t, collation(t) FROM t1 WHERE MATCH t AGAINST ('Osnabrck'); t collation(t) aus Osnabrck latin1_german2_ci diff --git a/mysql-test/main/func_concat.result b/mysql-test/main/func_concat.result index 9ab6f74653e..acde1be051b 100644 --- a/mysql-test/main/func_concat.result +++ b/mysql-test/main/func_concat.result @@ -268,3 +268,23 @@ SET optimizer_switch=@save_optimizer_switch; SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1; c1 0 +# +# MDEV-13119 Wrong results with CAST(AS CHAR) and subquery +# +SET optimizer_switch=_utf8'derived_merge=on'; +CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1); +INSERT INTO t1 VALUES('abcdefghi'); +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CAST(t AS CHAR CHARACTER SET utf8) t2 FROM t1) sub; +c2 +abcdefghi-abcdefghi +DROP TABLE t1; +SET optimizer_switch=@save_optimizer_switch; +# +# MDEV-13120 Wrong results with MAKE_SET() and subquery +# +CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1); +INSERT INTO t1 VALUES('abcdefghi'); +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; +c2 +abcdefghi,abcdefghi-abcdefghi,abcdefghi +DROP TABLE t1; diff --git a/mysql-test/main/func_concat.test b/mysql-test/main/func_concat.test index 69dd2c4063e..e1bda4be29e 100644 --- a/mysql-test/main/func_concat.test +++ b/mysql-test/main/func_concat.test @@ -242,3 +242,25 @@ SET optimizer_switch=@save_optimizer_switch; --echo # SELECT UNHEX(CONCAT('414C2', HEX(8 + ROUND(RAND()*7)), SUBSTR(SHA(UUID()),6,33),HEX(2+ROUND(RAND()*8)))) IS NULL AS c1; + + +--echo # +--echo # MDEV-13119 Wrong results with CAST(AS CHAR) and subquery +--echo # + +SET optimizer_switch=_utf8'derived_merge=on'; +CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1); +INSERT INTO t1 VALUES('abcdefghi'); +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT CAST(t AS CHAR CHARACTER SET utf8) t2 FROM t1) sub; +DROP TABLE t1; +SET optimizer_switch=@save_optimizer_switch; + + +--echo # +--echo # MDEV-13120 Wrong results with MAKE_SET() and subquery +--echo # + +CREATE TABLE t1 (t VARCHAR(10) CHARSET latin1); +INSERT INTO t1 VALUES('abcdefghi'); +SELECT CONCAT(t2,'-',t2) c2 FROM (SELECT MAKE_SET(3,t,t) t2 FROM t1) sub; +DROP TABLE t1; diff --git a/mysql-test/main/func_default.result b/mysql-test/main/func_default.result index 535be10da86..9699f0795e3 100644 --- a/mysql-test/main/func_default.result +++ b/mysql-test/main/func_default.result @@ -8,13 +8,21 @@ explain extended select default(str), default(strnull), default(intg), default(r id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 100.00 Warnings: -Note 1003 select default('') AS `default(str)`,default('') AS `default(strnull)`,default(0) AS `default(intg)`,default(0) AS `default(rel)` from dual +Note 1003 select default(`test`.`t1`.`str`) AS `default(str)`,default(`test`.`t1`.`strnull`) AS `default(strnull)`,default(`test`.`t1`.`intg`) AS `default(intg)`,default(`test`.`t1`.`rel`) AS `default(rel)` from dual select * from t1 where str <> default(str); str strnull intg rel 0 0 explain select * from t1 where str <> default(str); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 system NULL NULL NULL NULL 1 +create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1; +select * from v1; +default(str) default(strnull) default(intg) default(rel) +def NULL 10 3.14 +show create view v1; +View Create View character_set_client collation_connection +v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select default(`t1`.`str`) AS `default(str)`,default(`t1`.`strnull`) AS `default(strnull)`,default(`t1`.`intg`) AS `default(intg)`,default(`t1`.`rel`) AS `default(rel)` from `t1` latin1 latin1_swedish_ci +drop view v1; drop table t1; CREATE TABLE t1 (id int(11), s varchar(20)); INSERT INTO t1 VALUES (1, 'one'), (2, 'two'), (3, 'three'); diff --git a/mysql-test/main/func_default.test b/mysql-test/main/func_default.test index fbd73990297..332bfca021f 100644 --- a/mysql-test/main/func_default.test +++ b/mysql-test/main/func_default.test @@ -11,6 +11,11 @@ explain extended select default(str), default(strnull), default(intg), default(r select * from t1 where str <> default(str); explain select * from t1 where str <> default(str); +create view v1 as select default(str), default(strnull), default(intg), default(rel) from t1; +select * from v1; +show create view v1; +drop view v1; + #TODO: uncomment when bug will be fixed #create table t2 select default(str), default(strnull), default(intg), default(rel) from t1; #show create table from t1; diff --git a/mysql-test/main/func_extract.result b/mysql-test/main/func_extract.result new file mode 100644 index 00000000000..30ec0460d61 --- /dev/null +++ b/mysql-test/main/func_extract.result @@ -0,0 +1,592 @@ +# +# MDEV-17385 MICROSECOND() returns confusing results with an out-of-range TIME-alike argument +# +CREATE TABLE t1 (v VARCHAR(64), ll BIGINT, t TIME, dt DATETIME, d DATE); +CREATE TABLE t2 AS SELECT +EXTRACT(DAY FROM t), +EXTRACT(DAY_HOUR FROM t), +EXTRACT(DAY_MINUTE FROM t), +EXTRACT(DAY_SECOND FROM t), +EXTRACT(DAY_MICROSECOND FROM t), +EXTRACT(DAY FROM d), +EXTRACT(DAY_HOUR FROM d), +EXTRACT(DAY_MINUTE FROM d), +EXTRACT(DAY_SECOND FROM d), +EXTRACT(DAY_MICROSECOND FROM d), +EXTRACT(DAY FROM v), +EXTRACT(DAY_HOUR FROM v), +EXTRACT(DAY_MINUTE FROM v), +EXTRACT(DAY_SECOND FROM v), +EXTRACT(DAY_MICROSECOND FROM v), +EXTRACT(DAY FROM ll), +EXTRACT(DAY_HOUR FROM ll), +EXTRACT(DAY_MINUTE FROM ll), +EXTRACT(DAY_SECOND FROM ll), +EXTRACT(DAY_MICROSECOND FROM ll) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `EXTRACT(DAY FROM t)` int(3) DEFAULT NULL, + `EXTRACT(DAY_HOUR FROM t)` int(5) DEFAULT NULL, + `EXTRACT(DAY_MINUTE FROM t)` int(7) DEFAULT NULL, + `EXTRACT(DAY_SECOND FROM t)` int(9) DEFAULT NULL, + `EXTRACT(DAY_MICROSECOND FROM t)` bigint(15) DEFAULT NULL, + `EXTRACT(DAY FROM d)` int(3) DEFAULT NULL, + `EXTRACT(DAY_HOUR FROM d)` int(5) DEFAULT NULL, + `EXTRACT(DAY_MINUTE FROM d)` int(7) DEFAULT NULL, + `EXTRACT(DAY_SECOND FROM d)` int(9) DEFAULT NULL, + `EXTRACT(DAY_MICROSECOND FROM d)` bigint(15) DEFAULT NULL, + `EXTRACT(DAY FROM v)` int(8) DEFAULT NULL, + `EXTRACT(DAY_HOUR FROM v)` int(10) DEFAULT NULL, + `EXTRACT(DAY_MINUTE FROM v)` bigint(12) DEFAULT NULL, + `EXTRACT(DAY_SECOND FROM v)` bigint(14) DEFAULT NULL, + `EXTRACT(DAY_MICROSECOND FROM v)` bigint(20) DEFAULT NULL, + `EXTRACT(DAY FROM ll)` int(8) DEFAULT NULL, + `EXTRACT(DAY_HOUR FROM ll)` int(10) DEFAULT NULL, + `EXTRACT(DAY_MINUTE FROM ll)` bigint(12) DEFAULT NULL, + `EXTRACT(DAY_SECOND FROM ll)` bigint(14) DEFAULT NULL, + `EXTRACT(DAY_MICROSECOND FROM ll)` bigint(20) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64), b DECIMAL(32,9)); +INSERT INTO t1 VALUES +('9999-12-31 23:59:59.123456', 99991231235959.123456), +('2001-01-01 10:20:30.123456', 20010101102030.123456), +('4294967296:59:59.123456', 42949672965959.123456), +('4294967295:59:59.123456', 42949672955959.123456), +('87649416:59:59.123456', 876494165959.123456), +('87649415:59:59.123456', 876494155959.123456), +('87649414:59:59.123456', 876494145959.123456), +('9999:59:59.123456', 99995959.123456), +('9999:01:01.123456', 99990101.123456), +('9999:01:01', 99990101), +('0.999999', 0.999999), +('0.99999', 0.99999), +('0.9999', 0.9999), +('0.999', 0.999), +('0.99', 0.99), +('0.9', 0.9), +('000000',0); +# Summary: +# Check that FUNC(varchar) and FUNC(decimal) give equal results +# Expect empty sets +SELECT a, b, EXTRACT(DAY_HOUR FROM a), EXTRACT(DAY_HOUR FROM b) FROM t1 WHERE NOT (EXTRACT(DAY_HOUR FROM a)<=>EXTRACT(DAY_HOUR FROM b)); +a b EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_HOUR FROM b) +SELECT a, b, EXTRACT(DAY FROM a), EXTRACT(DAY FROM b) FROM t1 WHERE NOT (EXTRACT(DAY FROM a)<=>EXTRACT(DAY FROM b)); +a b EXTRACT(DAY FROM a) EXTRACT(DAY FROM b) +SELECT a, b, EXTRACT(HOUR FROM a), EXTRACT(HOUR FROM b) FROM t1 WHERE NOT (EXTRACT(HOUR FROM a)<=>EXTRACT(HOUR FROM b)); +a b EXTRACT(HOUR FROM a) EXTRACT(HOUR FROM b) +SELECT a, b, EXTRACT(MINUTE FROM a), EXTRACT(MINUTE FROM b) FROM t1 WHERE NOT (EXTRACT(MINUTE FROM a)<=>EXTRACT(MINUTE FROM b)); +a b EXTRACT(MINUTE FROM a) EXTRACT(MINUTE FROM b) +SELECT a, b, EXTRACT(SECOND FROM a), EXTRACT(SECOND FROM b) FROM t1 WHERE NOT (EXTRACT(SECOND FROM a)<=>EXTRACT(SECOND FROM b)); +a b EXTRACT(SECOND FROM a) EXTRACT(SECOND FROM b) +SELECT a, b, EXTRACT(MICROSECOND FROM a), EXTRACT(MICROSECOND FROM b) FROM t1 WHERE NOT (EXTRACT(MICROSECOND FROM a)<=>EXTRACT(MICROSECOND FROM b)); +a b EXTRACT(MICROSECOND FROM a) EXTRACT(MICROSECOND FROM b) +# Detailed results +SELECT +a, +CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm, +EXTRACT(DAY FROM a) * 24 + EXTRACT(HOUR FROM a) AS dh, +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a) +FROM t1; +a cidm dh EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a) +9999-12-31 23:59:59.123456 NULL 767 3123 31 23 59 59 123456 +2001-01-01 10:20:30.123456 NULL 34 110 1 10 20 30 123456 +4294967296:59:59.123456 NULL NULL NULL NULL NULL NULL NULL NULL +4294967295:59:59.123456 NULL NULL NULL NULL NULL NULL NULL NULL +87649416:59:59.123456 NULL NULL NULL NULL NULL NULL NULL NULL +87649415:59:59.123456 3652058 23:59:59.123456 87649415 365205823 3652058 23 59 59 123456 +87649414:59:59.123456 3652058 22:59:59.123456 87649414 365205822 3652058 22 59 59 123456 +9999:59:59.123456 416 15:59:59.123456 9999 41615 416 15 59 59 123456 +9999:01:01.123456 416 15:01:01.123456 9999 41615 416 15 1 1 123456 +9999:01:01 416 15:01:01.000000 9999 41615 416 15 1 1 0 +0.999999 00:00:00.999999 0 0 0 0 0 0 999999 +0.99999 00:00:00.999990 0 0 0 0 0 0 999990 +0.9999 00:00:00.999900 0 0 0 0 0 0 999900 +0.999 00:00:00.999000 0 0 0 0 0 0 999000 +0.99 00:00:00.990000 0 0 0 0 0 0 990000 +0.9 00:00:00.900000 0 0 0 0 0 0 900000 +000000 00:00:00.000000 0 0 0 0 0 0 0 +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '9999-12-31 23:59:59.123456' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2001-01-01 10:20:30.123456' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59.123456' +Warning 1292 Incorrect interval value: '4294967296:59:59.123456' +Warning 1292 Incorrect interval value: '4294967296:59:59.123456' +Warning 1292 Incorrect interval value: '4294967296:59:59.123456' +Warning 1292 Incorrect interval value: '4294967296:59:59.123456' +Warning 1292 Incorrect interval value: '4294967296:59:59.123456' +Warning 1292 Incorrect interval value: '4294967296:59:59.123456' +Warning 1292 Incorrect interval value: '4294967296:59:59.123456' +Warning 1292 Incorrect interval value: '4294967296:59:59.123456' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59.123456' +Warning 1292 Incorrect interval value: '4294967295:59:59.123456' +Warning 1292 Incorrect interval value: '4294967295:59:59.123456' +Warning 1292 Incorrect interval value: '4294967295:59:59.123456' +Warning 1292 Incorrect interval value: '4294967295:59:59.123456' +Warning 1292 Incorrect interval value: '4294967295:59:59.123456' +Warning 1292 Incorrect interval value: '4294967295:59:59.123456' +Warning 1292 Incorrect interval value: '4294967295:59:59.123456' +Warning 1292 Incorrect interval value: '4294967295:59:59.123456' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59.123456' +Warning 1292 Incorrect interval value: '87649416:59:59.123456' +Warning 1292 Incorrect interval value: '87649416:59:59.123456' +Warning 1292 Incorrect interval value: '87649416:59:59.123456' +Warning 1292 Incorrect interval value: '87649416:59:59.123456' +Warning 1292 Incorrect interval value: '87649416:59:59.123456' +Warning 1292 Incorrect interval value: '87649416:59:59.123456' +Warning 1292 Incorrect interval value: '87649416:59:59.123456' +Warning 1292 Incorrect interval value: '87649416:59:59.123456' +SELECT +b, +CAST(b AS INTERVAL DAY_SECOND(6)) AS cidm, +EXTRACT(DAY FROM b) * 24 + EXTRACT(HOUR FROM b) AS dh, +EXTRACT(DAY_HOUR FROM b), +EXTRACT(DAY FROM b), +EXTRACT(HOUR FROM b), +EXTRACT(MINUTE FROM b), +EXTRACT(SECOND FROM b), +EXTRACT(MICROSECOND FROM b) +FROM t1; +b cidm dh EXTRACT(DAY_HOUR FROM b) EXTRACT(DAY FROM b) EXTRACT(HOUR FROM b) EXTRACT(MINUTE FROM b) EXTRACT(SECOND FROM b) EXTRACT(MICROSECOND FROM b) +99991231235959.123456000 NULL 767 3123 31 23 59 59 123456 +20010101102030.123456000 NULL 34 110 1 10 20 30 123456 +42949672965959.123456000 NULL NULL NULL NULL NULL NULL NULL NULL +42949672955959.123456000 NULL NULL NULL NULL NULL NULL NULL NULL +876494165959.123456000 NULL NULL NULL NULL NULL NULL NULL NULL +876494155959.123456000 3652058 23:59:59.123456 87649415 365205823 3652058 23 59 59 123456 +876494145959.123456000 3652058 22:59:59.123456 87649414 365205822 3652058 22 59 59 123456 +99995959.123456000 416 15:59:59.123456 9999 41615 416 15 59 59 123456 +99990101.123456000 416 15:01:01.123456 9999 41615 416 15 1 1 123456 +99990101.000000000 416 15:01:01.000000 9999 41615 416 15 1 1 0 +0.999999000 00:00:00.999999 0 0 0 0 0 0 999999 +0.999990000 00:00:00.999990 0 0 0 0 0 0 999990 +0.999900000 00:00:00.999900 0 0 0 0 0 0 999900 +0.999000000 00:00:00.999000 0 0 0 0 0 0 999000 +0.990000000 00:00:00.990000 0 0 0 0 0 0 990000 +0.900000000 00:00:00.900000 0 0 0 0 0 0 900000 +0.000000000 00:00:00.000000 0 0 0 0 0 0 0 +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '99991231235959.123456000' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '20010101102030.123456000' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '42949672965959.123456000' +Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3 +Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3 +Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3 +Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3 +Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3 +Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3 +Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3 +Warning 1292 Incorrect interval value: '42949672965959.123456000' for column `test`.`t1`.`b` at row 3 +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '42949672955959.123456000' +Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect interval value: '42949672955959.123456000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '876494165959.123456000' +Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5 +Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5 +Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5 +Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5 +Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5 +Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5 +Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5 +Warning 1292 Incorrect interval value: '876494165959.123456000' for column `test`.`t1`.`b` at row 5 +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494155959.123456000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494145959.123456000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '99995959.123456000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '99990101.123456000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '99990101.000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.999999000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.999990000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.999900000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.999000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.990000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.900000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.000000000' +DROP TABLE t1; +# Special case: DAY + TIME +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES ('9999-01-01'); +SELECT a, +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY_MINUTE FROM a), +EXTRACT(DAY_SECOND FROM a), +EXTRACT(DAY_MICROSECOND FROM a), +EXTRACT(DAY FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a) +FROM t1; +a EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_MINUTE FROM a) EXTRACT(DAY_SECOND FROM a) EXTRACT(DAY_MICROSECOND FROM a) EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a) +9999-01-01 100 10000 1000000 1000000000000 1 0 0 0 0 +DROP TABLE t1; +# Bad values +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES (''); +SELECT a, +CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm, +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY_MINUTE FROM a), +EXTRACT(DAY_SECOND FROM a), +EXTRACT(DAY_MICROSECOND FROM a), +EXTRACT(DAY FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a) +FROM t1; +a cidm EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_MINUTE FROM a) EXTRACT(DAY_SECOND FROM a) EXTRACT(DAY_MICROSECOND FROM a) EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a) + NULL NULL NULL NULL NULL NULL NULL NULL NULL NULL +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '' +Warning 1292 Incorrect interval value: '' +Warning 1292 Incorrect interval value: '' +Warning 1292 Incorrect interval value: '' +Warning 1292 Incorrect interval value: '' +Warning 1292 Incorrect interval value: '' +Warning 1292 Incorrect interval value: '' +Warning 1292 Incorrect interval value: '' +Warning 1292 Incorrect interval value: '' +Warning 1292 Incorrect interval value: '' +DROP TABLE t1; +# Backward compatibility +# This still parses as DATETIME +SELECT EXTRACT(YEAR FROM '2001/02/03 10:20:30'); +EXTRACT(YEAR FROM '2001/02/03 10:20:30') +2001 +SELECT EXTRACT(MONTH FROM '2001/02/03 10:20:30'); +EXTRACT(MONTH FROM '2001/02/03 10:20:30') +2 +SELECT EXTRACT(DAY FROM '2001/02/03 10:20:30'); +EXTRACT(DAY FROM '2001/02/03 10:20:30') +3 +SELECT EXTRACT(YEAR FROM '01/02/03 10:20:30'); +EXTRACT(YEAR FROM '01/02/03 10:20:30') +2001 +SELECT EXTRACT(MONTH FROM '01/02/03 10:20:30'); +EXTRACT(MONTH FROM '01/02/03 10:20:30') +2 +SELECT EXTRACT(DAY FROM '01/02/03 10:20:30'); +EXTRACT(DAY FROM '01/02/03 10:20:30') +3 +SELECT EXTRACT(YEAR FROM '01:02:03 10:20:30'); +EXTRACT(YEAR FROM '01:02:03 10:20:30') +2001 +SELECT EXTRACT(MONTH FROM '01:02:03 10:20:30'); +EXTRACT(MONTH FROM '01:02:03 10:20:30') +2 +SELECT EXTRACT(DAY FROM '01:02:03 10:20:30'); +EXTRACT(DAY FROM '01:02:03 10:20:30') +3 +# This still parses as DATETIME and returns NULL +SELECT EXTRACT(YEAR FROM "2011-02-32 8:46:06.23434"); +EXTRACT(YEAR FROM "2011-02-32 8:46:06.23434") +NULL +Warnings: +Warning 1292 Incorrect datetime value: '2011-02-32 8:46:06.23434' +SELECT EXTRACT(MONTH FROM "2011-02-32 8:46:06.23434"); +EXTRACT(MONTH FROM "2011-02-32 8:46:06.23434") +NULL +Warnings: +Warning 1292 Incorrect datetime value: '2011-02-32 8:46:06.23434' +SELECT EXTRACT(DAY FROM "2011-02-32 8:46:06.23434"); +EXTRACT(DAY FROM "2011-02-32 8:46:06.23434") +NULL +Warnings: +Warning 1292 Incorrect interval value: '2011-02-32 8:46:06.23434' +SELECT EXTRACT(HOUR FROM "2011-02-32 8:46:06.23434"); +EXTRACT(HOUR FROM "2011-02-32 8:46:06.23434") +NULL +Warnings: +Warning 1292 Incorrect interval value: '2011-02-32 8:46:06.23434' +# This still parses as DATE +SELECT EXTRACT(YEAR FROM '2001/02/03'); +EXTRACT(YEAR FROM '2001/02/03') +2001 +SELECT EXTRACT(MONTH FROM '2001/02/03'); +EXTRACT(MONTH FROM '2001/02/03') +2 +SELECT EXTRACT(DAY FROM '2001/02/03'); +EXTRACT(DAY FROM '2001/02/03') +3 +SELECT EXTRACT(YEAR FROM '01/02/03'); +EXTRACT(YEAR FROM '01/02/03') +2001 +SELECT EXTRACT(MONTH FROM '01/02/03'); +EXTRACT(MONTH FROM '01/02/03') +2 +SELECT EXTRACT(DAY FROM '01/02/03'); +EXTRACT(DAY FROM '01/02/03') +3 +SELECT EXTRACT(YEAR FROM '01-02-03'); +EXTRACT(YEAR FROM '01-02-03') +2001 +SELECT EXTRACT(MONTH FROM '01-02-03'); +EXTRACT(MONTH FROM '01-02-03') +2 +SELECT EXTRACT(DAY FROM '01-02-03'); +EXTRACT(DAY FROM '01-02-03') +3 +SELECT EXTRACT(YEAR FROM '1-2-3'); +EXTRACT(YEAR FROM '1-2-3') +1 +SELECT EXTRACT(MONTH FROM '1-2-3'); +EXTRACT(MONTH FROM '1-2-3') +2 +SELECT EXTRACT(DAY FROM '1-2-3'); +EXTRACT(DAY FROM '1-2-3') +3 +SELECT EXTRACT(HOUR FROM '1-2-3'); +EXTRACT(HOUR FROM '1-2-3') +0 +SELECT EXTRACT(DAY FROM '2024-01-03 garbage /////'); +EXTRACT(DAY FROM '2024-01-03 garbage /////') +3 +Warnings: +Warning 1292 Truncated incorrect date value: '2024-01-03 garbage /////' +SELECT EXTRACT(DAY FROM '24-01-03 garbage /////'); +EXTRACT(DAY FROM '24-01-03 garbage /////') +3 +Warnings: +Warning 1292 Truncated incorrect date value: '24-01-03 garbage /////' +SELECT EXTRACT(DAY FROM '01-02-03'); +EXTRACT(DAY FROM '01-02-03') +3 +SELECT EXTRACT(DAY FROM '24:02:03T'); +EXTRACT(DAY FROM '24:02:03T') +3 +SELECT EXTRACT(DAY FROM '24-02-03'); +EXTRACT(DAY FROM '24-02-03') +3 +SELECT EXTRACT(DAY FROM '24/02/03'); +EXTRACT(DAY FROM '24/02/03') +3 +SELECT EXTRACT(DAY FROM '11111'); +EXTRACT(DAY FROM '11111') +1 +SELECT TIME('2001-01-01T'), TIME('2001-01-01T '); +TIME('2001-01-01T') TIME('2001-01-01T ') +00:00:00 00:00:00 +SELECT TIME('2001/01/01T'), TIME('2001/01/01T '); +TIME('2001/01/01T') TIME('2001/01/01T ') +00:00:00 00:00:00 +SELECT TIME('2001:01:01T'), TIME('2001:01:01T '); +TIME('2001:01:01T') TIME('2001:01:01T ') +00:00:00 00:00:00 +SELECT EXTRACT(DAY FROM '2001-01-01T'), EXTRACT(DAY FROM '2001-01-01T '); +EXTRACT(DAY FROM '2001-01-01T') EXTRACT(DAY FROM '2001-01-01T ') +1 1 +SELECT EXTRACT(DAY FROM '2001/01/01T'), EXTRACT(DAY FROM '2001/01/01T '); +EXTRACT(DAY FROM '2001/01/01T') EXTRACT(DAY FROM '2001/01/01T ') +1 1 +SELECT EXTRACT(DAY FROM '2001:01:01T'), EXTRACT(DAY FROM '2001:01:01T '); +EXTRACT(DAY FROM '2001:01:01T') EXTRACT(DAY FROM '2001:01:01T ') +1 1 +SELECT TIME('2001:01:01T'), TIME('2001:01:01T '); +TIME('2001:01:01T') TIME('2001:01:01T ') +00:00:00 00:00:00 +SELECT EXTRACT(HOUR FROM '2001-01-01T'), EXTRACT(HOUR FROM '2001-01-01T '); +EXTRACT(HOUR FROM '2001-01-01T') EXTRACT(HOUR FROM '2001-01-01T ') +0 0 +SELECT EXTRACT(HOUR FROM '2001/01/01T'), EXTRACT(HOUR FROM '2001/01/01T '); +EXTRACT(HOUR FROM '2001/01/01T') EXTRACT(HOUR FROM '2001/01/01T ') +0 0 +SELECT EXTRACT(HOUR FROM '2001:01:01T'), EXTRACT(HOUR FROM '2001:01:01T '); +EXTRACT(HOUR FROM '2001:01:01T') EXTRACT(HOUR FROM '2001:01:01T ') +0 0 +# This still parses as DATE and returns NULL (without trying TIME) +SELECT EXTRACT(DAY FROM '100000:02:03T'); +EXTRACT(DAY FROM '100000:02:03T') +NULL +Warnings: +Warning 1292 Incorrect interval value: '100000:02:03T' +SELECT EXTRACT(DAY FROM '100000/02/03'); +EXTRACT(DAY FROM '100000/02/03') +NULL +Warnings: +Warning 1292 Incorrect interval value: '100000/02/03' +SELECT EXTRACT(DAY FROM '100000-02-03'); +EXTRACT(DAY FROM '100000-02-03') +NULL +Warnings: +Warning 1292 Incorrect interval value: '100000-02-03' +SELECT EXTRACT(DAY FROM '1111'); +EXTRACT(DAY FROM '1111') +NULL +Warnings: +Warning 1292 Incorrect interval value: '1111' +SELECT EXTRACT(DAY FROM '111'); +EXTRACT(DAY FROM '111') +NULL +Warnings: +Warning 1292 Incorrect interval value: '111' +SELECT EXTRACT(DAY FROM '11'); +EXTRACT(DAY FROM '11') +NULL +Warnings: +Warning 1292 Incorrect interval value: '11' +SELECT EXTRACT(DAY FROM '1'); +EXTRACT(DAY FROM '1') +NULL +Warnings: +Warning 1292 Incorrect interval value: '1' +# This still parses as TIME +SELECT EXTRACT(HOUR FROM '11111'); +EXTRACT(HOUR FROM '11111') +1 +SELECT EXTRACT(HOUR FROM '1111'); +EXTRACT(HOUR FROM '1111') +0 +SELECT EXTRACT(HOUR FROM '111'); +EXTRACT(HOUR FROM '111') +0 +SELECT EXTRACT(HOUR FROM '11'); +EXTRACT(HOUR FROM '11') +0 +SELECT EXTRACT(HOUR FROM '1'); +EXTRACT(HOUR FROM '1') +0 +SELECT TIME('01:02:03:'); +TIME('01:02:03:') +01:02:03 +Warnings: +Warning 1292 Truncated incorrect time value: '01:02:03:' +SELECT TIME('01:02:03-'); +TIME('01:02:03-') +01:02:03 +Warnings: +Warning 1292 Truncated incorrect time value: '01:02:03-' +SELECT TIME('01:02:03;'); +TIME('01:02:03;') +01:02:03 +Warnings: +Warning 1292 Truncated incorrect time value: '01:02:03;' +SELECT TIME('01:02:03/'); +TIME('01:02:03/') +01:02:03 +Warnings: +Warning 1292 Truncated incorrect time value: '01:02:03/' +SELECT EXTRACT(HOUR FROM '01:02:03:'); +EXTRACT(HOUR FROM '01:02:03:') +1 +Warnings: +Warning 1292 Truncated incorrect time value: '01:02:03:' +SELECT EXTRACT(HOUR FROM '01:02:03-'); +EXTRACT(HOUR FROM '01:02:03-') +1 +Warnings: +Warning 1292 Truncated incorrect time value: '01:02:03-' +SELECT EXTRACT(HOUR FROM '01:02:03;'); +EXTRACT(HOUR FROM '01:02:03;') +1 +Warnings: +Warning 1292 Truncated incorrect time value: '01:02:03;' +SELECT EXTRACT(HOUR FROM '01:02:03/'); +EXTRACT(HOUR FROM '01:02:03/') +1 +Warnings: +Warning 1292 Truncated incorrect time value: '01:02:03/' +# Backward compatibility preserved for YEAR and MONTH only +# (behavior has changed for DAY, see below) +SELECT EXTRACT(YEAR FROM '01:02:03'); +EXTRACT(YEAR FROM '01:02:03') +2001 +SELECT EXTRACT(MONTH FROM '01:02:03'); +EXTRACT(MONTH FROM '01:02:03') +2 +SELECT EXTRACT(YEAR FROM '24:01:03 garbage /////'); +EXTRACT(YEAR FROM '24:01:03 garbage /////') +2024 +Warnings: +Warning 1292 Truncated incorrect date value: '24:01:03 garbage /////' +SELECT EXTRACT(MONTH FROM '24:01:03 garbage /////'); +EXTRACT(MONTH FROM '24:01:03 garbage /////') +1 +Warnings: +Warning 1292 Truncated incorrect date value: '24:01:03 garbage /////' +# This still parses as TIME 00:20:01 +SELECT TIME('2001/01/01'); +TIME('2001/01/01') +00:20:01 +Warnings: +Warning 1292 Truncated incorrect time value: '2001/01/01' +SELECT TIME('2001-01-01'); +TIME('2001-01-01') +00:20:01 +Warnings: +Warning 1292 Truncated incorrect time value: '2001-01-01' +# This still parses as TIME and overflows to '838:59:59' +SELECT TIME('2001:01:01'); +TIME('2001:01:01') +838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '2001:01:01' +# This used to parse as DATE, now parses as TIME interval +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2024:01:03 garbage /////'), +('24:01:03 garbage /////'), +('01:01:03 garbage /////'), +('2024:02:03'), +('100000:02:03'), +('24:02:03'), +('01:02:03'), +('01:02:03:'), +('01:02:03-'), +('01:02:03;'), +('01:02:03/'), +('20 10:20:30'); +SELECT +EXTRACT(DAY FROM a), +EXTRACT(DAY_SECOND FROM a), a, +CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm +FROM t1; +EXTRACT(DAY FROM a) EXTRACT(DAY_SECOND FROM a) a cidm +84 84080103 2024:01:03 garbage ///// NULL +1 1000103 24:01:03 garbage ///// NULL +0 10103 01:01:03 garbage ///// NULL +84 84080203 2024:02:03 84 08:02:03.000000 +4166 4166160203 100000:02:03 4166 16:02:03.000000 +1 1000203 24:02:03 1 00:02:03.000000 +0 10203 01:02:03 01:02:03.000000 +0 10203 01:02:03: 01:02:03.000000 +0 10203 01:02:03- NULL +0 10203 01:02:03; 01:02:03.000000 +0 10203 01:02:03/ 01:02:03.000000 +20 20102030 20 10:20:30 20 10:20:30.000000 +Warnings: +Warning 1292 Truncated incorrect time value: '2024:01:03 garbage /////' +Warning 1292 Truncated incorrect time value: '2024:01:03 garbage /////' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2024:01:03 garbage /////' +Warning 1292 Truncated incorrect time value: '24:01:03 garbage /////' +Warning 1292 Truncated incorrect time value: '24:01:03 garbage /////' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '24:01:03 garbage /////' +Warning 1292 Truncated incorrect time value: '01:01:03 garbage /////' +Warning 1292 Truncated incorrect time value: '01:01:03 garbage /////' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '01:01:03 garbage /////' +Warning 1292 Truncated incorrect time value: '01:02:03:' +Warning 1292 Truncated incorrect time value: '01:02:03:' +Warning 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '01:02:03:' +Warning 1292 Truncated incorrect time value: '01:02:03-' +Warning 1292 Truncated incorrect time value: '01:02:03-' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '01:02:03-' +Warning 1292 Truncated incorrect time value: '01:02:03;' +Warning 1292 Truncated incorrect time value: '01:02:03;' +Warning 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '01:02:03;' +Warning 1292 Truncated incorrect time value: '01:02:03/' +Warning 1292 Truncated incorrect time value: '01:02:03/' +Warning 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '01:02:03/' +DROP TABLE t1; diff --git a/mysql-test/main/func_extract.test b/mysql-test/main/func_extract.test new file mode 100644 index 00000000000..edc99b9c00c --- /dev/null +++ b/mysql-test/main/func_extract.test @@ -0,0 +1,257 @@ +--echo # +--echo # MDEV-17385 MICROSECOND() returns confusing results with an out-of-range TIME-alike argument +--echo # + +CREATE TABLE t1 (v VARCHAR(64), ll BIGINT, t TIME, dt DATETIME, d DATE); +CREATE TABLE t2 AS SELECT + EXTRACT(DAY FROM t), + EXTRACT(DAY_HOUR FROM t), + EXTRACT(DAY_MINUTE FROM t), + EXTRACT(DAY_SECOND FROM t), + EXTRACT(DAY_MICROSECOND FROM t), + EXTRACT(DAY FROM d), + EXTRACT(DAY_HOUR FROM d), + EXTRACT(DAY_MINUTE FROM d), + EXTRACT(DAY_SECOND FROM d), + EXTRACT(DAY_MICROSECOND FROM d), + EXTRACT(DAY FROM v), + EXTRACT(DAY_HOUR FROM v), + EXTRACT(DAY_MINUTE FROM v), + EXTRACT(DAY_SECOND FROM v), + EXTRACT(DAY_MICROSECOND FROM v), + EXTRACT(DAY FROM ll), + EXTRACT(DAY_HOUR FROM ll), + EXTRACT(DAY_MINUTE FROM ll), + EXTRACT(DAY_SECOND FROM ll), + EXTRACT(DAY_MICROSECOND FROM ll) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; + + +CREATE TABLE t1 (a VARCHAR(64), b DECIMAL(32,9)); +INSERT INTO t1 VALUES +('9999-12-31 23:59:59.123456', 99991231235959.123456), +('2001-01-01 10:20:30.123456', 20010101102030.123456), +('4294967296:59:59.123456', 42949672965959.123456), +('4294967295:59:59.123456', 42949672955959.123456), +('87649416:59:59.123456', 876494165959.123456), +('87649415:59:59.123456', 876494155959.123456), +('87649414:59:59.123456', 876494145959.123456), +('9999:59:59.123456', 99995959.123456), +('9999:01:01.123456', 99990101.123456), +('9999:01:01', 99990101), +('0.999999', 0.999999), +('0.99999', 0.99999), +('0.9999', 0.9999), +('0.999', 0.999), +('0.99', 0.99), +('0.9', 0.9), +('000000',0); + +--echo # Summary: +--echo # Check that FUNC(varchar) and FUNC(decimal) give equal results +--echo # Expect empty sets +--disable_warnings +SELECT a, b, EXTRACT(DAY_HOUR FROM a), EXTRACT(DAY_HOUR FROM b) FROM t1 WHERE NOT (EXTRACT(DAY_HOUR FROM a)<=>EXTRACT(DAY_HOUR FROM b)); +SELECT a, b, EXTRACT(DAY FROM a), EXTRACT(DAY FROM b) FROM t1 WHERE NOT (EXTRACT(DAY FROM a)<=>EXTRACT(DAY FROM b)); +SELECT a, b, EXTRACT(HOUR FROM a), EXTRACT(HOUR FROM b) FROM t1 WHERE NOT (EXTRACT(HOUR FROM a)<=>EXTRACT(HOUR FROM b)); +SELECT a, b, EXTRACT(MINUTE FROM a), EXTRACT(MINUTE FROM b) FROM t1 WHERE NOT (EXTRACT(MINUTE FROM a)<=>EXTRACT(MINUTE FROM b)); +SELECT a, b, EXTRACT(SECOND FROM a), EXTRACT(SECOND FROM b) FROM t1 WHERE NOT (EXTRACT(SECOND FROM a)<=>EXTRACT(SECOND FROM b)); +SELECT a, b, EXTRACT(MICROSECOND FROM a), EXTRACT(MICROSECOND FROM b) FROM t1 WHERE NOT (EXTRACT(MICROSECOND FROM a)<=>EXTRACT(MICROSECOND FROM b)); +--enable_warnings + +--echo # Detailed results +SELECT + a, + CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm, + EXTRACT(DAY FROM a) * 24 + EXTRACT(HOUR FROM a) AS dh, + EXTRACT(DAY_HOUR FROM a), + EXTRACT(DAY FROM a), + EXTRACT(HOUR FROM a), + EXTRACT(MINUTE FROM a), + EXTRACT(SECOND FROM a), + EXTRACT(MICROSECOND FROM a) +FROM t1; +SELECT + b, + CAST(b AS INTERVAL DAY_SECOND(6)) AS cidm, + EXTRACT(DAY FROM b) * 24 + EXTRACT(HOUR FROM b) AS dh, + EXTRACT(DAY_HOUR FROM b), + EXTRACT(DAY FROM b), + EXTRACT(HOUR FROM b), + EXTRACT(MINUTE FROM b), + EXTRACT(SECOND FROM b), + EXTRACT(MICROSECOND FROM b) +FROM t1; +DROP TABLE t1; + +--echo # Special case: DAY + TIME +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES ('9999-01-01'); +SELECT a, + EXTRACT(DAY_HOUR FROM a), + EXTRACT(DAY_MINUTE FROM a), + EXTRACT(DAY_SECOND FROM a), + EXTRACT(DAY_MICROSECOND FROM a), + EXTRACT(DAY FROM a), + EXTRACT(HOUR FROM a), + EXTRACT(MINUTE FROM a), + EXTRACT(SECOND FROM a), + EXTRACT(MICROSECOND FROM a) +FROM t1; +DROP TABLE t1; + +--echo # Bad values +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES (''); +SELECT a, + CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm, + EXTRACT(DAY_HOUR FROM a), + EXTRACT(DAY_MINUTE FROM a), + EXTRACT(DAY_SECOND FROM a), + EXTRACT(DAY_MICROSECOND FROM a), + EXTRACT(DAY FROM a), + EXTRACT(HOUR FROM a), + EXTRACT(MINUTE FROM a), + EXTRACT(SECOND FROM a), + EXTRACT(MICROSECOND FROM a) +FROM t1; +DROP TABLE t1; + + +--echo # Backward compatibility + +--echo # This still parses as DATETIME +SELECT EXTRACT(YEAR FROM '2001/02/03 10:20:30'); +SELECT EXTRACT(MONTH FROM '2001/02/03 10:20:30'); +SELECT EXTRACT(DAY FROM '2001/02/03 10:20:30'); + +SELECT EXTRACT(YEAR FROM '01/02/03 10:20:30'); +SELECT EXTRACT(MONTH FROM '01/02/03 10:20:30'); +SELECT EXTRACT(DAY FROM '01/02/03 10:20:30'); + +SELECT EXTRACT(YEAR FROM '01:02:03 10:20:30'); +SELECT EXTRACT(MONTH FROM '01:02:03 10:20:30'); +SELECT EXTRACT(DAY FROM '01:02:03 10:20:30'); + +--echo # This still parses as DATETIME and returns NULL + +SELECT EXTRACT(YEAR FROM "2011-02-32 8:46:06.23434"); +SELECT EXTRACT(MONTH FROM "2011-02-32 8:46:06.23434"); +SELECT EXTRACT(DAY FROM "2011-02-32 8:46:06.23434"); +SELECT EXTRACT(HOUR FROM "2011-02-32 8:46:06.23434"); + +--echo # This still parses as DATE + +SELECT EXTRACT(YEAR FROM '2001/02/03'); +SELECT EXTRACT(MONTH FROM '2001/02/03'); +SELECT EXTRACT(DAY FROM '2001/02/03'); + +SELECT EXTRACT(YEAR FROM '01/02/03'); +SELECT EXTRACT(MONTH FROM '01/02/03'); +SELECT EXTRACT(DAY FROM '01/02/03'); + +SELECT EXTRACT(YEAR FROM '01-02-03'); +SELECT EXTRACT(MONTH FROM '01-02-03'); +SELECT EXTRACT(DAY FROM '01-02-03'); + +SELECT EXTRACT(YEAR FROM '1-2-3'); +SELECT EXTRACT(MONTH FROM '1-2-3'); +SELECT EXTRACT(DAY FROM '1-2-3'); +SELECT EXTRACT(HOUR FROM '1-2-3'); + +SELECT EXTRACT(DAY FROM '2024-01-03 garbage /////'); +SELECT EXTRACT(DAY FROM '24-01-03 garbage /////'); +SELECT EXTRACT(DAY FROM '01-02-03'); + +SELECT EXTRACT(DAY FROM '24:02:03T'); +SELECT EXTRACT(DAY FROM '24-02-03'); +SELECT EXTRACT(DAY FROM '24/02/03'); + +SELECT EXTRACT(DAY FROM '11111'); + +SELECT TIME('2001-01-01T'), TIME('2001-01-01T '); +SELECT TIME('2001/01/01T'), TIME('2001/01/01T '); +SELECT TIME('2001:01:01T'), TIME('2001:01:01T '); + +SELECT EXTRACT(DAY FROM '2001-01-01T'), EXTRACT(DAY FROM '2001-01-01T '); +SELECT EXTRACT(DAY FROM '2001/01/01T'), EXTRACT(DAY FROM '2001/01/01T '); +SELECT EXTRACT(DAY FROM '2001:01:01T'), EXTRACT(DAY FROM '2001:01:01T '); + + +SELECT TIME('2001:01:01T'), TIME('2001:01:01T '); +SELECT EXTRACT(HOUR FROM '2001-01-01T'), EXTRACT(HOUR FROM '2001-01-01T '); +SELECT EXTRACT(HOUR FROM '2001/01/01T'), EXTRACT(HOUR FROM '2001/01/01T '); +SELECT EXTRACT(HOUR FROM '2001:01:01T'), EXTRACT(HOUR FROM '2001:01:01T '); + +--echo # This still parses as DATE and returns NULL (without trying TIME) +SELECT EXTRACT(DAY FROM '100000:02:03T'); +SELECT EXTRACT(DAY FROM '100000/02/03'); +SELECT EXTRACT(DAY FROM '100000-02-03'); + +SELECT EXTRACT(DAY FROM '1111'); +SELECT EXTRACT(DAY FROM '111'); +SELECT EXTRACT(DAY FROM '11'); +SELECT EXTRACT(DAY FROM '1'); + + +--echo # This still parses as TIME + +SELECT EXTRACT(HOUR FROM '11111'); +SELECT EXTRACT(HOUR FROM '1111'); +SELECT EXTRACT(HOUR FROM '111'); +SELECT EXTRACT(HOUR FROM '11'); +SELECT EXTRACT(HOUR FROM '1'); + +SELECT TIME('01:02:03:'); +SELECT TIME('01:02:03-'); +SELECT TIME('01:02:03;'); +SELECT TIME('01:02:03/'); + +SELECT EXTRACT(HOUR FROM '01:02:03:'); +SELECT EXTRACT(HOUR FROM '01:02:03-'); +SELECT EXTRACT(HOUR FROM '01:02:03;'); +SELECT EXTRACT(HOUR FROM '01:02:03/'); + +--echo # Backward compatibility preserved for YEAR and MONTH only +--echo # (behavior has changed for DAY, see below) +SELECT EXTRACT(YEAR FROM '01:02:03'); +SELECT EXTRACT(MONTH FROM '01:02:03'); + +SELECT EXTRACT(YEAR FROM '24:01:03 garbage /////'); +SELECT EXTRACT(MONTH FROM '24:01:03 garbage /////'); + +--echo # This still parses as TIME 00:20:01 + +SELECT TIME('2001/01/01'); +SELECT TIME('2001-01-01'); + +--echo # This still parses as TIME and overflows to '838:59:59' +SELECT TIME('2001:01:01'); + + +--echo # This used to parse as DATE, now parses as TIME interval + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2024:01:03 garbage /////'), +('24:01:03 garbage /////'), +('01:01:03 garbage /////'), +('2024:02:03'), +('100000:02:03'), +('24:02:03'), +('01:02:03'), +('01:02:03:'), +('01:02:03-'), +('01:02:03;'), +('01:02:03/'), +('20 10:20:30'); + +SELECT + EXTRACT(DAY FROM a), + EXTRACT(DAY_SECOND FROM a), a, + CAST(a AS INTERVAL DAY_SECOND(6)) AS cidm +FROM t1; +DROP TABLE t1; diff --git a/mysql-test/main/func_group_innodb.result b/mysql-test/main/func_group_innodb.result index 27493ae710b..141d7ccff3a 100644 --- a/mysql-test/main/func_group_innodb.result +++ b/mysql-test/main/func_group_innodb.result @@ -244,6 +244,30 @@ MIN(c) 0 EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range NULL b 263 NULL 3 Using index for group-by +1 SIMPLE t1 range NULL b 263 NULL 2 Using index for group-by DROP TABLE t1; +# +# MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field +# +CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), +KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); +explain +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Select tables optimized away +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +MIN(t1.v1) +king +drop table t1; +CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king'), ('bad'); +explain +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL No matching min/max row +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +MIN(x.v1) +NULL +drop table t1; End of 5.5 tests diff --git a/mysql-test/main/func_group_innodb.test b/mysql-test/main/func_group_innodb.test index 1d175f85ed9..c4914b97641 100644 --- a/mysql-test/main/func_group_innodb.test +++ b/mysql-test/main/func_group_innodb.test @@ -192,4 +192,23 @@ EXPLAIN SELECT MIN(c) FROM t1 GROUP BY b; DROP TABLE t1; +--echo # +--echo # MDEV-17589: Stack-buffer-overflow with indexed varchar (utf8) field +--echo # + +CREATE TABLE t1 (v1 varchar(1020), v2 varchar(2), v3 varchar(2), + KEY k1 (v3,v2,v1)) ENGINE=InnoDB CHARACTER SET=utf8 ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king', 'qu','qu'), ('bad','go','go'); +explain +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +SELECT MIN(t1.v1) FROM t1 where t1.v2='qu' and t1.v3='qu'; +drop table t1; + +CREATE TABLE t1 (v1 varchar(1024) CHARACTER SET utf8, KEY v1 (v1)) ENGINE=InnoDB ROW_FORMAT=DYNAMIC; +INSERT INTO t1 VALUES ('king'), ('bad'); +explain +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +SELECT MIN(x.v1) FROM (SELECT t1.* FROM t1 WHERE t1.v1 >= 'p') x; +drop table t1; + --echo End of 5.5 tests diff --git a/mysql-test/main/func_hybrid_type.result b/mysql-test/main/func_hybrid_type.result index ebf7191a3f7..129d49776a8 100644 --- a/mysql-test/main/func_hybrid_type.result +++ b/mysql-test/main/func_hybrid_type.result @@ -3753,5 +3753,213 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; # +# MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +# +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT +IFNULL(SLEEP(0.01), NULL DIV d) AS f0, +IFNULL(SLEEP(0.01), '' DIV d) AS f1 +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `f0` decimal(1,0) DEFAULT NULL, + `f1` decimal(1,0) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# # End of 10.3 tests # +# +# Start of 10.4 tests +# +# +# MDEV-17325 NULL-ability problems with LEAST() in combination with NO_ZERO_DATE and NO_ZERO_IN_DATE +# +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +SELECT +LEAST('0000-00-00',DATE'2001-01-01') AS s1, +LEAST('0001-00-01',DATE'2001-01-01') AS s2, +LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3, +LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4, +LEAST(0,DATE'2001-01-01') AS i1, +LEAST(20010001,DATE'2001-01-01') AS i2, +LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3, +LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; +Catalog Database Table Table_alias Column Column_alias Type Length Max length Is_null Flags Decimals Charsetnr +def s1 10 10 0 Y 128 0 63 +def s2 10 10 0 Y 128 0 63 +def s3 12 26 0 Y 128 0 63 +def s4 12 26 0 Y 128 0 63 +def i1 10 10 0 Y 128 0 63 +def i2 10 10 0 Y 128 0 63 +def i3 12 19 0 Y 128 0 63 +def i4 12 19 0 Y 128 0 63 +s1 s2 s3 s4 i1 i2 i3 i4 +NULL NULL NULL NULL NULL NULL NULL NULL +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0001-00-01' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0001-00-01 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '2001-00-01' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '2001-00-01 00:00:00' +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +CREATE TABLE t1 AS SELECT +LEAST('0000-00-00',DATE'2001-01-01') AS s1, +LEAST('0001-00-01',DATE'2001-01-01') AS s2, +LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3, +LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4, +LEAST(0,DATE'2001-01-01') AS i1, +LEAST(20010001,DATE'2001-01-01') AS i2, +LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3, +LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0001-00-01' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '0001-00-01 00:00:00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '2001-00-01' +Warning 1292 Incorrect datetime value: '0000-00-00 00:00:00' +Warning 1292 Incorrect datetime value: '2001-00-01 00:00:00' +SELECT * FROM t1; +s1 s2 s3 s4 i1 i2 i3 i4 +NULL NULL NULL NULL NULL NULL NULL NULL +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `s1` date DEFAULT NULL, + `s2` date DEFAULT NULL, + `s3` datetime DEFAULT NULL, + `s4` datetime DEFAULT NULL, + `i1` date DEFAULT NULL, + `i2` date DEFAULT NULL, + `i3` datetime DEFAULT NULL, + `i4` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); +CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; +SELECT * FROM t1; +c1 +2001-01-01 00:00:00 +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET old_mode=ZERO_DATE_TIME_CAST; +CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00 10:20:30' +SELECT * FROM t1; +c1 +NULL +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` datetime DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET old_mode=DEFAULT; +SET timestamp=DEFAULT; +SET sql_mode=DEFAULT; +SET sql_mode=''; +SELECT LEAST(999,TIME'10:20:30') AS c1; +c1 +NULL +Warnings: +Warning 1292 Incorrect time value: '999' +CREATE TABLE t1 AS SELECT LEAST(999,TIME'10:20:30') AS c1; +Warnings: +Warning 1292 Incorrect time value: '999' +SELECT * FROM t1; +c1 +NULL +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c1` time DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-17318 CAST(LEAST(zero_date,non_zero_date) AS numeric_data_type) returns a wrong result +# +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +SELECT +LEAST('0000-00-00',DATE'2001-01-01') AS c0, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS CHAR) AS string, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATE) AS date, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATETIME) AS datetime, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS TIME) AS time, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DECIMAL) AS dc, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DOUBLE) AS dbl, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS SIGNED) AS sint, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS UNSIGNED) AS uint; +c0 string date datetime time dc dbl sint uint +NULL NULL NULL NULL NULL NULL NULL NULL NULL +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +CREATE TABLE t1 AS SELECT +LEAST('0000-00-00',DATE'2001-01-01') AS c0, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS CHAR) AS string, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATE) AS date, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATETIME) AS datetime, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS TIME) AS time, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DECIMAL) AS dc, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DOUBLE) AS dbl, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS SIGNED) AS sint, +CAST(LEAST('0000-00-00',DATE'2001-01-01') AS UNSIGNED) AS uint; +Warnings: +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +Warning 1292 Incorrect datetime value: '0000-00-00' +SELECT * FROM t1; +c0 string date datetime time dc dbl sint uint +NULL NULL NULL NULL NULL NULL NULL NULL NULL +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `c0` date DEFAULT NULL, + `string` varchar(10) DEFAULT NULL, + `date` date DEFAULT NULL, + `datetime` datetime DEFAULT NULL, + `time` time DEFAULT NULL, + `dc` decimal(10,0) DEFAULT NULL, + `dbl` double DEFAULT NULL, + `sint` bigint(10) DEFAULT NULL, + `uint` bigint(20) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-17330 Wrong result for 0 + LEAST(TIME'-10:00:00',TIME'10:00:00') +# +SELECT 0 + LEAST(TIME'-10:00:00',TIME'10:00:00') AS c; +c +-100000 +# +# End of 10.4 tests +# diff --git a/mysql-test/main/func_hybrid_type.test b/mysql-test/main/func_hybrid_type.test index 954c7de53fa..5281d846584 100644 --- a/mysql-test/main/func_hybrid_type.test +++ b/mysql-test/main/func_hybrid_type.test @@ -611,7 +611,128 @@ CREATE TABLE t1 AS SELECT SHOW CREATE TABLE t1; DROP TABLE t1; +--echo # +--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT + IFNULL(SLEEP(0.01), NULL DIV d) AS f0, + IFNULL(SLEEP(0.01), '' DIV d) AS f1 +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; + + --echo # --echo # End of 10.3 tests --echo # +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-17325 NULL-ability problems with LEAST() in combination with NO_ZERO_DATE and NO_ZERO_IN_DATE +--echo # + +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; + +--disable_ps_protocol +--enable_metadata +SELECT + LEAST('0000-00-00',DATE'2001-01-01') AS s1, + LEAST('0001-00-01',DATE'2001-01-01') AS s2, + LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3, + LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4, + LEAST(0,DATE'2001-01-01') AS i1, + LEAST(20010001,DATE'2001-01-01') AS i2, + LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3, + LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; +--disable_metadata +--enable_ps_protocol + +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +CREATE TABLE t1 AS SELECT + LEAST('0000-00-00',DATE'2001-01-01') AS s1, + LEAST('0001-00-01',DATE'2001-01-01') AS s2, + LEAST('0000-00-00',TIMESTAMP'2001-01-01 00:00:00') AS s3, + LEAST('0001-00-01',TIMESTAMP'2001-01-01 00:00:00') AS s4, + LEAST(0,DATE'2001-01-01') AS i1, + LEAST(20010001,DATE'2001-01-01') AS i2, + LEAST(0,TIMESTAMP'2001-01-01 00:00:00') AS i3, + LEAST(20010001,TIMESTAMP'2001-01-01 00:00:00') AS i4; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30'); + +# A TIME always converts to a non-NULL DATETIME with the new CAST style +# Expect a NOT NULL column +CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +# A TIME can convert to a NULL DATETIME with old CAST style +# Expect a NULL-able column +SET old_mode=ZERO_DATE_TIME_CAST; +CREATE TABLE t1 AS SELECT LEAST(CURRENT_DATE,CURRENT_TIME) AS c1; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET old_mode=DEFAULT; +SET timestamp=DEFAULT; + +SET sql_mode=DEFAULT; + +SET sql_mode=''; +SELECT LEAST(999,TIME'10:20:30') AS c1; +CREATE TABLE t1 AS SELECT LEAST(999,TIME'10:20:30') AS c1; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-17318 CAST(LEAST(zero_date,non_zero_date) AS numeric_data_type) returns a wrong result +--echo # +SET sql_mode='NO_ZERO_DATE,NO_ZERO_IN_DATE'; +SELECT + LEAST('0000-00-00',DATE'2001-01-01') AS c0, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS CHAR) AS string, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATE) AS date, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATETIME) AS datetime, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS TIME) AS time, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DECIMAL) AS dc, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DOUBLE) AS dbl, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS SIGNED) AS sint, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS UNSIGNED) AS uint; +CREATE TABLE t1 AS SELECT + LEAST('0000-00-00',DATE'2001-01-01') AS c0, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS CHAR) AS string, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATE) AS date, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DATETIME) AS datetime, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS TIME) AS time, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DECIMAL) AS dc, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS DOUBLE) AS dbl, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS SIGNED) AS sint, + CAST(LEAST('0000-00-00',DATE'2001-01-01') AS UNSIGNED) AS uint; +SELECT * FROM t1; +SHOW CREATE TABLE t1; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-17330 Wrong result for 0 + LEAST(TIME'-10:00:00',TIME'10:00:00') +--echo # +SELECT 0 + LEAST(TIME'-10:00:00',TIME'10:00:00') AS c; + + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/func_in.result b/mysql-test/main/func_in.result index a86781b156c..acf718c453e 100644 --- a/mysql-test/main/func_in.result +++ b/mysql-test/main/func_in.result @@ -481,7 +481,7 @@ SELECT * FROM t4 WHERE a IN ('1972-02-06','19772-07-29'); a 1972-02-06 Warnings: -Warning 1292 Incorrect datetime value: '19772-07-29' +Warning 1292 Truncated incorrect datetime value: '19772-07-29' DROP TABLE t1,t2,t3,t4; CREATE TABLE t1 (id int not null); INSERT INTO t1 VALUES (1),(2); diff --git a/mysql-test/main/func_json.result b/mysql-test/main/func_json.result index cc3764c9ed2..3eae5be2492 100644 --- a/mysql-test/main/func_json.result +++ b/mysql-test/main/func_json.result @@ -791,6 +791,46 @@ SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6'); JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6') {"a": "", "x": 1, "b": ""} # +# MDEV-17121 JSON_ARRAY_APPEND +# +select json_array_append('[ ]', '$', 'aue'); +json_array_append('[ ]', '$', 'aue') +["aue"] +# +# MDEV-17018 JSON_SEARCH and User-Defined Variables. +# +SET @`json` := '["A", [{"B": "1"}], {"C": "AB"}, {"D": "BC"}]', @`value` := 'AB'; +SELECT JSON_SEARCH(@`json`, 'one', @`value`); +JSON_SEARCH(@`json`, 'one', @`value`) +"$[2].C" +SET @`json` := NULL, @`value` := NULL; +# +# MDEV-17001 JSON_MERGE returns nullwhen merging empty array. +# +SELECT JSON_MERGE('[1]', '[]'); +JSON_MERGE('[1]', '[]') +[1] +# +# MDEV-16174 Assertion `0' failed in Type_handler_string_result:: +# make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) +# +SET sql_mode=''; +CREATE TABLE t1 (fld varchar(16) NOT NULL); +CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `JSON_ARRAY_INSERT(fld, '$.[0]', '0')` varchar(25) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET sql_mode=default; +# +# MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1 +# +select JSON_VALID( '{"a":1]' ); +JSON_VALID( '{"a":1]' ) +0 +# # End of 10.2 tests # # diff --git a/mysql-test/main/func_json.test b/mysql-test/main/func_json.test index 4ef752e3d32..09ae35ad653 100644 --- a/mysql-test/main/func_json.test +++ b/mysql-test/main/func_json.test @@ -446,6 +446,44 @@ SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6); SELECT JSON_SET('{}', '$.a', _utf8 0xC3B6, '$.b', _utf8 0xC3B6); SELECT JSON_SET('{}', '$.a', _utf8 X'C3B6', '$.x', 1, '$.b', _utf8 X'C3B6'); +--echo # +--echo # MDEV-17121 JSON_ARRAY_APPEND +--echo # + +select json_array_append('[ ]', '$', 'aue'); + +--echo # +--echo # MDEV-17018 JSON_SEARCH and User-Defined Variables. +--echo # + +SET @`json` := '["A", [{"B": "1"}], {"C": "AB"}, {"D": "BC"}]', @`value` := 'AB'; +SELECT JSON_SEARCH(@`json`, 'one', @`value`); +SET @`json` := NULL, @`value` := NULL; + +--echo # +--echo # MDEV-17001 JSON_MERGE returns nullwhen merging empty array. +--echo # + +SELECT JSON_MERGE('[1]', '[]'); + +--echo # +--echo # MDEV-16174 Assertion `0' failed in Type_handler_string_result:: +--echo # make_sort_key(uchar*, Item*, const SORT_FIELD_ATTR*, Sort_param*) +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (fld varchar(16) NOT NULL); +CREATE TABLE t2 SELECT JSON_ARRAY_INSERT(fld, '$.[0]', '0') FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; +SET sql_mode=default; + +--echo # +--echo # MDEV-17454 JSON_VALID( '{"a":1]' ) evaluates to 1 +--echo # + +select JSON_VALID( '{"a":1]' ); + --echo # --echo # End of 10.2 tests --echo # diff --git a/mysql-test/main/func_like.result b/mysql-test/main/func_like.result index 0ba8e41f164..06a549e94b2 100644 --- a/mysql-test/main/func_like.result +++ b/mysql-test/main/func_like.result @@ -289,3 +289,120 @@ a b c d 3 f_ 1 0 1 3 f\_ 0 1 0 drop table t1; +# +# MDEV-17359 - Extend expression supported by like (| & << >> || + - * / DIV MOD ^ ) +# +SELECT 1 LIKE +1; +1 LIKE +1 +1 +SELECT -1 LIKE -1; +-1 LIKE -1 +1 +SELECT 1 LIKE (1); +1 LIKE (1) +1 +SELECT 1 LIKE 1|2, 3 LIKE 1|2; +1 LIKE 1|2 3 LIKE 1|2 +0 1 +SELECT 1 LIKE 3&2, 2 LIKE 3&2; +1 LIKE 3&2 2 LIKE 3&2 +0 1 +SELECT 1 LIKE 1>>0, 1 LIKE 1>>1 , 64 LIKE 256>>2; +1 LIKE 1>>0 1 LIKE 1>>1 64 LIKE 256>>2 +1 0 1 +SELECT 1 LIKE 1<<0, 1 LIKE 0<<2, 32 LIKE 1<<5; +1 LIKE 1<<0 1 LIKE 0<<2 32 LIKE 1<<5 +1 0 1 +SELECT 1 LIKE 1||2, 1 LIKE 0||2; +1 LIKE 1||2 1 LIKE 0||2 +1 1 +SELECT 2 LIKE 1+1, 2.0 LIKE 1+1.0, 2 LIKE 1+1.0, 1+1 LIKE 2, 1+1 LIKE 0+2; +2 LIKE 1+1 2.0 LIKE 1+1.0 2 LIKE 1+1.0 1+1 LIKE 2 1+1 LIKE 0+2 +1 1 0 1 1 +SELECT 0 LIKE 1-1, 2.0 LIKE 3-1.0, 2 LIKE 3-1.0, 2-1 LIKE 1, 3-1 LIKE 4-1; +0 LIKE 1-1 2.0 LIKE 3-1.0 2 LIKE 3-1.0 2-1 LIKE 1 3-1 LIKE 4-1 +1 1 0 1 0 +SELECT 1 LIKE 1*1, 2.0 LIKE 2*1.0, 2 LIKE 2*1.0, 2*1 LIKE 2, 2*3 LIKE 6*1; +1 LIKE 1*1 2.0 LIKE 2*1.0 2 LIKE 2*1.0 2*1 LIKE 2 2*3 LIKE 6*1 +1 1 0 1 1 +SELECT 1 LIKE 1/1, 1.0000 LIKE 1/1, 1.0000 LIKE 1/1.000000, 1.000000 LIKE 1.0/1.000000, 1/1 like 1/1; +1 LIKE 1/1 1.0000 LIKE 1/1 1.0000 LIKE 1/1.000000 1.000000 LIKE 1.0/1.000000 1/1 like 1/1 +0 1 1 0 1 +SELECT 1 LIKE 1 DIV 1, 1 LIKE 1.0 DIV 1.0 ; +1 LIKE 1 DIV 1 1 LIKE 1.0 DIV 1.0 +1 1 +SELECT 2 LIKE 10 MOD 8, 1.9 LIKE 10 MOD 8.1, 1.9 LIKE 10 MOD 8.10 ; +2 LIKE 10 MOD 8 1.9 LIKE 10 MOD 8.1 1.9 LIKE 10 MOD 8.10 +1 1 0 +SELECT 1 LIKE CAST(1 AS CHAR(10)); +1 LIKE CAST(1 AS CHAR(10)) +1 +SELECT 1 LIKE CASE WHEN 1=1 THEN '1' ELSE '0' END; +1 LIKE CASE WHEN 1=1 THEN '1' ELSE '0' END +1 +SELECT 1 LIKE COALESCE(1+0, 1); +1 LIKE COALESCE(1+0, 1) +1 +CREATE TABLE t1(c1 INTEGER, c2 INTEGER); +INSERT INTO t1 VALUES(1,1); +INSERT INTO t1 VALUES(1,2); +SELECT c1, c2, c1|c2, 1 LIKE c1|c2 FROM t1 ORDER BY c2; +c1 c2 c1|c2 1 LIKE c1|c2 +1 1 1 1 +1 2 3 0 +SELECT c1, c2, c1&c2, 1 LIKE c1&c2 FROM t1 ORDER BY c2; +c1 c2 c1&c2 1 LIKE c1&c2 +1 1 1 1 +1 2 0 0 +SELECT c1, c2, c2>>c1, 1 LIKE c2>>c1 FROM t1 ORDER BY c2; +c1 c2 c2>>c1 1 LIKE c2>>c1 +1 1 0 0 +1 2 1 1 +SELECT c1, c2, c2<>c1, 2 LIKE c2<>c1 2 LIKE c2<> `test`.`t1`.`c1` AS `1 LIKE c2>>c1`,2 like `test`.`t1`.`c2` << `test`.`t1`.`c1` AS `2 LIKE c2< 0 AS `1 LIKE c1||c2`,2 like `test`.`t1`.`c1` + `test`.`t1`.`c2` AS `2 LIKE c1+c2`,-1 like `test`.`t1`.`c1` - `test`.`t1`.`c2` AS `-1 LIKE c1-c2`,2 like `test`.`t1`.`c1` * `test`.`t1`.`c2` AS `2 LIKE c1*c2`,0.5000 like `test`.`t1`.`c1` / `test`.`t1`.`c2` AS `0.5000 LIKE c1/c2`,0 like `test`.`t1`.`c1` DIV `test`.`t1`.`c2` AS `0 LIKE c1 DIV c2`,0 like `test`.`t1`.`c1` MOD `test`.`t1`.`c2` AS `0 LIKE c1 MOD c2` from `test`.`t1` order by `test`.`t1`.`c2` +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/main/func_like.test b/mysql-test/main/func_like.test index 5026bb76aa3..cb50fb91879 100644 --- a/mysql-test/main/func_like.test +++ b/mysql-test/main/func_like.test @@ -207,3 +207,53 @@ insert t1 (a) values ('3 f_'), ('3 f\_'); set sql_mode=default; select * from t1; drop table t1; + +--echo # +--echo # MDEV-17359 - Extend expression supported by like (| & << >> || + - * / DIV MOD ^ ) +--echo # + +SELECT 1 LIKE +1; +SELECT -1 LIKE -1; +SELECT 1 LIKE (1); +SELECT 1 LIKE 1|2, 3 LIKE 1|2; +SELECT 1 LIKE 3&2, 2 LIKE 3&2; +SELECT 1 LIKE 1>>0, 1 LIKE 1>>1 , 64 LIKE 256>>2; +SELECT 1 LIKE 1<<0, 1 LIKE 0<<2, 32 LIKE 1<<5; +SELECT 1 LIKE 1||2, 1 LIKE 0||2; +SELECT 2 LIKE 1+1, 2.0 LIKE 1+1.0, 2 LIKE 1+1.0, 1+1 LIKE 2, 1+1 LIKE 0+2; +SELECT 0 LIKE 1-1, 2.0 LIKE 3-1.0, 2 LIKE 3-1.0, 2-1 LIKE 1, 3-1 LIKE 4-1; +SELECT 1 LIKE 1*1, 2.0 LIKE 2*1.0, 2 LIKE 2*1.0, 2*1 LIKE 2, 2*3 LIKE 6*1; +SELECT 1 LIKE 1/1, 1.0000 LIKE 1/1, 1.0000 LIKE 1/1.000000, 1.000000 LIKE 1.0/1.000000, 1/1 like 1/1; +SELECT 1 LIKE 1 DIV 1, 1 LIKE 1.0 DIV 1.0 ; +SELECT 2 LIKE 10 MOD 8, 1.9 LIKE 10 MOD 8.1, 1.9 LIKE 10 MOD 8.10 ; + +SELECT 1 LIKE CAST(1 AS CHAR(10)); +SELECT 1 LIKE CASE WHEN 1=1 THEN '1' ELSE '0' END; +SELECT 1 LIKE COALESCE(1+0, 1); + +CREATE TABLE t1(c1 INTEGER, c2 INTEGER); +INSERT INTO t1 VALUES(1,1); +INSERT INTO t1 VALUES(1,2); + +SELECT c1, c2, c1|c2, 1 LIKE c1|c2 FROM t1 ORDER BY c2; +SELECT c1, c2, c1&c2, 1 LIKE c1&c2 FROM t1 ORDER BY c2; +SELECT c1, c2, c2>>c1, 1 LIKE c2>>c1 FROM t1 ORDER BY c2; +SELECT c1, c2, c2<>c1, 2 LIKE c2< 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +# +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT +NULL DIV d AS d_null, +'' DIV d AS d_empty_string, +X'32' DIV d AS d_hex_string2, +X'3232' DIV d AS d_hex_string4, +TIME(0) DIV d AS d_time, +CURRENT_DATE DIV d AS d_date, +CURRENT_TIMESTAMP DIV d AS d_datetime +FROM t1; +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: '' +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `d_null` int(1) unsigned DEFAULT NULL, + `d_empty_string` int(1) unsigned DEFAULT NULL, + `d_hex_string2` int(1) unsigned DEFAULT NULL, + `d_hex_string4` int(2) unsigned DEFAULT NULL, + `d_time` int(7) unsigned DEFAULT NULL, + `d_date` int(8) unsigned DEFAULT NULL, + `d_datetime` bigint(14) unsigned DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; +# +# MDEV-18150 Assertion `decimals_to_set <= 38' failed in Item_func_round::fix_length_and_dec_decimal +# +CREATE TABLE t1 (i INT(23)); +SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1; +f +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/func_math.test b/mysql-test/main/func_math.test index a2c54b58a67..5d7c593a63d 100644 --- a/mysql-test/main/func_math.test +++ b/mysql-test/main/func_math.test @@ -897,3 +897,36 @@ LOAD DATA INFILE '../../std_data/loaddata_utf8.dat' INTO TABLE t1 CHARACTER SET SELECT HEX(a), CRC32(a) from t1; DROP TABLE t1; SET NAMES default; + +--echo # +--echo # MDEV-17759 Assertion `precision > 0' failed in decimal_bin_size upon CREATE TABLE .. SELECT +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (d DECIMAL(43,0) UNSIGNED); +INSERT INTO t1 VALUES (1); +CREATE TABLE t2 AS SELECT + NULL DIV d AS d_null, + '' DIV d AS d_empty_string, + X'32' DIV d AS d_hex_string2, + X'3232' DIV d AS d_hex_string4, + TIME(0) DIV d AS d_time, + CURRENT_DATE DIV d AS d_date, + CURRENT_TIMESTAMP DIV d AS d_datetime +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t1, t2; +SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-18150 Assertion `decimals_to_set <= 38' failed in Item_func_round::fix_length_and_dec_decimal +--echo # + +CREATE TABLE t1 (i INT(23)); +SELECT ROUND( i, 18446744073709551594 ) AS f FROM t1; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/func_sapdb.result b/mysql-test/main/func_sapdb.result index 5b9743fb33f..27f1d74bc41 100644 --- a/mysql-test/main/func_sapdb.result +++ b/mysql-test/main/func_sapdb.result @@ -107,9 +107,13 @@ subtime("1997-12-31 23:59:59.000001", "1 1:1:1.000002") select addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999"); addtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") NULL +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '1998-01-01 01:01:01.999999' select subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999"); subtime("1997-12-31 23:59:59.999999", "1998-01-01 01:01:01.999999") NULL +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '1998-01-01 01:01:01.999999' select subtime("01:00:00.999999", "02:00:00.999998"); subtime("01:00:00.999999", "02:00:00.999998") -00:59:59.999999 @@ -180,7 +184,7 @@ select time("1997-12-31 25:59:59.000001"); time("1997-12-31 25:59:59.000001") NULL Warnings: -Warning 1292 Truncated incorrect time value: '1997-12-31 25:59:59.000001' +Warning 1292 Incorrect time value: '1997-12-31 25:59:59.000001' select microsecond("1997-12-31 23:59:59.000001"); microsecond("1997-12-31 23:59:59.000001") 1 diff --git a/mysql-test/main/func_set.result b/mysql-test/main/func_set.result index 73e121f5f2b..3bd9f5e0c9a 100644 --- a/mysql-test/main/func_set.result +++ b/mysql-test/main/func_set.result @@ -172,8 +172,8 @@ INTERVAL( 9, 1, DATE_ADD( pk, INTERVAL pk MINUTE_SECOND ), 9, 8, 3, 5, 2, 1 ) 8 8 Warnings: -Warning 1292 Incorrect datetime value: '10' for column 'pk' at row 1 -Warning 1292 Incorrect datetime value: '11' for column 'pk' at row 2 +Warning 1292 Incorrect datetime value: '10' for column `test`.`t1`.`pk` at row 1 +Warning 1292 Incorrect datetime value: '11' for column `test`.`t1`.`pk` at row 2 DROP TABLE t1; # # End of 5.3 tests diff --git a/mysql-test/main/func_str.result b/mysql-test/main/func_str.result index 07dca08c819..90206a0ce5d 100644 --- a/mysql-test/main/func_str.result +++ b/mysql-test/main/func_str.result @@ -4961,3 +4961,15 @@ DROP TABLE t1; # # End of 10.3 tests # +# +# Start of 10.4 tests +# +# +# MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw +# +SELECT GROUP_CONCAT( UpdateXML( 'new year', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f; +f +2019-01-01 00:00:00F}^i +# +# End of 10.4 tests +# diff --git a/mysql-test/main/func_str.test b/mysql-test/main/func_str.test index 4165e147768..4809b0e872b 100644 --- a/mysql-test/main/func_str.test +++ b/mysql-test/main/func_str.test @@ -1951,3 +1951,19 @@ DROP TABLE t1; --echo # --echo # End of 10.3 tests --echo # + + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-18205 Assertion `str_length < len' failed in Binary_string::realloc_raw +--echo # + +SELECT GROUP_CONCAT( UpdateXML( 'new year', '/a', '2019-01-01 00:00:00' ), ENCODE('text','pass') ) AS f; + + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/func_time.result b/mysql-test/main/func_time.result index 840db182fe7..007f5585c27 100644 --- a/mysql-test/main/func_time.result +++ b/mysql-test/main/func_time.result @@ -367,9 +367,7 @@ extract(DAY_MINUTE FROM "02 10:11:12") 21011 select extract(DAY_SECOND FROM "225 10:11:12"); extract(DAY_SECOND FROM "225 10:11:12") -34225959 -Warnings: -Warning 1292 Truncated incorrect time value: '225 10:11:12' +225101112 select extract(HOUR FROM "1999-01-02 10:11:12"); extract(HOUR FROM "1999-01-02 10:11:12") 10 @@ -941,7 +939,7 @@ f1 select f1 from t1 where cast("2006-1-1" as date) between f1 and cast('zzz' as date); f1 Warnings: -Warning 1292 Incorrect datetime value: 'zzz' +Warning 1292 Truncated incorrect datetime value: 'zzz' select f1 from t1 where makedate(2006,1) between date(f1) and date(f3); f1 2006-01-01 @@ -1033,9 +1031,7 @@ Note 1105 Cast to unsigned converted negative integer to it's positive complemen Warning 1292 Truncated incorrect time value: '18446744073709551615:00:00' SELECT EXTRACT(HOUR FROM '10000:02:03'); EXTRACT(HOUR FROM '10000:02:03') -22 -Warnings: -Warning 1292 Truncated incorrect time value: '10000:02:03' +16 CREATE TABLE t1(f1 TIME); INSERT IGNORE INTO t1 VALUES('916:00:00 a'); Warnings: @@ -1105,7 +1101,7 @@ week(20061108), week(20061108.01), week(20061108085411.000002); isnull(week(now() + 0)) isnull(week(now() + 0.2)) week(20061108) week(20061108.01) week(20061108085411.000002) 0 0 45 45 45 Warnings: -Warning 1292 Truncated incorrect datetime value: '20061108.01' +Note 1292 Truncated incorrect date value: '20061108.01' End of 4.1 tests select time_format('100:00:00', '%H %k %h %I %l'); time_format('100:00:00', '%H %k %h %I %l') @@ -1382,9 +1378,9 @@ SELECT COUNT(*) FROM t1 GROUP BY TIME_TO_SEC(a); COUNT(*) 2 Warnings: -Warning 1292 Truncated incorrect time value: '' -Warning 1292 Truncated incorrect time value: '' -Warning 1292 Truncated incorrect time value: '' +Warning 1292 Incorrect time value: '' +Warning 1292 Incorrect time value: '' +Warning 1292 Incorrect time value: '' DROP TABLE t1; # # Bug#11766112 59151:UNINITIALIZED VALUES IN EXTRACT_DATE_TIME WITH STR_TO_DATE(SPACE(..) ... @@ -1735,7 +1731,7 @@ select 1 from t1 where 1 < some (select cast(a as datetime) from t1); 1 1 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' drop table t1; SET timestamp=DEFAULT; # @@ -1842,7 +1838,7 @@ select cast('131415.123e0' as time); cast('131415.123e0' as time) NULL Warnings: -Warning 1292 Truncated incorrect time value: '131415.123e0' +Warning 1292 Incorrect time value: '131415.123e0' select cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04'; cast('2010-01-02 03:04:05' as datetime) between null and '2010-01-02 03:04:04' 0 @@ -1918,7 +1914,7 @@ select least(1, f1) from t1; least(1, f1) 0000-00-00 00:00:00 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' drop table t1; SET timestamp=UNIX_TIMESTAMP('2014-04-14 10:10:10'); select now() > coalesce(time('21:43:24'), date('2010-05-03')); @@ -2519,7 +2515,7 @@ TIMESTAMP('2001-01-01','10:10:10.12345'), TIMESTAMP('2001-01-01','10:10:10.123456'), TIMESTAMP('2001-01-01','10:10:10.1234567'); Warnings: -Note 1292 Truncated incorrect time value: '10:10:10.1234567' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '10:10:10.1234567' SHOW COLUMNS FROM t1; Field Type Null Key Default Extra TIMESTAMP('2001-01-01','10:10:10') datetime YES NULL @@ -2811,6 +2807,164 @@ PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli')) Warnings: Warning 1292 Truncated incorrect INTEGER value: '-3S\xFA\xDE?\x00\x00\xCA\xB3\xEEE\xA4\xD1\xC1\xA8' # +# MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result +# +SELECT +MAKETIME(1e10,0,0), +MAKETIME(-1e10,0,0), +MAKETIME(1e50,0,0), +MAKETIME(-1e50,0,0), +MAKETIME(COALESCE(1e50),0,0), +MAKETIME(COALESCE(-1e50),0,0); +MAKETIME(1e10,0,0) 838:59:59 +MAKETIME(-1e10,0,0) -838:59:59 +MAKETIME(1e50,0,0) 838:59:59 +MAKETIME(-1e50,0,0) -838:59:59 +MAKETIME(COALESCE(1e50),0,0) 838:59:59 +MAKETIME(COALESCE(-1e50),0,0) -838:59:59 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '10000000000:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '-10000000000:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '9223372036854775807:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '-9223372036854775808:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '9223372036854775807:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '-9223372036854775808:00:00' +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (1e30),(-1e30); +SELECT MAKETIME(a,0,0) FROM t1; +MAKETIME(a,0,0) +838:59:59 +-838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '9223372036854775807:00:00' +Warning 1292 Truncated incorrect time value: '-9223372036854775808:00:00' +DROP TABLE t1; +# +# MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result +# +SELECT MAKETIME(900,0,0); +MAKETIME(900,0,0) +838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.1); +MAKETIME(900,0,0.1) +838:59:59.9 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.11); +MAKETIME(900,0,0.11) +838:59:59.99 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.111); +MAKETIME(900,0,0.111) +838:59:59.999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.1111); +MAKETIME(900,0,0.1111) +838:59:59.9999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.11111); +MAKETIME(900,0,0.11111) +838:59:59.99999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.111111); +MAKETIME(900,0,0.111111) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.1111111); +MAKETIME(900,0,0.1111111) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.11111111); +MAKETIME(900,0,0.11111111) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,0.111111111); +MAKETIME(900,0,0.111111111) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:00' +SELECT MAKETIME(900,0,EXP(1)); +MAKETIME(900,0,EXP(1)) +838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '900:00:02' +SELECT MAKETIME(-900,0,0); +MAKETIME(-900,0,0) +-838:59:59 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.1); +MAKETIME(-900,0,0.1) +-838:59:59.9 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.11); +MAKETIME(-900,0,0.11) +-838:59:59.99 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.111); +MAKETIME(-900,0,0.111) +-838:59:59.999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.1111); +MAKETIME(-900,0,0.1111) +-838:59:59.9999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.11111); +MAKETIME(-900,0,0.11111) +-838:59:59.99999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.111111); +MAKETIME(-900,0,0.111111) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.1111111); +MAKETIME(-900,0,0.1111111) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.11111111); +MAKETIME(-900,0,0.11111111) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,0.111111111); +MAKETIME(-900,0,0.111111111) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:00' +SELECT MAKETIME(-900,0,EXP(1)); +MAKETIME(-900,0,EXP(1)) +-838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect time value: '-900:00:02' +# # End of 5.5 tests # # @@ -2982,7 +3136,7 @@ def EXTRACT(YEAR_MONTH FROM a) 3 6 6 Y 32896 0 63 def EXTRACT(QUARTER FROM a) 3 2 1 Y 32896 0 63 def EXTRACT(MONTH FROM a) 3 2 2 Y 32896 0 63 def EXTRACT(WEEK FROM a) 3 2 2 Y 32896 0 63 -def EXTRACT(DAY FROM a) 3 2 2 Y 32896 0 63 +def EXTRACT(DAY FROM a) 3 3 2 Y 32896 0 63 def EXTRACT(DAY_HOUR FROM a) 3 5 4 Y 32896 0 63 def EXTRACT(DAY_MINUTE FROM a) 3 7 6 Y 32896 0 63 def EXTRACT(DAY_SECOND FROM a) 3 9 8 Y 32896 0 63 @@ -3072,7 +3226,7 @@ t2 CREATE TABLE `t2` ( `EXTRACT(QUARTER FROM a)` int(2) DEFAULT NULL, `EXTRACT(MONTH FROM a)` int(2) DEFAULT NULL, `EXTRACT(WEEK FROM a)` int(2) DEFAULT NULL, - `EXTRACT(DAY FROM a)` int(2) DEFAULT NULL, + `EXTRACT(DAY FROM a)` int(3) DEFAULT NULL, `EXTRACT(DAY_HOUR FROM a)` int(5) DEFAULT NULL, `EXTRACT(DAY_MINUTE FROM a)` int(7) DEFAULT NULL, `EXTRACT(DAY_SECOND FROM a)` int(9) DEFAULT NULL, @@ -3121,7 +3275,7 @@ def EXTRACT(YEAR_MONTH FROM a) 3 6 1 Y 32896 0 63 def EXTRACT(QUARTER FROM a) 3 2 1 Y 32896 0 63 def EXTRACT(MONTH FROM a) 3 2 1 Y 32896 0 63 def EXTRACT(WEEK FROM a) 3 2 9 Y 32896 0 63 -def EXTRACT(DAY FROM a) 3 2 2 Y 32896 0 63 +def EXTRACT(DAY FROM a) 3 3 3 Y 32896 0 63 def EXTRACT(DAY_HOUR FROM a) 3 5 5 Y 32896 0 63 def EXTRACT(DAY_MINUTE FROM a) 3 7 7 Y 32896 0 63 def EXTRACT(DAY_SECOND FROM a) 3 9 9 Y 32896 0 63 @@ -3142,7 +3296,7 @@ EXTRACT(YEAR_MONTH FROM a) 0 EXTRACT(QUARTER FROM a) 0 EXTRACT(MONTH FROM a) 0 EXTRACT(WEEK FROM a) 613566757 -EXTRACT(DAY FROM a) 34 +EXTRACT(DAY FROM a) -34 EXTRACT(DAY_HOUR FROM a) -3422 EXTRACT(DAY_MINUTE FROM a) -342259 EXTRACT(DAY_SECOND FROM a) -34225959 @@ -3208,7 +3362,7 @@ EXTRACT(YEAR_MONTH FROM a) 0 EXTRACT(QUARTER FROM a) 0 EXTRACT(MONTH FROM a) 0 EXTRACT(WEEK FROM a) 613566757 -EXTRACT(DAY FROM a) 34 +EXTRACT(DAY FROM a) -34 EXTRACT(DAY_HOUR FROM a) -3422 EXTRACT(DAY_MINUTE FROM a) -342259 EXTRACT(DAY_SECOND FROM a) -34225959 @@ -3253,7 +3407,7 @@ t2 CREATE TABLE `t2` ( `EXTRACT(QUARTER FROM a)` int(2) DEFAULT NULL, `EXTRACT(MONTH FROM a)` int(2) DEFAULT NULL, `EXTRACT(WEEK FROM a)` int(2) DEFAULT NULL, - `EXTRACT(DAY FROM a)` int(2) DEFAULT NULL, + `EXTRACT(DAY FROM a)` int(3) DEFAULT NULL, `EXTRACT(DAY_HOUR FROM a)` int(5) DEFAULT NULL, `EXTRACT(DAY_MINUTE FROM a)` int(7) DEFAULT NULL, `EXTRACT(DAY_SECOND FROM a)` int(9) DEFAULT NULL, @@ -3274,7 +3428,61 @@ DROP TABLE t1,t2; # End of 10.1 tests # # -# Start of 10.3 tests +# MDEV-16217: Assertion `!table || (!table->read_set || +# bitmap_is_set(table->read_set, field_index))' +# failed in Field_num::get_date +# +CREATE TABLE t1 (pk int default 0, a1 date); +INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL); +CREATE VIEW v1 AS +SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1; +SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1; +a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) +0 +NULL +NULL +NULL +SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1; +a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) +0 +NULL +NULL +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '18446744073709551615' +CREATE TABLE t2 (pk int default 1, a1 date); +INSERT INTO t2 VALUES (4,NULL); +CREATE view v2 as SELECT default(t1.pk), default(t2.pk), t1.pk from t1,t2; +select * from v2; +default(t1.pk) default(t2.pk) pk +0 1 1 +0 1 2 +0 1 3 +0 1 4 +show create view v2; +View Create View character_set_client collation_connection +v2 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v2` AS select default(`t1`.`pk`) AS `default(t1.pk)`,default(`t2`.`pk`) AS `default(t2.pk)`,`t1`.`pk` AS `pk` from (`t1` join `t2`) latin1 latin1_swedish_ci +CREATE view v3 as SELECT default(pk) from t2; +select * from v3; +default(pk) +1 +explain extended select * from v3; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 +Warnings: +Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual +explain extended select default(pk) from t2; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 system NULL NULL NULL NULL 1 100.00 +Warnings: +Note 1003 select default(`test`.`t2`.`pk`) AS `default(pk)` from dual +show create view v3; +View Create View character_set_client collation_connection +v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v3` AS select default(`t2`.`pk`) AS `default(pk)` from `t2` latin1 latin1_swedish_ci +DROP VIEW v1,v2,v3; +DROP TABLE t1,t2; +# +# End of 10.2 tests # # # MDEV-12515 Wrong value when storing DATE_ADD() and ADDTIME() to a numeric field @@ -3419,6 +3627,11 @@ ADDTIME(TIME'10:20:30', DATE'2001-01-01') AS c3, ADDTIME(TIME'10:20:30', COALESCE(DATE'2001-01-01',TIMESTAMP'2001-01-01 00:00:00')) AS c4; c1 c2 c3 c4 NULL NULL NULL NULL +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2001-01-01 00:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2001-01-01 00:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2001-01-01' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2001-01-01 00:00:00' SELECT HOUR(TIMESTAMP'0000-00-01 10:00:00') AS h0, TIME_TO_SEC(TIMESTAMP'0000-00-01 10:00:00') AS tts0, @@ -3590,8 +3803,10 @@ CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2, CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3; c1 c2 c3 2018-08-31 00:00:00 00:00:00 +# # End of 10.3 tests # +# # MDEV-14032 SEC_TO_TIME executes side effect two times # SET @a=10000000; @@ -3620,3 +3835,2474 @@ a f1 was called DROP TABLE t1; DROP FUNCTION f1; +# +# MDEV-17351 MICROSECOND(XXX(int_number_out_of_range)) erroneously returns 999999 +# +# Reject anything that's parsed as DATETIME or DATE +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2001-01-01 10:20:30'), +('01-01-01 10:20:30'), +('2001-01-01 '), +('20010101102030'), +('010101102030'); +SELECT ADDTIME(DATE'2001-01-01',a), a FROM t1; +ADDTIME(DATE'2001-01-01',a) a +NULL 2001-01-01 10:20:30 +NULL 01-01-01 10:20:30 +NULL 2001-01-01 +NULL 20010101102030 +NULL 010101102030 +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2001-01-01 10:20:30' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '01-01-01 10:20:30' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '2001-01-01 ' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '20010101102030' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '010101102030' +DROP TABLE t1; +# GREATEST(decimal, time) +SELECT +GREATEST(8395959, TIME'00:00:00') AS c0, +GREATEST(8395959.0, TIME'00:00:00') AS c1, +GREATEST(8395959.00, TIME'00:00:00') AS c2, +GREATEST(8395959.000, TIME'00:00:00') AS c3, +GREATEST(8395959.0000, TIME'00:00:00') AS c4, +GREATEST(8395959.00000, TIME'00:00:00') AS c5, +GREATEST(8395959.000000, TIME'00:00:00') AS c6, +GREATEST(8395959.0000000, TIME'00:00:00') AS c7; +c0 838:59:59 +c1 838:59:59.9 +c2 838:59:59.99 +c3 838:59:59.999 +c4 838:59:59.9999 +c5 838:59:59.99999 +c6 838:59:59.999999 +c7 838:59:59.999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.0' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.0000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.00000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.0000000' +SELECT +MICROSECOND(GREATEST(8395959, TIME'00:00:00')) AS c0, +MICROSECOND(GREATEST(8395959.0, TIME'00:00:00')) AS c1, +MICROSECOND(GREATEST(8395959.00, TIME'00:00:00')) AS c2, +MICROSECOND(GREATEST(8395959.000, TIME'00:00:00')) AS c3, +MICROSECOND(GREATEST(8395959.0000, TIME'00:00:00')) AS c4, +MICROSECOND(GREATEST(8395959.00000, TIME'00:00:00')) AS c5, +MICROSECOND(GREATEST(8395959.000000, TIME'00:00:00')) AS c6, +MICROSECOND(GREATEST(8395959.0000000, TIME'00:00:00')) AS c7; +c0 0 +c1 900000 +c2 990000 +c3 999000 +c4 999900 +c5 999990 +c6 999999 +c7 999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.0' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.0000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.00000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959.0000000' +SELECT +CAST(GREATEST(8395959, TIME'00:00:00') AS SIGNED) AS ci, +CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,0)) AS c0, +CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,1)) AS c1, +CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,2)) AS c2, +CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,3)) AS c3, +CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,4)) AS c4, +CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,5)) AS c5, +CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,6)) AS c6, +CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,7)) AS c7; +ci 8385959 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +SELECT +GREATEST(8395959, TIME'00:00:00') AS ci, +GREATEST(8395959, TIME'00:00:00')+0 AS c0, +GREATEST(8395959, TIME'00:00:00')+0.0 AS c1, +GREATEST(8395959, TIME'00:00:00')+0.00 AS c2, +GREATEST(8395959, TIME'00:00:00')+0.000 AS c3, +GREATEST(8395959, TIME'00:00:00')+0.0000 AS c4, +GREATEST(8395959, TIME'00:00:00')+0.00000 AS c5, +GREATEST(8395959, TIME'00:00:00')+0.000000 AS c6, +GREATEST(8395959, TIME'00:00:00')+0.0000000 AS c7; +ci 838:59:59 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +Level Warning +Code 1292 +Message Truncated incorrect time value: '8395959' +# GREATEST(string, time) +SELECT +GREATEST('839:59:59', TIME'00:00:00') AS ci, +GREATEST('839:59:59.0', TIME'00:00:00') AS c1, +GREATEST('839:59:59.00', TIME'00:00:00') AS c2, +GREATEST('839:59:59.000', TIME'00:00:00') AS c3, +GREATEST('839:59:59.0000', TIME'00:00:00') AS c4, +GREATEST('839:59:59.00000', TIME'00:00:00') AS c5, +GREATEST('839:59:59.000000', TIME'00:00:00') AS c6, +GREATEST('839:59:59.0000000', TIME'00:00:00') AS c7; +ci 838:59:59 +c1 838:59:59.9 +c2 838:59:59.99 +c3 838:59:59.999 +c4 838:59:59.9999 +c5 838:59:59.99999 +c6 838:59:59.999999 +c7 838:59:59.999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.0' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.0000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.00000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.0000000' +SELECT +MICROSECOND(GREATEST('839:59:59', TIME'00:00:00')) AS ci, +MICROSECOND(GREATEST('839:59:59.0', TIME'00:00:00')) AS c1, +MICROSECOND(GREATEST('839:59:59.00', TIME'00:00:00')) AS c2, +MICROSECOND(GREATEST('839:59:59.000', TIME'00:00:00')) AS c3, +MICROSECOND(GREATEST('839:59:59.0000', TIME'00:00:00')) AS c4, +MICROSECOND(GREATEST('839:59:59.00000', TIME'00:00:00')) AS c5, +MICROSECOND(GREATEST('839:59:59.000000', TIME'00:00:00')) AS c6, +MICROSECOND(GREATEST('839:59:59.0000000', TIME'00:00:00')) AS c7; +ci 0 +c1 900000 +c2 990000 +c3 999000 +c4 999900 +c5 999990 +c6 999999 +c7 999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.0' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.0000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.00000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59.0000000' +SELECT +CAST(GREATEST('839:59:59', TIME'00:00:00') AS SIGNED) AS ci, +CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,0)) AS c0, +CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,1)) AS c1, +CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,2)) AS c2, +CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,3)) AS c3, +CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,4)) AS c4, +CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,5)) AS c5, +CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,6)) AS c6, +CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,7)) AS c7; +ci 8385959 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +GREATEST('839:59:59', TIME'00:00:00') AS ci, +GREATEST('839:59:59', TIME'00:00:00')+0 AS c0, +GREATEST('839:59:59', TIME'00:00:00')+0.0 AS c1, +GREATEST('839:59:59', TIME'00:00:00')+0.00 AS c2, +GREATEST('839:59:59', TIME'00:00:00')+0.000 AS c3, +GREATEST('839:59:59', TIME'00:00:00')+0.0000 AS c4, +GREATEST('839:59:59', TIME'00:00:00')+0.00000 AS c5, +GREATEST('839:59:59', TIME'00:00:00')+0.000000 AS c6, +GREATEST('839:59:59', TIME'00:00:00')+0.0000000 AS c7; +ci 838:59:59 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +# ADDTIME(datetime, decimal) +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0) AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.00) AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.000) AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0000) AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.00000) AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.000000) AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0000000) AS c7; +c0 2001-02-04 23:59:59 +c1 2001-02-04 23:59:59.0 +c2 2001-02-04 23:59:59.00 +c3 2001-02-04 23:59:59.000 +c4 2001-02-04 23:59:59.0000 +c5 2001-02-04 23:59:59.00000 +c6 2001-02-04 23:59:59.000000 +c7 2001-02-04 23:59:59.000000 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.0000000' +SELECT +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)) AS c0, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0)) AS c1, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.00)) AS c2, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.000)) AS c3, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0000)) AS c4, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.00000)) AS c5, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.000000)) AS c6, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0000000)) AS c7; +c0 0 +c1 0 +c2 0 +c3 0 +c4 0 +c5 0 +c6 0 +c7 0 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.0000000' +SELECT +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS SIGNED) AS ci, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,0)) AS c0, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,1)) AS c1, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,2)) AS c2, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,3)) AS c3, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,4)) AS c4, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,5)) AS c5, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,6)) AS c6, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,7)) AS c7; +ci 20010204235959 +c0 20010204235959 +c1 20010204235959.0 +c2 20010204235959.00 +c3 20010204235959.000 +c4 20010204235959.0000 +c5 20010204235959.00000 +c6 20010204235959.000000 +c7 20010204235959.0000000 +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.0000000 AS c7; +ci 2001-02-04 23:59:59 +c0 20010204235959 +c1 20010204235959.0 +c2 20010204235959.00 +c3 20010204235959.000 +c4 20010204235959.0000 +c5 20010204235959.00000 +c6 20010204235959.000000 +c7 20010204235959.0000000 +# ADDTIME(datetime, string) +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0') AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.00') AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.000') AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0000') AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.00000') AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.000000') AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0000000') AS c7; +c0 2001-02-04 23:59:59 +c1 2001-02-04 23:59:59.0 +c2 2001-02-04 23:59:59.00 +c3 2001-02-04 23:59:59.000 +c4 2001-02-04 23:59:59.0000 +c5 2001-02-04 23:59:59.00000 +c6 2001-02-04 23:59:59.000000 +c7 2001-02-04 23:59:59.000000 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '839:59:59.0000000' +SELECT +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')) AS c0, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0')) AS c1, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.00')) AS c2, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.000')) AS c3, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0000')) AS c4, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.00000')) AS c5, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.000000')) AS c6, +MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0000000')) AS c7; +c0 0 +c1 0 +c2 0 +c3 0 +c4 0 +c5 0 +c6 0 +c7 0 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '839:59:59.0000000' +SELECT +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS SIGNED) AS ci, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,0)) AS c0, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,1)) AS c1, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,2)) AS c2, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,3)) AS c3, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,4)) AS c4, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,5)) AS c5, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,6)) AS c6, +CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,7)) AS c7; +ci 20010204235959 +c0 20010204235959 +c1 20010204235959.0 +c2 20010204235959.00 +c3 20010204235959.000 +c4 20010204235959.0000 +c5 20010204235959.00000 +c6 20010204235959.000000 +c7 20010204235959.0000000 +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.0000000 AS c7; +ci 2001-02-04 23:59:59 +c0 20010204235959 +c1 20010204235959.0 +c2 20010204235959.00 +c3 20010204235959.000 +c4 20010204235959.0000 +c5 20010204235959.00000 +c6 20010204235959.000000 +c7 20010204235959.0000000 +# ADDTIME(time, decimal) +SELECT +ADDTIME(TIME'00:00:00', 8395959) AS c0, +ADDTIME(TIME'00:00:00', 8395959.0) AS c1, +ADDTIME(TIME'00:00:00', 8395959.00) AS c2, +ADDTIME(TIME'00:00:00', 8395959.000) AS c3, +ADDTIME(TIME'00:00:00', 8395959.0000) AS c4, +ADDTIME(TIME'00:00:00', 8395959.00000) AS c5, +ADDTIME(TIME'00:00:00', 8395959.000000) AS c6, +ADDTIME(TIME'00:00:00', 8395959.0000000) AS c7; +c0 838:59:59 +c1 838:59:59.9 +c2 838:59:59.99 +c3 838:59:59.999 +c4 838:59:59.9999 +c5 838:59:59.99999 +c6 838:59:59.999999 +c7 838:59:59.999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.0000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +MICROSECOND(ADDTIME(TIME'00:00:00', 8395959)) AS c0, +MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.0)) AS c1, +MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.00)) AS c2, +MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.000)) AS c3, +MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.0000)) AS c4, +MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.00000)) AS c5, +MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.000000)) AS c6, +MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.0000000)) AS c7; +c0 0 +c1 900000 +c2 990000 +c3 999000 +c4 999900 +c5 999990 +c6 999999 +c7 999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.0000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +CAST(ADDTIME(TIME'00:00:00', 8395959) AS SIGNED) AS ci, +CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,0)) AS c0, +CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,1)) AS c1, +CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,2)) AS c2, +CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,3)) AS c3, +CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,4)) AS c4, +CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,5)) AS c5, +CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,6)) AS c6, +CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,7)) AS c7; +ci 8385959 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +ADDTIME(TIME'00:00:00', 8395959) AS ci, +ADDTIME(TIME'00:00:00', 8395959)+0 AS c0, +ADDTIME(TIME'00:00:00', 8395959)+0.0 AS c1, +ADDTIME(TIME'00:00:00', 8395959)+0.00 AS c2, +ADDTIME(TIME'00:00:00', 8395959)+0.000 AS c3, +ADDTIME(TIME'00:00:00', 8395959)+0.0000 AS c4, +ADDTIME(TIME'00:00:00', 8395959)+0.00000 AS c5, +ADDTIME(TIME'00:00:00', 8395959)+0.000000 AS c6, +ADDTIME(TIME'00:00:00', 8395959)+0.0000000 AS c7; +ci 838:59:59 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +# ADDTIME(time,string) +SELECT +ADDTIME(TIME'00:00:00', '839:59:59') AS c0, +ADDTIME(TIME'00:00:00', '839:59:59.0') AS c1, +ADDTIME(TIME'00:00:00', '839:59:59.00') AS c2, +ADDTIME(TIME'00:00:00', '839:59:59.000') AS c3, +ADDTIME(TIME'00:00:00', '839:59:59.0000') AS c4, +ADDTIME(TIME'00:00:00', '839:59:59.00000') AS c5, +ADDTIME(TIME'00:00:00', '839:59:59.000000') AS c6, +ADDTIME(TIME'00:00:00', '839:59:59.0000000') AS c7; +c0 838:59:59 +c1 838:59:59.9 +c2 838:59:59.99 +c3 838:59:59.999 +c4 838:59:59.9999 +c5 838:59:59.99999 +c6 838:59:59.999999 +c7 838:59:59.999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '839:59:59.0000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59')) AS c0, +MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.0')) AS c1, +MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.00')) AS c2, +MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.000')) AS c3, +MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.0000')) AS c4, +MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.00000')) AS c5, +MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.000000')) AS c6, +MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.0000000')) AS c7; +c0 0 +c1 900000 +c2 990000 +c3 999000 +c4 999900 +c5 999990 +c6 999999 +c7 999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '839:59:59.0000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS SIGNED) AS ci, +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,0)) AS c0, +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,1)) AS c1, +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,2)) AS c2, +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,3)) AS c3, +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,4)) AS c4, +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,5)) AS c5, +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,6)) AS c6, +CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,7)) AS c7; +ci 8385959 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +ADDTIME(TIME'00:00:00', '839:59:59') AS ci, +ADDTIME(TIME'00:00:00', '839:59:59')+0 AS c0, +ADDTIME(TIME'00:00:00', '839:59:59')+0.0 AS c1, +ADDTIME(TIME'00:00:00', '839:59:59')+0.00 AS c2, +ADDTIME(TIME'00:00:00', '839:59:59')+0.000 AS c3, +ADDTIME(TIME'00:00:00', '839:59:59')+0.0000 AS c4, +ADDTIME(TIME'00:00:00', '839:59:59')+0.00000 AS c5, +ADDTIME(TIME'00:00:00', '839:59:59')+0.000000 AS c6, +ADDTIME(TIME'00:00:00', '839:59:59')+0.0000000 AS c7; +ci 838:59:59 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +# ADDTIME(int,int) +SELECT +ADDTIME(0, 8395959) AS c, +MICROSECOND(ADDTIME(0, 8395959)) AS cm, +CAST(ADDTIME(0, 8395959) AS SIGNED) AS cs_fixme_mdev_17384, +CAST(ADDTIME(0, 8395959) AS DECIMAL(30,0)) AS cd300; +c 838:59:59 +cm 0 +cs_fixme_mdev_17384 838 +cd300 8385959 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect INTEGER value: '838:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +ADDTIME(20010101000000, 8395959) AS c, +MICROSECOND(ADDTIME(20010101000000, 8395959)) AS cm, +CAST(ADDTIME(20010101000000, 8395959) AS SIGNED) AS cs_fixme_mdev_17384, +CAST(ADDTIME(20010101000000, 8395959) AS DECIMAL(30,0)) AS cd300; +c 2001-02-04 23:59:59 +cm 0 +cs_fixme_mdev_17384 2001 +cd300 20010204235959 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect INTEGER value: '2001-02-04 23:59:59' +# ADDTIME(decimal,int) +# 8385960 in cd300 is correct: addtime returns '838:59:59.9' +# which is further *rounded* to a decimals(30,0) +SELECT +ADDTIME(0.0, 8395959) AS c, +MICROSECOND(ADDTIME(0.0, 8395959)) AS cm, +CAST(ADDTIME(0.0, 8395959) AS SIGNED) AS cs_fixme_mdev_17384, +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,0)) AS cd300; +c 838:59:59.9 +cm 900000 +cs_fixme_mdev_17384 838 +cd300 8385960 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect INTEGER value: '838:59:59.9' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +ADDTIME(20010101000000.0, 8395959) AS c, +MICROSECOND(ADDTIME(20010101000000.0, 8395959)) AS cm, +CAST(ADDTIME(20010101000000.0, 8395959) AS SIGNED) AS cs_fixme_mdev_17384, +CAST(ADDTIME(20010101000000.0, 8395959) AS DECIMAL(30,0)) AS cd300; +c 2001-02-04 23:59:59.0 +cm 0 +cs_fixme_mdev_17384 2001 +cd300 20010204235959 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect INTEGER value: '2001-02-04 23:59:59.0' +# ADDTIME(decimal,decimal) +SELECT +ADDTIME(0.0, 8395959.0) AS c1, +ADDTIME(0.0, 8395959.00) AS c2, +ADDTIME(0.0, 8395959.000) AS c3, +ADDTIME(0.0, 8395959.0000) AS c4, +ADDTIME(0.0, 8395959.00000) AS c5, +ADDTIME(0.0, 8395959.000000) AS c6, +ADDTIME(0.0, 8395959.0000000) AS c7; +c1 838:59:59.9 +c2 838:59:59.99 +c3 838:59:59.999 +c4 838:59:59.9999 +c5 838:59:59.99999 +c6 838:59:59.999999 +c7 838:59:59.999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.0000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +MICROSECOND(ADDTIME(0.0, 8395959.0)) AS c1, +MICROSECOND(ADDTIME(0.0, 8395959.00)) AS c2, +MICROSECOND(ADDTIME(0.0, 8395959.000)) AS c3, +MICROSECOND(ADDTIME(0.0, 8395959.0000)) AS c4, +MICROSECOND(ADDTIME(0.0, 8395959.00000)) AS c5, +MICROSECOND(ADDTIME(0.0, 8395959.000000)) AS c6, +MICROSECOND(ADDTIME(0.0, 8395959.0000000)) AS c7; +c1 900000 +c2 990000 +c3 999000 +c4 999900 +c5 999990 +c6 999999 +c7 999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.0000000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +# 8385960 in c1 is correct: addtime returns '838:59:59.9' +# which is further *rounded* to a decimals(30,0) +SELECT +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,0)) AS c0, +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,1)) AS c1, +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,2)) AS c2, +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,3)) AS c3, +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,4)) AS c4, +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,5)) AS c5, +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,6)) AS c6, +CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,7)) AS c7; +c0 8385960 +c1 8385959.9 +c2 8385959.90 +c3 8385959.900 +c4 8385959.9000 +c5 8385959.90000 +c6 8385959.900000 +c7 8385959.9000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +SELECT +ADDTIME(0.0, 8395959)+0 AS c0, +ADDTIME(0.0, 8395959)+0.0 AS c1, +ADDTIME(0.0, 8395959)+0.00 AS c2, +ADDTIME(0.0, 8395959)+0.000 AS c3, +ADDTIME(0.0, 8395959)+0.0000 AS c4, +ADDTIME(0.0, 8395959)+0.00000 AS c5, +ADDTIME(0.0, 8395959)+0.000000 AS c6, +ADDTIME(0.0, 8395959)+0.0000000 AS c7; +c0 8385959.9 +c1 8385959.9 +c2 8385959.90 +c3 8385959.900 +c4 8385959.9000 +c5 8385959.90000 +c6 8385959.900000 +c7 8385959.9000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '839:59:59' +# TIMESTAMP(string,decimal) +SELECT +TIMESTAMP('2001-01-01', 8395959) AS ci, +TIMESTAMP('2001-01-01', 8395959.0) AS c1, +TIMESTAMP('2001-01-01', 8395959.00) AS c2, +TIMESTAMP('2001-01-01', 8395959.000) AS c3, +TIMESTAMP('2001-01-01', 8395959.0000) AS c4, +TIMESTAMP('2001-01-01', 8395959.00000) AS c5, +TIMESTAMP('2001-01-01', 8395959.000000) AS c6, +TIMESTAMP('2001-01-01', 8395959.0000000) AS c7; +ci 2001-02-04 23:59:59 +c1 2001-02-04 23:59:59.0 +c2 2001-02-04 23:59:59.00 +c3 2001-02-04 23:59:59.000 +c4 2001-02-04 23:59:59.0000 +c5 2001-02-04 23:59:59.00000 +c6 2001-02-04 23:59:59.000000 +c7 2001-02-04 23:59:59.000000 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.0000000' +SELECT +MICROSECOND(TIMESTAMP('2001-01-01', 8395959)) AS ci, +MICROSECOND(TIMESTAMP('2001-01-01', 8395959.0)) AS c1, +MICROSECOND(TIMESTAMP('2001-01-01', 8395959.00)) AS c2, +MICROSECOND(TIMESTAMP('2001-01-01', 8395959.000)) AS c3, +MICROSECOND(TIMESTAMP('2001-01-01', 8395959.0000)) AS c4, +MICROSECOND(TIMESTAMP('2001-01-01', 8395959.00000)) AS c5, +MICROSECOND(TIMESTAMP('2001-01-01', 8395959.000000)) AS c6, +MICROSECOND(TIMESTAMP('2001-01-01', 8395959.0000000)) AS c7; +ci 0 +c1 0 +c2 0 +c3 0 +c4 0 +c5 0 +c6 0 +c7 0 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.0000000' +SELECT +CAST(TIMESTAMP('2001-01-01', 8395959) AS SIGNED) AS ci, +CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,0)) AS c0, +CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,1)) AS c1, +CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,2)) AS c2, +CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,3)) AS c3, +CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,4)) AS c4, +CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,5)) AS c5, +CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,6)) AS c6; +ci 20010204235959 +c0 20010204235959 +c1 20010204235959.0 +c2 20010204235959.00 +c3 20010204235959.000 +c4 20010204235959.0000 +c5 20010204235959.00000 +c6 20010204235959.000000 +SELECT +TIMESTAMP('2001-01-01', 8395959) AS ci, +TIMESTAMP('2001-01-01', 8395959)+0 AS c0, +TIMESTAMP('2001-01-01', 8395959)+0.0 AS c1, +TIMESTAMP('2001-01-01', 8395959)+0.00 AS c2, +TIMESTAMP('2001-01-01', 8395959)+0.000 AS c3, +TIMESTAMP('2001-01-01', 8395959)+0.0000 AS c4, +TIMESTAMP('2001-01-01', 8395959)+0.00000 AS c5, +TIMESTAMP('2001-01-01', 8395959)+0.000000 AS c6, +TIMESTAMP('2001-01-01', 8395959)+0.0000000 AS c7; +ci 2001-02-04 23:59:59 +c0 20010204235959 +c1 20010204235959.0 +c2 20010204235959.00 +c3 20010204235959.000 +c4 20010204235959.0000 +c5 20010204235959.00000 +c6 20010204235959.000000 +c7 20010204235959.0000000 +# TIMESTAMP(string,string) +SELECT +TIMESTAMP('2001-01-01', '839:59:59') AS ci, +TIMESTAMP('2001-01-01', '839:59:59.0') AS c1, +TIMESTAMP('2001-01-01', '839:59:59.00') AS c2, +TIMESTAMP('2001-01-01', '839:59:59.000') AS c3, +TIMESTAMP('2001-01-01', '839:59:59.0000') AS c4, +TIMESTAMP('2001-01-01', '839:59:59.00000') AS c5, +TIMESTAMP('2001-01-01', '839:59:59.000000') AS c6, +TIMESTAMP('2001-01-01', '839:59:59.0000000') AS c7; +ci 2001-02-04 23:59:59 +c1 2001-02-04 23:59:59.0 +c2 2001-02-04 23:59:59.00 +c3 2001-02-04 23:59:59.000 +c4 2001-02-04 23:59:59.0000 +c5 2001-02-04 23:59:59.00000 +c6 2001-02-04 23:59:59.000000 +c7 2001-02-04 23:59:59.000000 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '839:59:59.0000000' +SELECT +MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59')) AS ci, +MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.0')) AS c1, +MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.00')) AS c2, +MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.000')) AS c3, +MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.0000')) AS c4, +MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.00000')) AS c5, +MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.000000')) AS c6, +MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.0000000')) AS c7; +ci 0 +c1 0 +c2 0 +c3 0 +c4 0 +c5 0 +c6 0 +c7 0 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect INTERVAL DAY TO SECOND value: '839:59:59.0000000' +SELECT +CAST(TIMESTAMP('2001-01-01', '839:59:59') AS SIGNED) AS ci, +CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,0)) AS c0, +CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,1)) AS c1, +CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,2)) AS c2, +CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,3)) AS c3, +CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,4)) AS c4, +CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,5)) AS c5, +CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,6)) AS c6; +ci 20010204235959 +c0 20010204235959 +c1 20010204235959.0 +c2 20010204235959.00 +c3 20010204235959.000 +c4 20010204235959.0000 +c5 20010204235959.00000 +c6 20010204235959.000000 +SELECT +TIMESTAMP('2001-01-01', '839:59:59') AS ci, +TIMESTAMP('2001-01-01', '839:59:59')+0 AS c0, +TIMESTAMP('2001-01-01', '839:59:59')+0.0 AS c1, +TIMESTAMP('2001-01-01', '839:59:59')+0.00 AS c2, +TIMESTAMP('2001-01-01', '839:59:59')+0.000 AS c3, +TIMESTAMP('2001-01-01', '839:59:59')+0.0000 AS c4, +TIMESTAMP('2001-01-01', '839:59:59')+0.00000 AS c5, +TIMESTAMP('2001-01-01', '839:59:59')+0.000000 AS c6, +TIMESTAMP('2001-01-01', '839:59:59')+0.0000000 AS c7; +ci 2001-02-04 23:59:59 +c0 20010204235959 +c1 20010204235959.0 +c2 20010204235959.00 +c3 20010204235959.000 +c4 20010204235959.0000 +c5 20010204235959.00000 +c6 20010204235959.000000 +c7 20010204235959.0000000 +# Corner cases for TIMESTAMP(timestamp,xxx) +# HOUR is outside of supported INTERVAL DAYS TO SECONDS range +# Expect NULL with INTERVAL warnings +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('4294967296:00:00', '178956970 16:00:00'); +INSERT INTO t1 VALUES ('4294967295:59:59', '178956970 15:59:59'); +INSERT INTO t1 VALUES ('4294967294:59:59', '178956970 14:59:59'); +INSERT INTO t1 VALUES ('87649416:00:00', '3652059 00:00:00'); +SELECT TIMESTAMP('0001-01-01 00:00:00', a) AS ta, TIMESTAMP('0001-01-01 00:00:00', b) AS tb FROM t1; +ta tb +NULL NULL +NULL NULL +NULL NULL +NULL NULL +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '4294967296:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '178956970 16:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '178956970 15:59:59' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '4294967294:59:59' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '178956970 14:59:59' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '87649416:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '3652059 00:00:00' +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('-4294967296:00:00', '-178956970 16:00:00'); +INSERT INTO t1 VALUES ('-4294967295:59:59', '-178956970 15:59:59'); +INSERT INTO t1 VALUES ('-4294967294:59:59', '-178956970 14:59:59'); +INSERT INTO t1 VALUES ('-87649416:00:00', '-3652059 00:00:00'); +SELECT TIMESTAMP('9999-12-31 23:59:59', a) AS ta, TIMESTAMP('9999-12-31 23:59:59.999999', b) AS tb FROM t1; +ta tb +NULL NULL +NULL NULL +NULL NULL +NULL NULL +Warnings: +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '-4294967296:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '-178956970 16:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '-4294967295:59:59' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '-178956970 15:59:59' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '-4294967294:59:59' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '-178956970 14:59:59' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '-87649416:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '-3652059 00:00:00' +DROP TABLE t1; +# HOUR is OK +# Expect max or near-max DATETIME value + no INTERVAL warnings +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('87649415:59:59.999999', '3652058 23:59:59.999999'); +INSERT INTO t1 VALUES ('87649415:59:59', '3652058 23:59:59'); +SELECT TIMESTAMP('0001-01-01 00:00:00', a) AS ta, TIMESTAMP('0001-01-01 00:00:00', b) AS tb FROM t1; +ta tb +9999-12-31 23:59:59.999999 9999-12-31 23:59:59.999999 +9999-12-31 23:59:59.000000 9999-12-31 23:59:59.000000 +DROP TABLE t1; +# HOUR is OK +# Expect near '0001-01-01 00:00:00' DATETIME value + no INTERVAL warnings +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('-87649415:59:59.999999', '-3652058 23:59:59.999999'); +INSERT INTO t1 VALUES ('-87649415:59:59', '-3652058 23:59:59'); +SELECT TIMESTAMP('9999-12-31 23:59:59', a) AS ta, TIMESTAMP('9999-12-31 23:59:59.999999', b) AS tb FROM t1; +ta tb +NULL 0001-01-01 00:00:00.000000 +0001-01-01 00:00:00.000000 0001-01-01 00:00:00.999999 +DROP TABLE t1; +# HOUR is OK +# Expect NULL on datetime arithmetic overflow + no INTERVAL warnings +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('-00:00:00.000001', '-0 00:00:00.000001'); +SELECT TIMESTAMP('0001-01-01 00:00:00', a) AS ta, TIMESTAMP('0001-01-01 00:00:00', b) AS tb FROM t1; +ta tb +NULL NULL +DROP TABLE t1; +# Corner cases for ADDTIME(timestamp,xxx) +# HOUR is outside of UINT_MAX32 range +# Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959) AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59') AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +# HOUR UINT_MAX32 +# Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959) AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59') AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +# HOUR is max_useful_hour()+1 +# Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959) AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59') AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +# HOUR is max_useful_hour() +# Expect NULL (calc_time_diff overflows ) + no INTERVAL warnings +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959) AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +SELECT +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59') AS ci, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0 AS c0, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.0 AS c1, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.00 AS c2, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.000 AS c3, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.0000 AS c4, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.00000 AS c5, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.000000 AS c6, +ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +# HOUR is max_useful_hour() +# Expect non-NULL + no warnings +SELECT +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959) AS ci, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0 AS c0, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.0 AS c1, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.00 AS c2, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.000 AS c3, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.0000 AS c4, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.00000 AS c5, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.000000 AS c6, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.0000000 AS c7; +ci 9999-12-31 23:59:59 +c0 99991231235959 +c1 99991231235959.0 +c2 99991231235959.00 +c3 99991231235959.000 +c4 99991231235959.0000 +c5 99991231235959.00000 +c6 99991231235959.000000 +c7 99991231235959.0000000 +SELECT +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59') AS ci, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0 AS c0, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.0 AS c1, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.00 AS c2, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.000 AS c3, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.0000 AS c4, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.00000 AS c5, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.000000 AS c6, +ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.0000000 AS c7; +ci 9999-12-31 23:59:59 +c0 99991231235959 +c1 99991231235959.0 +c2 99991231235959.00 +c3 99991231235959.000 +c4 99991231235959.0000 +c5 99991231235959.00000 +c6 99991231235959.000000 +c7 99991231235959.0000000 +# Corner cases for ADDTIME(time,xxx) +# HOUR outside of UINT32 range +# Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT +ADDTIME(TIME'00:00:00', 42949672965959) AS ci, +ADDTIME(TIME'00:00:00', 42949672965959)+0 AS c0, +ADDTIME(TIME'00:00:00', 42949672965959)+0.0 AS c1, +ADDTIME(TIME'00:00:00', 42949672965959)+0.00 AS c2, +ADDTIME(TIME'00:00:00', 42949672965959)+0.000 AS c3, +ADDTIME(TIME'00:00:00', 42949672965959)+0.0000 AS c4, +ADDTIME(TIME'00:00:00', 42949672965959)+0.00000 AS c5, +ADDTIME(TIME'00:00:00', 42949672965959)+0.000000 AS c6, +ADDTIME(TIME'00:00:00', 42949672965959)+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672965959' +SELECT +ADDTIME(TIME'00:00:00', '4294967296:59:59') AS ci, +ADDTIME(TIME'00:00:00', '4294967296:59:59')+0 AS c0, +ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.0 AS c1, +ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.00 AS c2, +ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.000 AS c3, +ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.0000 AS c4, +ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.00000 AS c5, +ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.000000 AS c6, +ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967296:59:59' +# HOUR is UINT_MAX32 (outside of INTERVAL DAY TO SECOND range) +# Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT +ADDTIME(TIME'00:00:00', 42949672955959) AS ci, +ADDTIME(TIME'00:00:00', 42949672955959)+0 AS c0, +ADDTIME(TIME'00:00:00', 42949672955959)+0.0 AS c1, +ADDTIME(TIME'00:00:00', 42949672955959)+0.00 AS c2, +ADDTIME(TIME'00:00:00', 42949672955959)+0.000 AS c3, +ADDTIME(TIME'00:00:00', 42949672955959)+0.0000 AS c4, +ADDTIME(TIME'00:00:00', 42949672955959)+0.00000 AS c5, +ADDTIME(TIME'00:00:00', 42949672955959)+0.000000 AS c6, +ADDTIME(TIME'00:00:00', 42949672955959)+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '42949672955959' +SELECT +ADDTIME(TIME'00:00:00', '4294967295:59:59') AS ci, +ADDTIME(TIME'00:00:00', '4294967295:59:59')+0 AS c0, +ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.0 AS c1, +ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.00 AS c2, +ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.000 AS c3, +ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.0000 AS c4, +ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.00000 AS c5, +ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.000000 AS c6, +ADDTIME(TIME'00:00:00', '4294967295;00:00')+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '4294967295;00:00' +# HOUR is max_useful_hour()+1 (outside of INTERVAL DAY TO SECOND range) +# Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT +ADDTIME(TIME'00:00:00', 876494165959) AS ci, +ADDTIME(TIME'00:00:00', 876494165959)+0 AS c0, +ADDTIME(TIME'00:00:00', 876494165959)+0.0 AS c1, +ADDTIME(TIME'00:00:00', 876494165959)+0.00 AS c2, +ADDTIME(TIME'00:00:00', 876494165959)+0.000 AS c3, +ADDTIME(TIME'00:00:00', 876494165959)+0.0000 AS c4, +ADDTIME(TIME'00:00:00', 876494165959)+0.00000 AS c5, +ADDTIME(TIME'00:00:00', 876494165959)+0.000000 AS c6, +ADDTIME(TIME'00:00:00', 876494165959)+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +SELECT +ADDTIME(TIME'00:00:00', '87649416:59:59') AS ci, +ADDTIME(TIME'00:00:00', '87649416:59:59')+0 AS c0, +ADDTIME(TIME'00:00:00', '87649416:59:59')+0.0 AS c1, +ADDTIME(TIME'00:00:00', '87649416:59:59')+0.00 AS c2, +ADDTIME(TIME'00:00:00', '87649416:59:59')+0.000 AS c3, +ADDTIME(TIME'00:00:00', '87649416:59:59')+0.0000 AS c4, +ADDTIME(TIME'00:00:00', '87649416:59:59')+0.00000 AS c5, +ADDTIME(TIME'00:00:00', '87649416:59:59')+0.000000 AS c6, +ADDTIME(TIME'00:00:00', '87649416:59:59')+0.0000000 AS c7; +ci NULL +c0 NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +c7 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +# HOUR is max_useful_hour()+1 (outside of INTERVAL DAY TO SECOND range) +# Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT +ADDTIME(TIME'-838:59:59', 876494165959) AS ci, +ADDTIME(TIME'-838:59:59.9', 876494165959) AS c1, +ADDTIME(TIME'-838:59:59.99', 876494165959) AS c2, +ADDTIME(TIME'-838:59:59.999', 876494165959) AS c3, +ADDTIME(TIME'-838:59:59.9999', 876494165959) AS c4, +ADDTIME(TIME'-838:59:59.99999', 876494165959) AS c5, +ADDTIME(TIME'-838:59:59.999999', 876494165959) AS c6; +ci NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '876494165959' +SELECT +ADDTIME(TIME'-838:59:59', '87649416:59:59') AS ci, +ADDTIME(TIME'-838:59:59.9', '87649416:59:59') AS c1, +ADDTIME(TIME'-838:59:59.99', '87649416:59:59') AS c2, +ADDTIME(TIME'-838:59:59.999', '87649416:59:59') AS c3, +ADDTIME(TIME'-838:59:59.9999', '87649416:59:59') AS c4, +ADDTIME(TIME'-838:59:59.99999', '87649416:59:59') AS c5, +ADDTIME(TIME'-838:59:59.999999', '87649416:59:59') AS c6; +ci NULL +c1 NULL +c2 NULL +c3 NULL +c4 NULL +c5 NULL +c6 NULL +Warnings: +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +Level Warning +Code 1292 +Message Incorrect INTERVAL DAY TO SECOND value: '87649416:59:59' +SELECT +ADDTIME(TIME'-838:59:59.9999999', '87649416:59:59') AS c7; +c7 NULL +# HOUR is max_useful_hour() (inside INTERVAL DAY TO SECOND range) +# Expect max TIME(0) + zero fraction + TIME warnings + no INTEVAL warnings +SELECT +ADDTIME(TIME'00:00:00', 876494155959) AS ci, +ADDTIME(TIME'00:00:00', 876494155959)+0 AS c0, +ADDTIME(TIME'00:00:00', 876494155959)+0.0 AS c1, +ADDTIME(TIME'00:00:00', 876494155959)+0.00 AS c2, +ADDTIME(TIME'00:00:00', 876494155959)+0.000 AS c3, +ADDTIME(TIME'00:00:00', 876494155959)+0.0000 AS c4, +ADDTIME(TIME'00:00:00', 876494155959)+0.00000 AS c5, +ADDTIME(TIME'00:00:00', 876494155959)+0.000000 AS c6, +ADDTIME(TIME'00:00:00', 876494155959)+0.0000000 AS c7; +ci 838:59:59 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +SELECT +ADDTIME(TIME'00:00:00', '87649415:59:59') AS ci, +ADDTIME(TIME'00:00:00', '87649415:59:59')+0 AS c0, +ADDTIME(TIME'00:00:00', '87649415:59:59')+0.0 AS c1, +ADDTIME(TIME'00:00:00', '87649415:59:59')+0.00 AS c2, +ADDTIME(TIME'00:00:00', '87649415:59:59')+0.000 AS c3, +ADDTIME(TIME'00:00:00', '87649415:59:59')+0.0000 AS c4, +ADDTIME(TIME'00:00:00', '87649415:59:59')+0.00000 AS c5, +ADDTIME(TIME'00:00:00', '87649415:59:59')+0.000000 AS c6, +ADDTIME(TIME'00:00:00', '87649415:59:59')+0.0000000 AS c7; +ci 838:59:59 +c0 8385959 +c1 8385959.0 +c2 8385959.00 +c3 8385959.000 +c4 8385959.0000 +c5 8385959.00000 +c6 8385959.000000 +c7 8385959.0000000 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87649415:59:59' +# HOUR is max_useful_hour() (inside INTERVAL DAY TO SECOND range) +# Expect max TIME(N) + TIME warnings + no INTERVAL warnings +SELECT +ADDTIME(TIME'-838:59:59', 876494155959) AS ci, +ADDTIME(TIME'-838:59:59.9', 876494155959) AS c1, +ADDTIME(TIME'-838:59:59.99', 876494155959) AS c2, +ADDTIME(TIME'-838:59:59.999', 876494155959) AS c3, +ADDTIME(TIME'-838:59:59.9999', 876494155959) AS c4, +ADDTIME(TIME'-838:59:59.99999', 876494155959) AS c5, +ADDTIME(TIME'-838:59:59.999999', 876494155959) AS c6; +ci 838:59:59 +c1 838:59:59.9 +c2 838:59:59.99 +c3 838:59:59.999 +c4 838:59:59.9999 +c5 838:59:59.99999 +c6 838:59:59.999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648577:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.100000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.010000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.001000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.000100' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.000010' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.000001' +SELECT +ADDTIME(TIME'-838:59:59', '87649415:59:59') AS ci, +ADDTIME(TIME'-838:59:59.9', '87649415:59:59') AS c1, +ADDTIME(TIME'-838:59:59.99', '87649415:59:59') AS c2, +ADDTIME(TIME'-838:59:59.999', '87649415:59:59') AS c3, +ADDTIME(TIME'-838:59:59.9999', '87649415:59:59') AS c4, +ADDTIME(TIME'-838:59:59.99999', '87649415:59:59') AS c5, +ADDTIME(TIME'-838:59:59.999999', '87649415:59:59') AS c6; +ci 838:59:59 +c1 838:59:59.9 +c2 838:59:59.99 +c3 838:59:59.999 +c4 838:59:59.9999 +c5 838:59:59.99999 +c6 838:59:59.999999 +Warnings: +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648577:00:00' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.100000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.010000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.001000' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.000100' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.000010' +Level Warning +Code 1292 +Message Truncated incorrect time value: '87648576:59:59.000001' +SELECT +ADDTIME(TIME'-838:59:59.9999999', '87649415:59:59') AS c7; +c7 838:59:59.999999 +# +# MDEV-17400 The result of TIME('42949672965959-01') depends on architecture +# +SELECT TIME('42949672955959-01'), TIME('42949672965959-01'); +TIME('42949672955959-01') TIME('42949672965959-01') +NULL NULL +Warnings: +Warning 1292 Incorrect time value: '42949672955959-01' +Warning 1292 Incorrect time value: '42949672965959-01' +SELECT TIME('18446744073709551615-01'), TIME('18446744073709551616-01'); +TIME('18446744073709551615-01') TIME('18446744073709551616-01') +NULL NULL +Warnings: +Warning 1292 Incorrect time value: '18446744073709551615-01' +Warning 1292 Incorrect time value: '18446744073709551616-01' +# +# MDEV-17434 EXTRACT(DAY FROM negative_time) returns wrong result +# +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('-24:10:10.10'); +SELECT +EXTRACT(MINUTE FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a), +EXTRACT(DAY FROM a), +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY_MINUTE FROM a), +EXTRACT(DAY_SECOND FROM a), +EXTRACT(DAY_MICROSECOND FROM a) +FROM t1; +EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a) EXTRACT(DAY FROM a) EXTRACT(DAY_HOUR FROM a) EXTRACT(DAY_MINUTE FROM a) EXTRACT(DAY_SECOND FROM a) EXTRACT(DAY_MICROSECOND FROM a) +-10 -10 -100000 -1 -100 -10010 -1001010 -1001010100000 +CREATE TABLE t2 AS +SELECT +EXTRACT(MINUTE FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a), +EXTRACT(DAY FROM a), +EXTRACT(DAY_HOUR FROM a), +EXTRACT(DAY_MINUTE FROM a), +EXTRACT(DAY_SECOND FROM a), +EXTRACT(DAY_MICROSECOND FROM a) +FROM t1; +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `EXTRACT(MINUTE FROM a)` int(3) DEFAULT NULL, + `EXTRACT(SECOND FROM a)` int(3) DEFAULT NULL, + `EXTRACT(MICROSECOND FROM a)` int(7) DEFAULT NULL, + `EXTRACT(DAY FROM a)` int(3) DEFAULT NULL, + `EXTRACT(DAY_HOUR FROM a)` int(5) DEFAULT NULL, + `EXTRACT(DAY_MINUTE FROM a)` int(7) DEFAULT NULL, + `EXTRACT(DAY_SECOND FROM a)` int(9) DEFAULT NULL, + `EXTRACT(DAY_MICROSECOND FROM a)` bigint(15) DEFAULT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t2; +DROP TABLE t1; +# +# MDEV-17478 Wrong result for TIME('+100:20:30') +# +SELECT TIME('+100:20:30'); +TIME('+100:20:30') +100:20:30 +# +# MDEV-17477 Wrong result for TIME('-2001-01-01 10:20:30') +# +SELECT TIME('-2001-01-01 10:20:30'); +TIME('-2001-01-01 10:20:30') +NULL +Warnings: +Warning 1292 Incorrect time value: '-2001-01-01 10:20:30' +SELECT TIME('2001-01-01') AS c1, TIME('2001-01-01 ') AS c2; +c1 c2 +00:20:01 00:20:01 +Warnings: +Warning 1292 Truncated incorrect time value: '2001-01-01' +Warning 1292 Truncated incorrect time value: '2001-01-01 ' +SELECT TIME('0001:01:01 '), TIME('0001:01:01 '); +TIME('0001:01:01 ') TIME('0001:01:01 ') +01:01:01 01:01:01 +SELECT TIME('1 2'), TIME('1 2 '); +TIME('1 2') TIME('1 2 ') +00:00:01 00:00:01 +Warnings: +Warning 1292 Truncated incorrect time value: '1 2' +Warning 1292 Truncated incorrect time value: '1 2 ' +SELECT TIME('2001-01-01T'), TIME('2001-01-01T '); +TIME('2001-01-01T') TIME('2001-01-01T ') +00:00:00 00:00:00 +SELECT TIME('901-01-01T1'), TIME('901-01-01T10'); +TIME('901-01-01T1') TIME('901-01-01T10') +01:00:00 10:00:00 +SELECT TIME('091-01-01T1'), TIME('091-01-01T10'); +TIME('091-01-01T1') TIME('091-01-01T10') +01:00:00 10:00:00 +SELECT TIME('0001:01:01x'), TIME('0001:01:01xx'); +TIME('0001:01:01x') TIME('0001:01:01xx') +01:01:01 01:01:01 +Warnings: +Warning 1292 Truncated incorrect time value: '0001:01:01x' +Warning 1292 Truncated incorrect time value: '0001:01:01xx' +SELECT TIME('0001:01:01.'), TIME('0001:01:01..'); +TIME('0001:01:01.') TIME('0001:01:01..') +01:01:01 01:01:01 +Warnings: +Warning 1292 Truncated incorrect time value: '0001:01:01..' +SELECT TIME('0001:01:01-'), TIME('0001:01:01--'); +TIME('0001:01:01-') TIME('0001:01:01--') +01:01:01 01:01:01 +Warnings: +Warning 1292 Truncated incorrect time value: '0001:01:01-' +Warning 1292 Truncated incorrect time value: '0001:01:01--' +SELECT TIME('0001:01:01-'), TIME('0001:01:01--'); +TIME('0001:01:01-') TIME('0001:01:01--') +01:01:01 01:01:01 +Warnings: +Warning 1292 Truncated incorrect time value: '0001:01:01-' +Warning 1292 Truncated incorrect time value: '0001:01:01--' +SELECT TIME('-xxx'), TIME('-xxxxxxxxxxxxxxxxxxxx'); +TIME('-xxx') TIME('-xxxxxxxxxxxxxxxxxxxx') +NULL NULL +Warnings: +Warning 1292 Incorrect time value: '-xxx' +Warning 1292 Incorrect time value: '-xxxxxxxxxxxxxxxxxxxx' +SELECT TIME('- '), TIME('- '); +TIME('- ') TIME('- ') +NULL NULL +Warnings: +Warning 1292 Incorrect time value: '- ' +Warning 1292 Incorrect time value: '- ' +SELECT TIME('-'), TIME('-'); +TIME('-') TIME('-') +NULL NULL +Warnings: +Warning 1292 Incorrect time value: '-' +Warning 1292 Incorrect time value: '-' +SELECT TIME('1-1-1 1:1:1'), TIME('1-1-1 1:1:1.0'); +TIME('1-1-1 1:1:1') TIME('1-1-1 1:1:1.0') +01:01:01 01:01:01.0 +SELECT TIME('1-1-1 1:2:3'), TIME('1-1-1 1:2:3.0'); +TIME('1-1-1 1:2:3') TIME('1-1-1 1:2:3.0') +01:02:03 01:02:03.0 +SELECT +CAST('20050326112233 garbage' as datetime), +CAST('20050326 garbage' as date), +CAST('50326 garbage' as time); +CAST('20050326112233 garbage' as datetime) CAST('20050326 garbage' as date) CAST('50326 garbage' as time) +2005-03-26 11:22:33 2005-03-26 05:03:26 +Warnings: +Warning 1292 Truncated incorrect datetime value: '20050326112233 garbage' +Warning 1292 Truncated incorrect date value: '20050326 garbage' +Warning 1292 Truncated incorrect time value: '50326 garbage' +SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00'); +TIME('- 01:00:00') TIME('- 1 01:00:00') +-01:00:00 -25:00:00 +# +# MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on SELECT with NULLIF and FROM_UNIXTIME on incorrect time +# +SET time_zone='+00:00'; +SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14'); +NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14') +1970-01-01 00:00:00 +Warnings: +Warning 1292 Truncated incorrect DECIMAL value: 'foo' +Warning 1292 Truncated incorrect DECIMAL value: 'foo' +SET time_zone=DEFAULT; diff --git a/mysql-test/main/func_time.test b/mysql-test/main/func_time.test index aebe3df761f..630083ef97e 100644 --- a/mysql-test/main/func_time.test +++ b/mysql-test/main/func_time.test @@ -1710,6 +1710,55 @@ SELECT SEC_TO_TIME(MAKEDATE(0,RAND(~0))); # SELECT PERIOD_DIFF(2018, AES_ENCRYPT('Rae Bareli', 'Rae Bareli')); + +--echo # +--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result +--echo # + +--vertical_results +SELECT + MAKETIME(1e10,0,0), + MAKETIME(-1e10,0,0), + MAKETIME(1e50,0,0), + MAKETIME(-1e50,0,0), + MAKETIME(COALESCE(1e50),0,0), + MAKETIME(COALESCE(-1e50),0,0); +--horizontal_results + +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (1e30),(-1e30); +SELECT MAKETIME(a,0,0) FROM t1; +DROP TABLE t1; + +--echo # +--echo # MDEV-17244 MAKETIME(900,0,0.111) returns a wrong result +--echo # + +SELECT MAKETIME(900,0,0); +SELECT MAKETIME(900,0,0.1); +SELECT MAKETIME(900,0,0.11); +SELECT MAKETIME(900,0,0.111); +SELECT MAKETIME(900,0,0.1111); +SELECT MAKETIME(900,0,0.11111); +SELECT MAKETIME(900,0,0.111111); +SELECT MAKETIME(900,0,0.1111111); +SELECT MAKETIME(900,0,0.11111111); +SELECT MAKETIME(900,0,0.111111111); +SELECT MAKETIME(900,0,EXP(1)); + +SELECT MAKETIME(-900,0,0); +SELECT MAKETIME(-900,0,0.1); +SELECT MAKETIME(-900,0,0.11); +SELECT MAKETIME(-900,0,0.111); +SELECT MAKETIME(-900,0,0.1111); +SELECT MAKETIME(-900,0,0.11111); +SELECT MAKETIME(-900,0,0.111111); +SELECT MAKETIME(-900,0,0.1111111); +SELECT MAKETIME(-900,0,0.11111111); +SELECT MAKETIME(-900,0,0.111111111); +SELECT MAKETIME(-900,0,EXP(1)); + + --echo # --echo # End of 5.5 tests --echo # @@ -1865,9 +1914,36 @@ DROP TABLE t1,t2; --echo # End of 10.1 tests --echo # +--echo # +--echo # MDEV-16217: Assertion `!table || (!table->read_set || +--echo # bitmap_is_set(table->read_set, field_index))' +--echo # failed in Field_num::get_date +--echo # +CREATE TABLE t1 (pk int default 0, a1 date); +INSERT INTO t1 VALUES (1,'1900-01-01'),(2,NULL),(3,NULL),(4,NULL); + +CREATE VIEW v1 AS +SELECT t1.pk AS pk, t1.a1 AS a1 FROM t1; + +SELECT a1 BETWEEN (('2018-08-24')) AND (DEFAULT(pk)) FROM v1; +SELECT a1 BETWEEN (('2018-08-24')) AND (~ DEFAULT(pk)) FROM v1; + +CREATE TABLE t2 (pk int default 1, a1 date); +INSERT INTO t2 VALUES (4,NULL); +CREATE view v2 as SELECT default(t1.pk), default(t2.pk), t1.pk from t1,t2; +select * from v2; +show create view v2; +CREATE view v3 as SELECT default(pk) from t2; +select * from v3; +explain extended select * from v3; +explain extended select default(pk) from t2; +show create view v3; + +DROP VIEW v1,v2,v3; +DROP TABLE t1,t2; --echo # ---echo # Start of 10.3 tests +--echo # End of 10.2 tests --echo # --echo # @@ -2168,7 +2244,9 @@ SELECT CAST(CAST(LAST_DAY(TIME'00:00:00') AS DATE) AS TIME) AS c2, CAST(LAST_DAY(TIME'00:00:00') AS TIME) AS c3; +--echo # --echo # End of 10.3 tests +--echo # --echo # --echo # MDEV-14032 SEC_TO_TIME executes side effect two times @@ -2191,3 +2269,866 @@ SELECT SEC_TO_TIME(f1()); SELECT * FROM t1; DROP TABLE t1; DROP FUNCTION f1; + +--echo # +--echo # MDEV-17351 MICROSECOND(XXX(int_number_out_of_range)) erroneously returns 999999 +--echo # + +--echo # Reject anything that's parsed as DATETIME or DATE + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2001-01-01 10:20:30'), +('01-01-01 10:20:30'), +('2001-01-01 '), +('20010101102030'), +('010101102030'); +SELECT ADDTIME(DATE'2001-01-01',a), a FROM t1; +DROP TABLE t1; + + +--vertical_results + +--echo # GREATEST(decimal, time) + +SELECT + GREATEST(8395959, TIME'00:00:00') AS c0, + GREATEST(8395959.0, TIME'00:00:00') AS c1, + GREATEST(8395959.00, TIME'00:00:00') AS c2, + GREATEST(8395959.000, TIME'00:00:00') AS c3, + GREATEST(8395959.0000, TIME'00:00:00') AS c4, + GREATEST(8395959.00000, TIME'00:00:00') AS c5, + GREATEST(8395959.000000, TIME'00:00:00') AS c6, + GREATEST(8395959.0000000, TIME'00:00:00') AS c7; + +SELECT + MICROSECOND(GREATEST(8395959, TIME'00:00:00')) AS c0, + MICROSECOND(GREATEST(8395959.0, TIME'00:00:00')) AS c1, + MICROSECOND(GREATEST(8395959.00, TIME'00:00:00')) AS c2, + MICROSECOND(GREATEST(8395959.000, TIME'00:00:00')) AS c3, + MICROSECOND(GREATEST(8395959.0000, TIME'00:00:00')) AS c4, + MICROSECOND(GREATEST(8395959.00000, TIME'00:00:00')) AS c5, + MICROSECOND(GREATEST(8395959.000000, TIME'00:00:00')) AS c6, + MICROSECOND(GREATEST(8395959.0000000, TIME'00:00:00')) AS c7; + +SELECT + CAST(GREATEST(8395959, TIME'00:00:00') AS SIGNED) AS ci, + CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,0)) AS c0, + CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,1)) AS c1, + CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,2)) AS c2, + CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,3)) AS c3, + CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,4)) AS c4, + CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,5)) AS c5, + CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,6)) AS c6, + CAST(GREATEST(8395959, TIME'00:00:00') AS DECIMAL(30,7)) AS c7; + +SELECT + GREATEST(8395959, TIME'00:00:00') AS ci, + GREATEST(8395959, TIME'00:00:00')+0 AS c0, + GREATEST(8395959, TIME'00:00:00')+0.0 AS c1, + GREATEST(8395959, TIME'00:00:00')+0.00 AS c2, + GREATEST(8395959, TIME'00:00:00')+0.000 AS c3, + GREATEST(8395959, TIME'00:00:00')+0.0000 AS c4, + GREATEST(8395959, TIME'00:00:00')+0.00000 AS c5, + GREATEST(8395959, TIME'00:00:00')+0.000000 AS c6, + GREATEST(8395959, TIME'00:00:00')+0.0000000 AS c7; + + + +--echo # GREATEST(string, time) + +SELECT + GREATEST('839:59:59', TIME'00:00:00') AS ci, + GREATEST('839:59:59.0', TIME'00:00:00') AS c1, + GREATEST('839:59:59.00', TIME'00:00:00') AS c2, + GREATEST('839:59:59.000', TIME'00:00:00') AS c3, + GREATEST('839:59:59.0000', TIME'00:00:00') AS c4, + GREATEST('839:59:59.00000', TIME'00:00:00') AS c5, + GREATEST('839:59:59.000000', TIME'00:00:00') AS c6, + GREATEST('839:59:59.0000000', TIME'00:00:00') AS c7; + +SELECT + MICROSECOND(GREATEST('839:59:59', TIME'00:00:00')) AS ci, + MICROSECOND(GREATEST('839:59:59.0', TIME'00:00:00')) AS c1, + MICROSECOND(GREATEST('839:59:59.00', TIME'00:00:00')) AS c2, + MICROSECOND(GREATEST('839:59:59.000', TIME'00:00:00')) AS c3, + MICROSECOND(GREATEST('839:59:59.0000', TIME'00:00:00')) AS c4, + MICROSECOND(GREATEST('839:59:59.00000', TIME'00:00:00')) AS c5, + MICROSECOND(GREATEST('839:59:59.000000', TIME'00:00:00')) AS c6, + MICROSECOND(GREATEST('839:59:59.0000000', TIME'00:00:00')) AS c7; + +SELECT + CAST(GREATEST('839:59:59', TIME'00:00:00') AS SIGNED) AS ci, + CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,0)) AS c0, + CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,1)) AS c1, + CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,2)) AS c2, + CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,3)) AS c3, + CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,4)) AS c4, + CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,5)) AS c5, + CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,6)) AS c6, + CAST(GREATEST('839:59:59', TIME'00:00:00') AS DECIMAL(30,7)) AS c7; + +SELECT + GREATEST('839:59:59', TIME'00:00:00') AS ci, + GREATEST('839:59:59', TIME'00:00:00')+0 AS c0, + GREATEST('839:59:59', TIME'00:00:00')+0.0 AS c1, + GREATEST('839:59:59', TIME'00:00:00')+0.00 AS c2, + GREATEST('839:59:59', TIME'00:00:00')+0.000 AS c3, + GREATEST('839:59:59', TIME'00:00:00')+0.0000 AS c4, + GREATEST('839:59:59', TIME'00:00:00')+0.00000 AS c5, + GREATEST('839:59:59', TIME'00:00:00')+0.000000 AS c6, + GREATEST('839:59:59', TIME'00:00:00')+0.0000000 AS c7; + + +--echo # ADDTIME(datetime, decimal) + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0) AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.00) AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.000) AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0000) AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.00000) AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.000000) AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0000000) AS c7; + +SELECT + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)) AS c0, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0)) AS c1, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.00)) AS c2, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.000)) AS c3, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0000)) AS c4, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.00000)) AS c5, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.000000)) AS c6, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959.0000000)) AS c7; + +SELECT + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS SIGNED) AS ci, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,0)) AS c0, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,1)) AS c1, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,2)) AS c2, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,3)) AS c3, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,4)) AS c4, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,5)) AS c5, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,6)) AS c6, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS DECIMAL(30,7)) AS c7; + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959) AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 8395959)+0.0000000 AS c7; + +--echo # ADDTIME(datetime, string) + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0') AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.00') AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.000') AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0000') AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.00000') AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.000000') AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0000000') AS c7; + +SELECT + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')) AS c0, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0')) AS c1, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.00')) AS c2, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.000')) AS c3, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0000')) AS c4, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.00000')) AS c5, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.000000')) AS c6, + MICROSECOND(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59.0000000')) AS c7; + +SELECT + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS SIGNED) AS ci, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,0)) AS c0, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,1)) AS c1, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,2)) AS c2, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,3)) AS c3, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,4)) AS c4, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,5)) AS c5, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,6)) AS c6, + CAST(ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS DECIMAL(30,7)) AS c7; + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59') AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '839:59:59')+0.0000000 AS c7; + +--echo # ADDTIME(time, decimal) + +SELECT + ADDTIME(TIME'00:00:00', 8395959) AS c0, + ADDTIME(TIME'00:00:00', 8395959.0) AS c1, + ADDTIME(TIME'00:00:00', 8395959.00) AS c2, + ADDTIME(TIME'00:00:00', 8395959.000) AS c3, + ADDTIME(TIME'00:00:00', 8395959.0000) AS c4, + ADDTIME(TIME'00:00:00', 8395959.00000) AS c5, + ADDTIME(TIME'00:00:00', 8395959.000000) AS c6, + ADDTIME(TIME'00:00:00', 8395959.0000000) AS c7; + +SELECT + MICROSECOND(ADDTIME(TIME'00:00:00', 8395959)) AS c0, + MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.0)) AS c1, + MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.00)) AS c2, + MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.000)) AS c3, + MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.0000)) AS c4, + MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.00000)) AS c5, + MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.000000)) AS c6, + MICROSECOND(ADDTIME(TIME'00:00:00', 8395959.0000000)) AS c7; + +SELECT + CAST(ADDTIME(TIME'00:00:00', 8395959) AS SIGNED) AS ci, + CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,0)) AS c0, + CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,1)) AS c1, + CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,2)) AS c2, + CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,3)) AS c3, + CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,4)) AS c4, + CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,5)) AS c5, + CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,6)) AS c6, + CAST(ADDTIME(TIME'00:00:00', 8395959) AS DECIMAL(30,7)) AS c7; + +SELECT + ADDTIME(TIME'00:00:00', 8395959) AS ci, + ADDTIME(TIME'00:00:00', 8395959)+0 AS c0, + ADDTIME(TIME'00:00:00', 8395959)+0.0 AS c1, + ADDTIME(TIME'00:00:00', 8395959)+0.00 AS c2, + ADDTIME(TIME'00:00:00', 8395959)+0.000 AS c3, + ADDTIME(TIME'00:00:00', 8395959)+0.0000 AS c4, + ADDTIME(TIME'00:00:00', 8395959)+0.00000 AS c5, + ADDTIME(TIME'00:00:00', 8395959)+0.000000 AS c6, + ADDTIME(TIME'00:00:00', 8395959)+0.0000000 AS c7; + +--echo # ADDTIME(time,string) + +SELECT + ADDTIME(TIME'00:00:00', '839:59:59') AS c0, + ADDTIME(TIME'00:00:00', '839:59:59.0') AS c1, + ADDTIME(TIME'00:00:00', '839:59:59.00') AS c2, + ADDTIME(TIME'00:00:00', '839:59:59.000') AS c3, + ADDTIME(TIME'00:00:00', '839:59:59.0000') AS c4, + ADDTIME(TIME'00:00:00', '839:59:59.00000') AS c5, + ADDTIME(TIME'00:00:00', '839:59:59.000000') AS c6, + ADDTIME(TIME'00:00:00', '839:59:59.0000000') AS c7; + +SELECT + MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59')) AS c0, + MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.0')) AS c1, + MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.00')) AS c2, + MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.000')) AS c3, + MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.0000')) AS c4, + MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.00000')) AS c5, + MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.000000')) AS c6, + MICROSECOND(ADDTIME(TIME'00:00:00', '839:59:59.0000000')) AS c7; + +SELECT + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS SIGNED) AS ci, + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,0)) AS c0, + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,1)) AS c1, + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,2)) AS c2, + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,3)) AS c3, + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,4)) AS c4, + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,5)) AS c5, + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,6)) AS c6, + CAST(ADDTIME(TIME'00:00:00', '839:59:59') AS DECIMAL(30,7)) AS c7; + +SELECT + ADDTIME(TIME'00:00:00', '839:59:59') AS ci, + ADDTIME(TIME'00:00:00', '839:59:59')+0 AS c0, + ADDTIME(TIME'00:00:00', '839:59:59')+0.0 AS c1, + ADDTIME(TIME'00:00:00', '839:59:59')+0.00 AS c2, + ADDTIME(TIME'00:00:00', '839:59:59')+0.000 AS c3, + ADDTIME(TIME'00:00:00', '839:59:59')+0.0000 AS c4, + ADDTIME(TIME'00:00:00', '839:59:59')+0.00000 AS c5, + ADDTIME(TIME'00:00:00', '839:59:59')+0.000000 AS c6, + ADDTIME(TIME'00:00:00', '839:59:59')+0.0000000 AS c7; + +--echo # ADDTIME(int,int) +SELECT + ADDTIME(0, 8395959) AS c, + MICROSECOND(ADDTIME(0, 8395959)) AS cm, + CAST(ADDTIME(0, 8395959) AS SIGNED) AS cs_fixme_mdev_17384, + CAST(ADDTIME(0, 8395959) AS DECIMAL(30,0)) AS cd300; + +SELECT + ADDTIME(20010101000000, 8395959) AS c, + MICROSECOND(ADDTIME(20010101000000, 8395959)) AS cm, + CAST(ADDTIME(20010101000000, 8395959) AS SIGNED) AS cs_fixme_mdev_17384, + CAST(ADDTIME(20010101000000, 8395959) AS DECIMAL(30,0)) AS cd300; + +--echo # ADDTIME(decimal,int) +--echo # 8385960 in cd300 is correct: addtime returns '838:59:59.9' +--echo # which is further *rounded* to a decimals(30,0) +SELECT + ADDTIME(0.0, 8395959) AS c, + MICROSECOND(ADDTIME(0.0, 8395959)) AS cm, + CAST(ADDTIME(0.0, 8395959) AS SIGNED) AS cs_fixme_mdev_17384, + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,0)) AS cd300; + +SELECT + ADDTIME(20010101000000.0, 8395959) AS c, + MICROSECOND(ADDTIME(20010101000000.0, 8395959)) AS cm, + CAST(ADDTIME(20010101000000.0, 8395959) AS SIGNED) AS cs_fixme_mdev_17384, + CAST(ADDTIME(20010101000000.0, 8395959) AS DECIMAL(30,0)) AS cd300; + + +--echo # ADDTIME(decimal,decimal) + +SELECT + ADDTIME(0.0, 8395959.0) AS c1, + ADDTIME(0.0, 8395959.00) AS c2, + ADDTIME(0.0, 8395959.000) AS c3, + ADDTIME(0.0, 8395959.0000) AS c4, + ADDTIME(0.0, 8395959.00000) AS c5, + ADDTIME(0.0, 8395959.000000) AS c6, + ADDTIME(0.0, 8395959.0000000) AS c7; + +SELECT + MICROSECOND(ADDTIME(0.0, 8395959.0)) AS c1, + MICROSECOND(ADDTIME(0.0, 8395959.00)) AS c2, + MICROSECOND(ADDTIME(0.0, 8395959.000)) AS c3, + MICROSECOND(ADDTIME(0.0, 8395959.0000)) AS c4, + MICROSECOND(ADDTIME(0.0, 8395959.00000)) AS c5, + MICROSECOND(ADDTIME(0.0, 8395959.000000)) AS c6, + MICROSECOND(ADDTIME(0.0, 8395959.0000000)) AS c7; + +--echo # 8385960 in c1 is correct: addtime returns '838:59:59.9' +--echo # which is further *rounded* to a decimals(30,0) +SELECT + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,0)) AS c0, + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,1)) AS c1, + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,2)) AS c2, + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,3)) AS c3, + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,4)) AS c4, + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,5)) AS c5, + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,6)) AS c6, + CAST(ADDTIME(0.0, 8395959) AS DECIMAL(30,7)) AS c7; + +SELECT + ADDTIME(0.0, 8395959)+0 AS c0, + ADDTIME(0.0, 8395959)+0.0 AS c1, + ADDTIME(0.0, 8395959)+0.00 AS c2, + ADDTIME(0.0, 8395959)+0.000 AS c3, + ADDTIME(0.0, 8395959)+0.0000 AS c4, + ADDTIME(0.0, 8395959)+0.00000 AS c5, + ADDTIME(0.0, 8395959)+0.000000 AS c6, + ADDTIME(0.0, 8395959)+0.0000000 AS c7; + + +--echo # TIMESTAMP(string,decimal) + +SELECT + TIMESTAMP('2001-01-01', 8395959) AS ci, + TIMESTAMP('2001-01-01', 8395959.0) AS c1, + TIMESTAMP('2001-01-01', 8395959.00) AS c2, + TIMESTAMP('2001-01-01', 8395959.000) AS c3, + TIMESTAMP('2001-01-01', 8395959.0000) AS c4, + TIMESTAMP('2001-01-01', 8395959.00000) AS c5, + TIMESTAMP('2001-01-01', 8395959.000000) AS c6, + TIMESTAMP('2001-01-01', 8395959.0000000) AS c7; + +SELECT + MICROSECOND(TIMESTAMP('2001-01-01', 8395959)) AS ci, + MICROSECOND(TIMESTAMP('2001-01-01', 8395959.0)) AS c1, + MICROSECOND(TIMESTAMP('2001-01-01', 8395959.00)) AS c2, + MICROSECOND(TIMESTAMP('2001-01-01', 8395959.000)) AS c3, + MICROSECOND(TIMESTAMP('2001-01-01', 8395959.0000)) AS c4, + MICROSECOND(TIMESTAMP('2001-01-01', 8395959.00000)) AS c5, + MICROSECOND(TIMESTAMP('2001-01-01', 8395959.000000)) AS c6, + MICROSECOND(TIMESTAMP('2001-01-01', 8395959.0000000)) AS c7; + +SELECT + CAST(TIMESTAMP('2001-01-01', 8395959) AS SIGNED) AS ci, + CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,0)) AS c0, + CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,1)) AS c1, + CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,2)) AS c2, + CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,3)) AS c3, + CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,4)) AS c4, + CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,5)) AS c5, + CAST(TIMESTAMP('2001-01-01', 8395959) AS DECIMAL(30,6)) AS c6; + +SELECT + TIMESTAMP('2001-01-01', 8395959) AS ci, + TIMESTAMP('2001-01-01', 8395959)+0 AS c0, + TIMESTAMP('2001-01-01', 8395959)+0.0 AS c1, + TIMESTAMP('2001-01-01', 8395959)+0.00 AS c2, + TIMESTAMP('2001-01-01', 8395959)+0.000 AS c3, + TIMESTAMP('2001-01-01', 8395959)+0.0000 AS c4, + TIMESTAMP('2001-01-01', 8395959)+0.00000 AS c5, + TIMESTAMP('2001-01-01', 8395959)+0.000000 AS c6, + TIMESTAMP('2001-01-01', 8395959)+0.0000000 AS c7; + +--echo # TIMESTAMP(string,string) + +SELECT + TIMESTAMP('2001-01-01', '839:59:59') AS ci, + TIMESTAMP('2001-01-01', '839:59:59.0') AS c1, + TIMESTAMP('2001-01-01', '839:59:59.00') AS c2, + TIMESTAMP('2001-01-01', '839:59:59.000') AS c3, + TIMESTAMP('2001-01-01', '839:59:59.0000') AS c4, + TIMESTAMP('2001-01-01', '839:59:59.00000') AS c5, + TIMESTAMP('2001-01-01', '839:59:59.000000') AS c6, + TIMESTAMP('2001-01-01', '839:59:59.0000000') AS c7; + +SELECT + MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59')) AS ci, + MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.0')) AS c1, + MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.00')) AS c2, + MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.000')) AS c3, + MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.0000')) AS c4, + MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.00000')) AS c5, + MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.000000')) AS c6, + MICROSECOND(TIMESTAMP('2001-01-01', '839:59:59.0000000')) AS c7; + +SELECT + CAST(TIMESTAMP('2001-01-01', '839:59:59') AS SIGNED) AS ci, + CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,0)) AS c0, + CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,1)) AS c1, + CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,2)) AS c2, + CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,3)) AS c3, + CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,4)) AS c4, + CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,5)) AS c5, + CAST(TIMESTAMP('2001-01-01', '839:59:59') AS DECIMAL(30,6)) AS c6; + +SELECT + TIMESTAMP('2001-01-01', '839:59:59') AS ci, + TIMESTAMP('2001-01-01', '839:59:59')+0 AS c0, + TIMESTAMP('2001-01-01', '839:59:59')+0.0 AS c1, + TIMESTAMP('2001-01-01', '839:59:59')+0.00 AS c2, + TIMESTAMP('2001-01-01', '839:59:59')+0.000 AS c3, + TIMESTAMP('2001-01-01', '839:59:59')+0.0000 AS c4, + TIMESTAMP('2001-01-01', '839:59:59')+0.00000 AS c5, + TIMESTAMP('2001-01-01', '839:59:59')+0.000000 AS c6, + TIMESTAMP('2001-01-01', '839:59:59')+0.0000000 AS c7; + +--horizontal_results + +--echo # Corner cases for TIMESTAMP(timestamp,xxx) + +--echo # HOUR is outside of supported INTERVAL DAYS TO SECONDS range +--echo # Expect NULL with INTERVAL warnings +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('4294967296:00:00', '178956970 16:00:00'); +INSERT INTO t1 VALUES ('4294967295:59:59', '178956970 15:59:59'); +INSERT INTO t1 VALUES ('4294967294:59:59', '178956970 14:59:59'); +INSERT INTO t1 VALUES ('87649416:00:00', '3652059 00:00:00'); +SELECT TIMESTAMP('0001-01-01 00:00:00', a) AS ta, TIMESTAMP('0001-01-01 00:00:00', b) AS tb FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('-4294967296:00:00', '-178956970 16:00:00'); +INSERT INTO t1 VALUES ('-4294967295:59:59', '-178956970 15:59:59'); +INSERT INTO t1 VALUES ('-4294967294:59:59', '-178956970 14:59:59'); +INSERT INTO t1 VALUES ('-87649416:00:00', '-3652059 00:00:00'); +SELECT TIMESTAMP('9999-12-31 23:59:59', a) AS ta, TIMESTAMP('9999-12-31 23:59:59.999999', b) AS tb FROM t1; +DROP TABLE t1; + +--echo # HOUR is OK +--echo # Expect max or near-max DATETIME value + no INTERVAL warnings +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('87649415:59:59.999999', '3652058 23:59:59.999999'); +INSERT INTO t1 VALUES ('87649415:59:59', '3652058 23:59:59'); +SELECT TIMESTAMP('0001-01-01 00:00:00', a) AS ta, TIMESTAMP('0001-01-01 00:00:00', b) AS tb FROM t1; +DROP TABLE t1; + +--echo # HOUR is OK +--echo # Expect near '0001-01-01 00:00:00' DATETIME value + no INTERVAL warnings +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('-87649415:59:59.999999', '-3652058 23:59:59.999999'); +INSERT INTO t1 VALUES ('-87649415:59:59', '-3652058 23:59:59'); +SELECT TIMESTAMP('9999-12-31 23:59:59', a) AS ta, TIMESTAMP('9999-12-31 23:59:59.999999', b) AS tb FROM t1; +DROP TABLE t1; + +--echo # HOUR is OK +--echo # Expect NULL on datetime arithmetic overflow + no INTERVAL warnings +CREATE TABLE t1 (a VARCHAR(64), b VARCHAR(64)); +INSERT INTO t1 VALUES ('-00:00:00.000001', '-0 00:00:00.000001'); +SELECT TIMESTAMP('0001-01-01 00:00:00', a) AS ta, TIMESTAMP('0001-01-01 00:00:00', b) AS tb FROM t1; +DROP TABLE t1; + + +--echo # Corner cases for ADDTIME(timestamp,xxx) +--vertical_results + +--echo # HOUR is outside of UINT_MAX32 range +--echo # Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959) AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672965959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59') AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967296:59:59')+0.0000000 AS c7; + +## TODO: add '0001-01-01 00:00:00' + +--echo # HOUR UINT_MAX32 +--echo # Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959) AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 42949672955959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59') AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '4294967295:59:59')+0.0000000 AS c7; + +--echo # HOUR is max_useful_hour()+1 +--echo # Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959) AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494165959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59') AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649416:59:59')+0.0000000 AS c7; + +--echo # HOUR is max_useful_hour() +--echo # Expect NULL (calc_time_diff overflows ) + no INTERVAL warnings +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959) AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', 876494155959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59') AS ci, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0 AS c0, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.0 AS c1, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.00 AS c2, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.000 AS c3, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.0000 AS c4, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.00000 AS c5, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.000000 AS c6, + ADDTIME(TIMESTAMP'2001-01-01 00:00:00', '87649415:59:59')+0.0000000 AS c7; + +--echo # HOUR is max_useful_hour() +--echo # Expect non-NULL + no warnings +SELECT + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959) AS ci, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0 AS c0, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.0 AS c1, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.00 AS c2, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.000 AS c3, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.0000 AS c4, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.00000 AS c5, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.000000 AS c6, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', 876494155959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59') AS ci, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0 AS c0, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.0 AS c1, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.00 AS c2, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.000 AS c3, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.0000 AS c4, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.00000 AS c5, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.000000 AS c6, + ADDTIME(TIMESTAMP'0001-01-01 00:00:00', '87649415:59:59')+0.0000000 AS c7; +--horizontal_results + + +--echo # Corner cases for ADDTIME(time,xxx) +--vertical_results + +--echo # HOUR outside of UINT32 range +--echo # Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT + ADDTIME(TIME'00:00:00', 42949672965959) AS ci, + ADDTIME(TIME'00:00:00', 42949672965959)+0 AS c0, + ADDTIME(TIME'00:00:00', 42949672965959)+0.0 AS c1, + ADDTIME(TIME'00:00:00', 42949672965959)+0.00 AS c2, + ADDTIME(TIME'00:00:00', 42949672965959)+0.000 AS c3, + ADDTIME(TIME'00:00:00', 42949672965959)+0.0000 AS c4, + ADDTIME(TIME'00:00:00', 42949672965959)+0.00000 AS c5, + ADDTIME(TIME'00:00:00', 42949672965959)+0.000000 AS c6, + ADDTIME(TIME'00:00:00', 42949672965959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIME'00:00:00', '4294967296:59:59') AS ci, + ADDTIME(TIME'00:00:00', '4294967296:59:59')+0 AS c0, + ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.0 AS c1, + ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.00 AS c2, + ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.000 AS c3, + ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.0000 AS c4, + ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.00000 AS c5, + ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.000000 AS c6, + ADDTIME(TIME'00:00:00', '4294967296:59:59')+0.0000000 AS c7; + +--echo # HOUR is UINT_MAX32 (outside of INTERVAL DAY TO SECOND range) +--echo # Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" +SELECT + ADDTIME(TIME'00:00:00', 42949672955959) AS ci, + ADDTIME(TIME'00:00:00', 42949672955959)+0 AS c0, + ADDTIME(TIME'00:00:00', 42949672955959)+0.0 AS c1, + ADDTIME(TIME'00:00:00', 42949672955959)+0.00 AS c2, + ADDTIME(TIME'00:00:00', 42949672955959)+0.000 AS c3, + ADDTIME(TIME'00:00:00', 42949672955959)+0.0000 AS c4, + ADDTIME(TIME'00:00:00', 42949672955959)+0.00000 AS c5, + ADDTIME(TIME'00:00:00', 42949672955959)+0.000000 AS c6, + ADDTIME(TIME'00:00:00', 42949672955959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIME'00:00:00', '4294967295:59:59') AS ci, + ADDTIME(TIME'00:00:00', '4294967295:59:59')+0 AS c0, + ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.0 AS c1, + ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.00 AS c2, + ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.000 AS c3, + ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.0000 AS c4, + ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.00000 AS c5, + ADDTIME(TIME'00:00:00', '4294967295:59:59')+0.000000 AS c6, + ADDTIME(TIME'00:00:00', '4294967295;00:00')+0.0000000 AS c7; + +--echo # HOUR is max_useful_hour()+1 (outside of INTERVAL DAY TO SECOND range) +--echo # Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" + +SELECT + ADDTIME(TIME'00:00:00', 876494165959) AS ci, + ADDTIME(TIME'00:00:00', 876494165959)+0 AS c0, + ADDTIME(TIME'00:00:00', 876494165959)+0.0 AS c1, + ADDTIME(TIME'00:00:00', 876494165959)+0.00 AS c2, + ADDTIME(TIME'00:00:00', 876494165959)+0.000 AS c3, + ADDTIME(TIME'00:00:00', 876494165959)+0.0000 AS c4, + ADDTIME(TIME'00:00:00', 876494165959)+0.00000 AS c5, + ADDTIME(TIME'00:00:00', 876494165959)+0.000000 AS c6, + ADDTIME(TIME'00:00:00', 876494165959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIME'00:00:00', '87649416:59:59') AS ci, + ADDTIME(TIME'00:00:00', '87649416:59:59')+0 AS c0, + ADDTIME(TIME'00:00:00', '87649416:59:59')+0.0 AS c1, + ADDTIME(TIME'00:00:00', '87649416:59:59')+0.00 AS c2, + ADDTIME(TIME'00:00:00', '87649416:59:59')+0.000 AS c3, + ADDTIME(TIME'00:00:00', '87649416:59:59')+0.0000 AS c4, + ADDTIME(TIME'00:00:00', '87649416:59:59')+0.00000 AS c5, + ADDTIME(TIME'00:00:00', '87649416:59:59')+0.000000 AS c6, + ADDTIME(TIME'00:00:00', '87649416:59:59')+0.0000000 AS c7; + +--echo # HOUR is max_useful_hour()+1 (outside of INTERVAL DAY TO SECOND range) +--echo # Expect NULL + "Incorrect INTERVAL DAY TO SECOND value" + +SELECT + ADDTIME(TIME'-838:59:59', 876494165959) AS ci, + ADDTIME(TIME'-838:59:59.9', 876494165959) AS c1, + ADDTIME(TIME'-838:59:59.99', 876494165959) AS c2, + ADDTIME(TIME'-838:59:59.999', 876494165959) AS c3, + ADDTIME(TIME'-838:59:59.9999', 876494165959) AS c4, + ADDTIME(TIME'-838:59:59.99999', 876494165959) AS c5, + ADDTIME(TIME'-838:59:59.999999', 876494165959) AS c6; + +SELECT + ADDTIME(TIME'-838:59:59', '87649416:59:59') AS ci, + ADDTIME(TIME'-838:59:59.9', '87649416:59:59') AS c1, + ADDTIME(TIME'-838:59:59.99', '87649416:59:59') AS c2, + ADDTIME(TIME'-838:59:59.999', '87649416:59:59') AS c3, + ADDTIME(TIME'-838:59:59.9999', '87649416:59:59') AS c4, + ADDTIME(TIME'-838:59:59.99999', '87649416:59:59') AS c5, + ADDTIME(TIME'-838:59:59.999999', '87649416:59:59') AS c6; + +# This does not give a warning about nanosecond truncation in --ps runs +# so disable warnings +--disable_warnings +SELECT + ADDTIME(TIME'-838:59:59.9999999', '87649416:59:59') AS c7; +--enable_warnings + +--echo # HOUR is max_useful_hour() (inside INTERVAL DAY TO SECOND range) +--echo # Expect max TIME(0) + zero fraction + TIME warnings + no INTEVAL warnings +SELECT + ADDTIME(TIME'00:00:00', 876494155959) AS ci, + ADDTIME(TIME'00:00:00', 876494155959)+0 AS c0, + ADDTIME(TIME'00:00:00', 876494155959)+0.0 AS c1, + ADDTIME(TIME'00:00:00', 876494155959)+0.00 AS c2, + ADDTIME(TIME'00:00:00', 876494155959)+0.000 AS c3, + ADDTIME(TIME'00:00:00', 876494155959)+0.0000 AS c4, + ADDTIME(TIME'00:00:00', 876494155959)+0.00000 AS c5, + ADDTIME(TIME'00:00:00', 876494155959)+0.000000 AS c6, + ADDTIME(TIME'00:00:00', 876494155959)+0.0000000 AS c7; + +SELECT + ADDTIME(TIME'00:00:00', '87649415:59:59') AS ci, + ADDTIME(TIME'00:00:00', '87649415:59:59')+0 AS c0, + ADDTIME(TIME'00:00:00', '87649415:59:59')+0.0 AS c1, + ADDTIME(TIME'00:00:00', '87649415:59:59')+0.00 AS c2, + ADDTIME(TIME'00:00:00', '87649415:59:59')+0.000 AS c3, + ADDTIME(TIME'00:00:00', '87649415:59:59')+0.0000 AS c4, + ADDTIME(TIME'00:00:00', '87649415:59:59')+0.00000 AS c5, + ADDTIME(TIME'00:00:00', '87649415:59:59')+0.000000 AS c6, + ADDTIME(TIME'00:00:00', '87649415:59:59')+0.0000000 AS c7; + + +--echo # HOUR is max_useful_hour() (inside INTERVAL DAY TO SECOND range) +--echo # Expect max TIME(N) + TIME warnings + no INTERVAL warnings + +SELECT + ADDTIME(TIME'-838:59:59', 876494155959) AS ci, + ADDTIME(TIME'-838:59:59.9', 876494155959) AS c1, + ADDTIME(TIME'-838:59:59.99', 876494155959) AS c2, + ADDTIME(TIME'-838:59:59.999', 876494155959) AS c3, + ADDTIME(TIME'-838:59:59.9999', 876494155959) AS c4, + ADDTIME(TIME'-838:59:59.99999', 876494155959) AS c5, + ADDTIME(TIME'-838:59:59.999999', 876494155959) AS c6; + +SELECT + ADDTIME(TIME'-838:59:59', '87649415:59:59') AS ci, + ADDTIME(TIME'-838:59:59.9', '87649415:59:59') AS c1, + ADDTIME(TIME'-838:59:59.99', '87649415:59:59') AS c2, + ADDTIME(TIME'-838:59:59.999', '87649415:59:59') AS c3, + ADDTIME(TIME'-838:59:59.9999', '87649415:59:59') AS c4, + ADDTIME(TIME'-838:59:59.99999', '87649415:59:59') AS c5, + ADDTIME(TIME'-838:59:59.999999', '87649415:59:59') AS c6; + +# This does not give a warning about nanosecond truncation in --ps runs +# so disable warnings +--disable_warnings +SELECT + ADDTIME(TIME'-838:59:59.9999999', '87649415:59:59') AS c7; +--enable_warnings + +--horizontal_results + + +--echo # +--echo # MDEV-17400 The result of TIME('42949672965959-01') depends on architecture +--echo # + +SELECT TIME('42949672955959-01'), TIME('42949672965959-01'); +SELECT TIME('18446744073709551615-01'), TIME('18446744073709551616-01'); + +--echo # +--echo # MDEV-17434 EXTRACT(DAY FROM negative_time) returns wrong result +--echo # + +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES ('-24:10:10.10'); +SELECT + EXTRACT(MINUTE FROM a), + EXTRACT(SECOND FROM a), + EXTRACT(MICROSECOND FROM a), + EXTRACT(DAY FROM a), + EXTRACT(DAY_HOUR FROM a), + EXTRACT(DAY_MINUTE FROM a), + EXTRACT(DAY_SECOND FROM a), + EXTRACT(DAY_MICROSECOND FROM a) +FROM t1; +CREATE TABLE t2 AS +SELECT + EXTRACT(MINUTE FROM a), + EXTRACT(SECOND FROM a), + EXTRACT(MICROSECOND FROM a), + EXTRACT(DAY FROM a), + EXTRACT(DAY_HOUR FROM a), + EXTRACT(DAY_MINUTE FROM a), + EXTRACT(DAY_SECOND FROM a), + EXTRACT(DAY_MICROSECOND FROM a) +FROM t1; +SHOW CREATE TABLE t2; +DROP TABLE t2; +DROP TABLE t1; + + +--echo # +--echo # MDEV-17478 Wrong result for TIME('+100:20:30') +--echo # + +SELECT TIME('+100:20:30'); + +--echo # +--echo # MDEV-17477 Wrong result for TIME('-2001-01-01 10:20:30') +--echo # + +SELECT TIME('-2001-01-01 10:20:30'); +SELECT TIME('2001-01-01') AS c1, TIME('2001-01-01 ') AS c2; +SELECT TIME('0001:01:01 '), TIME('0001:01:01 '); +SELECT TIME('1 2'), TIME('1 2 '); + +SELECT TIME('2001-01-01T'), TIME('2001-01-01T '); +SELECT TIME('901-01-01T1'), TIME('901-01-01T10'); +SELECT TIME('091-01-01T1'), TIME('091-01-01T10'); + +SELECT TIME('0001:01:01x'), TIME('0001:01:01xx'); +SELECT TIME('0001:01:01.'), TIME('0001:01:01..'); +SELECT TIME('0001:01:01-'), TIME('0001:01:01--'); +SELECT TIME('0001:01:01-'), TIME('0001:01:01--'); + +SELECT TIME('-xxx'), TIME('-xxxxxxxxxxxxxxxxxxxx'); +SELECT TIME('- '), TIME('- '); +SELECT TIME('-'), TIME('-'); +SELECT TIME('1-1-1 1:1:1'), TIME('1-1-1 1:1:1.0'); +SELECT TIME('1-1-1 1:2:3'), TIME('1-1-1 1:2:3.0'); + +SELECT + CAST('20050326112233 garbage' as datetime), + CAST('20050326 garbage' as date), + CAST('50326 garbage' as time); + +SELECT TIME('- 01:00:00'), TIME('- 1 01:00:00'); + + +--echo # +--echo # MDEV-17854 Assertion `decimals <= 6' failed in my_time_fraction_remainder on SELECT with NULLIF and FROM_UNIXTIME on incorrect time +--echo # + +SET time_zone='+00:00'; +SELECT NULLIF(FROM_UNIXTIME('foo'), '2012-12-12 21:10:14'); +SET time_zone=DEFAULT; diff --git a/mysql-test/main/func_time_round.result b/mysql-test/main/func_time_round.result new file mode 100644 index 00000000000..b335cf393ba --- /dev/null +++ b/mysql-test/main/func_time_round.result @@ -0,0 +1,1374 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; +CREATE TABLE t1_datetime_in_varchar (id SERIAL, a VARCHAR(64)); +INSERT INTO t1_datetime_in_varchar (a) VALUES +('2000-12-31 23:59:59'), +('2000-12-31 23:59:59.9'), +('2000-12-31 23:59:59.99'), +('2000-12-31 23:59:59.999'), +('2000-12-31 23:59:59.9999'), +('2000-12-31 23:59:59.99999'), +('2000-12-31 23:59:59.999999'), +('2000-12-31 23:59:59.9999999'); +CREATE TABLE t1_datetime_in_decimal (id SERIAL, a DECIMAL(38,10)); +INSERT INTO t1_datetime_in_decimal (a) VALUES +(20001231235959), +(20001231235959.9), +(20001231235959.99), +(20001231235959.999), +(20001231235959.9999), +(20001231235959.99999), +(20001231235959.999999), +(20001231235959.9999999); +CREATE TABLE t1_time_in_varchar (id SERIAL, a VARCHAR(64)); +INSERT INTO t1_time_in_varchar (a) VALUES +('00:00:00'), +('00:00:00.9'), +('00:00:00.99'), +('00:00:00.999'), +('00:00:00.9999'), +('00:00:00.99999'), +('00:00:00.999999'), +('00:00:00.9999999'); +INSERT INTO t1_time_in_varchar (a) VALUES +('837:59:59.9999999'), +('838:59:59'), +('838:59:59.9'), +('838:59:59.99'), +('838:59:59.999'), +('838:59:59.9999'), +('838:59:59.99999'), +('838:59:59.999999'), +('838:59:59.9999999'), +('839:59:59.9999999'), +('87649414:59:59.999999'), +('87649414:59:59.9999999'), +('87649415:59:59.999999'), +('87649415:59:59.9999999'); +CREATE TABLE t1_time_in_decimal (id SERIAL, a DECIMAL(38,10)); +INSERT INTO t1_time_in_decimal (a) VALUES +(0), +(0.9), +(0.99), +(0.999), +(0.9999), +(0.99999), +(0.999999), +(0.9999999); +INSERT INTO t1_time_in_decimal (a) VALUES +(8375959.9999999), +(8385959), +(8385959.9), +(8385959.99), +(8385959.999), +(8385959.9999), +(8385959.99999), +(8385959.999999), +(8385959.9999999), +(8395959.9999999), +(876494145959.999999), +(876494145959.9999999), +(876494155959.999999), +(876494155959.9999999); +# +# TIME: LEAST/GREATEST +# +SELECT GREATEST(TIME'00:00:00', a) FROM t1_time_in_varchar; +GREATEST(TIME'00:00:00', a) +00:00:00.000000 +00:00:00.900000 +00:00:00.990000 +00:00:00.999000 +00:00:00.999900 +00:00:00.999990 +00:00:00.999999 +00:00:01.000000 +838:00:00.000000 +838:59:59.000000 +838:59:59.900000 +838:59:59.990000 +838:59:59.999000 +838:59:59.999900 +838:59:59.999990 +838:59:59.999999 +838:59:59.999999 +838:59:59.999999 +838:59:59.999999 +838:59:59.999999 +838:59:59.999999 +838:59:59.999999 +Warnings: +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '837:59:59.9999999' +Warning 1292 Truncated incorrect time value: '838:59:59.9999999' +Warning 1292 Truncated incorrect time value: '839:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649414:59:59.999999' +Warning 1292 Truncated incorrect time value: '87649414:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999' +SELECT GREATEST(TIME'00:00:00', a) FROM t1_time_in_decimal; +GREATEST(TIME'00:00:00', a) +00:00:00.000000 +00:00:00.900000 +00:00:00.990000 +00:00:00.999000 +00:00:00.999900 +00:00:00.999990 +00:00:00.999999 +00:00:01.000000 +838:00:00.000000 +838:59:59.000000 +838:59:59.900000 +838:59:59.990000 +838:59:59.999000 +838:59:59.999900 +838:59:59.999990 +838:59:59.999999 +838:59:59.999999 +838:59:59.999999 +NULL +NULL +NULL +NULL +Warnings: +Warning 1292 Incorrect time value: '8385959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 17 +Warning 1292 Incorrect time value: '8395959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 18 +Warning 1292 Incorrect time value: '876494145959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 19 +Warning 1292 Incorrect time value: '876494145959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 20 +Warning 1292 Incorrect time value: '876494155959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 21 +Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22 +SELECT GREATEST(TIME'00:00:00', '00:00:00.0000004'); +GREATEST(TIME'00:00:00', '00:00:00.0000004') +00:00:00.000000 +Warnings: +Note 1292 Truncated incorrect time value: '00:00:00.0000004' +SELECT GREATEST(TIME'00:00:00', 0.0000004); +GREATEST(TIME'00:00:00', 0.0000004) +00:00:00.000000 +SELECT GREATEST(TIME'00:00:00', '00:00:00.0000005'); +GREATEST(TIME'00:00:00', '00:00:00.0000005') +00:00:00.000001 +Warnings: +Note 1292 Truncated incorrect time value: '00:00:00.0000005' +SELECT GREATEST(TIME'00:00:00', 0.0000005); +GREATEST(TIME'00:00:00', 0.0000005) +00:00:00.000001 +# +# Functions with a single TIME input, conversion from DATETIME-in-VARCHAR +# +SELECT SECOND(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +SECOND(a) CAST(a AS TIME(6)) a +59 23:59:59.000000 2000-12-31 23:59:59 +59 23:59:59.900000 2000-12-31 23:59:59.9 +59 23:59:59.990000 2000-12-31 23:59:59.99 +59 23:59:59.999000 2000-12-31 23:59:59.999 +59 23:59:59.999900 2000-12-31 23:59:59.9999 +59 23:59:59.999990 2000-12-31 23:59:59.99999 +59 23:59:59.999999 2000-12-31 23:59:59.999999 +0 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT MINUTE(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +MINUTE(a) CAST(a AS TIME(6)) a +59 23:59:59.000000 2000-12-31 23:59:59 +59 23:59:59.900000 2000-12-31 23:59:59.9 +59 23:59:59.990000 2000-12-31 23:59:59.99 +59 23:59:59.999000 2000-12-31 23:59:59.999 +59 23:59:59.999900 2000-12-31 23:59:59.9999 +59 23:59:59.999990 2000-12-31 23:59:59.99999 +59 23:59:59.999999 2000-12-31 23:59:59.999999 +0 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT HOUR(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +HOUR(a) CAST(a AS TIME(6)) a +23 23:59:59.000000 2000-12-31 23:59:59 +23 23:59:59.900000 2000-12-31 23:59:59.9 +23 23:59:59.990000 2000-12-31 23:59:59.99 +23 23:59:59.999000 2000-12-31 23:59:59.999 +23 23:59:59.999900 2000-12-31 23:59:59.9999 +23 23:59:59.999990 2000-12-31 23:59:59.99999 +23 23:59:59.999999 2000-12-31 23:59:59.999999 +0 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT EXTRACT(SECOND FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +EXTRACT(SECOND FROM a) CAST(a AS TIME(6)) a +59 23:59:59.000000 2000-12-31 23:59:59 +59 23:59:59.900000 2000-12-31 23:59:59.9 +59 23:59:59.990000 2000-12-31 23:59:59.99 +59 23:59:59.999000 2000-12-31 23:59:59.999 +59 23:59:59.999900 2000-12-31 23:59:59.9999 +59 23:59:59.999990 2000-12-31 23:59:59.99999 +59 23:59:59.999999 2000-12-31 23:59:59.999999 +0 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT EXTRACT(MINUTE FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +EXTRACT(MINUTE FROM a) CAST(a AS TIME(6)) a +59 23:59:59.000000 2000-12-31 23:59:59 +59 23:59:59.900000 2000-12-31 23:59:59.9 +59 23:59:59.990000 2000-12-31 23:59:59.99 +59 23:59:59.999000 2000-12-31 23:59:59.999 +59 23:59:59.999900 2000-12-31 23:59:59.9999 +59 23:59:59.999990 2000-12-31 23:59:59.99999 +59 23:59:59.999999 2000-12-31 23:59:59.999999 +0 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT EXTRACT(HOUR FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +EXTRACT(HOUR FROM a) CAST(a AS TIME(6)) a +23 23:59:59.000000 2000-12-31 23:59:59 +23 23:59:59.900000 2000-12-31 23:59:59.9 +23 23:59:59.990000 2000-12-31 23:59:59.99 +23 23:59:59.999000 2000-12-31 23:59:59.999 +23 23:59:59.999900 2000-12-31 23:59:59.9999 +23 23:59:59.999990 2000-12-31 23:59:59.99999 +23 23:59:59.999999 2000-12-31 23:59:59.999999 +0 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +TIME_TO_SEC(a) CAST(a AS TIME(6)) a +86399.000000 23:59:59.000000 2000-12-31 23:59:59 +86399.900000 23:59:59.900000 2000-12-31 23:59:59.9 +86399.990000 23:59:59.990000 2000-12-31 23:59:59.99 +86399.999000 23:59:59.999000 2000-12-31 23:59:59.999 +86399.999900 23:59:59.999900 2000-12-31 23:59:59.9999 +86399.999990 23:59:59.999990 2000-12-31 23:59:59.99999 +86399.999999 23:59:59.999999 2000-12-31 23:59:59.999999 +0.000000 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +# +# Functions with a single TIME input, conversion from DATETIME-in-DECIMAL +# +SELECT SECOND(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +SECOND(a) CAST(a AS TIME(6)) a +59 23:59:59.000000 20001231235959.0000000000 +59 23:59:59.900000 20001231235959.9000000000 +59 23:59:59.990000 20001231235959.9900000000 +59 23:59:59.999000 20001231235959.9990000000 +59 23:59:59.999900 20001231235959.9999000000 +59 23:59:59.999990 20001231235959.9999900000 +59 23:59:59.999999 20001231235959.9999990000 +0 00:00:00.000000 20001231235959.9999999000 +SELECT MINUTE(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +MINUTE(a) CAST(a AS TIME(6)) a +59 23:59:59.000000 20001231235959.0000000000 +59 23:59:59.900000 20001231235959.9000000000 +59 23:59:59.990000 20001231235959.9900000000 +59 23:59:59.999000 20001231235959.9990000000 +59 23:59:59.999900 20001231235959.9999000000 +59 23:59:59.999990 20001231235959.9999900000 +59 23:59:59.999999 20001231235959.9999990000 +0 00:00:00.000000 20001231235959.9999999000 +SELECT HOUR(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +HOUR(a) CAST(a AS TIME(6)) a +23 23:59:59.000000 20001231235959.0000000000 +23 23:59:59.900000 20001231235959.9000000000 +23 23:59:59.990000 20001231235959.9900000000 +23 23:59:59.999000 20001231235959.9990000000 +23 23:59:59.999900 20001231235959.9999000000 +23 23:59:59.999990 20001231235959.9999900000 +23 23:59:59.999999 20001231235959.9999990000 +0 00:00:00.000000 20001231235959.9999999000 +SELECT EXTRACT(SECOND FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +EXTRACT(SECOND FROM a) CAST(a AS TIME(6)) a +59 23:59:59.000000 20001231235959.0000000000 +59 23:59:59.900000 20001231235959.9000000000 +59 23:59:59.990000 20001231235959.9900000000 +59 23:59:59.999000 20001231235959.9990000000 +59 23:59:59.999900 20001231235959.9999000000 +59 23:59:59.999990 20001231235959.9999900000 +59 23:59:59.999999 20001231235959.9999990000 +0 00:00:00.000000 20001231235959.9999999000 +SELECT EXTRACT(MINUTE FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +EXTRACT(MINUTE FROM a) CAST(a AS TIME(6)) a +59 23:59:59.000000 20001231235959.0000000000 +59 23:59:59.900000 20001231235959.9000000000 +59 23:59:59.990000 20001231235959.9900000000 +59 23:59:59.999000 20001231235959.9990000000 +59 23:59:59.999900 20001231235959.9999000000 +59 23:59:59.999990 20001231235959.9999900000 +59 23:59:59.999999 20001231235959.9999990000 +0 00:00:00.000000 20001231235959.9999999000 +SELECT EXTRACT(HOUR FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +EXTRACT(HOUR FROM a) CAST(a AS TIME(6)) a +23 23:59:59.000000 20001231235959.0000000000 +23 23:59:59.900000 20001231235959.9000000000 +23 23:59:59.990000 20001231235959.9900000000 +23 23:59:59.999000 20001231235959.9990000000 +23 23:59:59.999900 20001231235959.9999000000 +23 23:59:59.999990 20001231235959.9999900000 +23 23:59:59.999999 20001231235959.9999990000 +0 00:00:00.000000 20001231235959.9999999000 +SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +TIME_TO_SEC(a) CAST(a AS TIME(6)) a +86399.000000 23:59:59.000000 20001231235959.0000000000 +86399.900000 23:59:59.900000 20001231235959.9000000000 +86399.990000 23:59:59.990000 20001231235959.9900000000 +86399.999000 23:59:59.999000 20001231235959.9990000000 +86399.999900 23:59:59.999900 20001231235959.9999000000 +86399.999990 23:59:59.999990 20001231235959.9999900000 +86399.999999 23:59:59.999999 20001231235959.9999990000 +0.000000 00:00:00.000000 20001231235959.9999999000 +# +# Functions with a single TIME interval input, conversion from TIME-interval-in-VARCHAR +# +SELECT +EXTRACT(DAY FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a), +CAST(a AS INTERVAL DAY_SECOND(6)), +a +FROM t1_time_in_varchar ORDER BY id; +EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a) CAST(a AS INTERVAL DAY_SECOND(6)) a +0 0 0 0 0 00:00:00.000000 00:00:00 +0 0 0 0 900000 00:00:00.900000 00:00:00.9 +0 0 0 0 990000 00:00:00.990000 00:00:00.99 +0 0 0 0 999000 00:00:00.999000 00:00:00.999 +0 0 0 0 999900 00:00:00.999900 00:00:00.9999 +0 0 0 0 999990 00:00:00.999990 00:00:00.99999 +0 0 0 0 999999 00:00:00.999999 00:00:00.999999 +0 0 0 1 0 00:00:01.000000 00:00:00.9999999 +34 22 0 0 0 34 22:00:00.000000 837:59:59.9999999 +34 22 59 59 0 34 22:59:59.000000 838:59:59 +34 22 59 59 900000 34 22:59:59.900000 838:59:59.9 +34 22 59 59 990000 34 22:59:59.990000 838:59:59.99 +34 22 59 59 999000 34 22:59:59.999000 838:59:59.999 +34 22 59 59 999900 34 22:59:59.999900 838:59:59.9999 +34 22 59 59 999990 34 22:59:59.999990 838:59:59.99999 +34 22 59 59 999999 34 22:59:59.999999 838:59:59.999999 +34 23 0 0 0 34 23:00:00.000000 838:59:59.9999999 +35 0 0 0 0 35 00:00:00.000000 839:59:59.9999999 +3652058 22 59 59 999999 3652058 22:59:59.999999 87649414:59:59.999999 +3652058 23 0 0 0 3652058 23:00:00.000000 87649414:59:59.9999999 +3652058 23 59 59 999999 3652058 23:59:59.999999 87649415:59:59.999999 +3652058 23 59 59 999999 3652058 23:59:59.999999 87649415:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '837:59:59.9999999' +Note 1292 Truncated incorrect time value: '837:59:59.9999999' +Note 1292 Truncated incorrect time value: '837:59:59.9999999' +Note 1292 Truncated incorrect time value: '837:59:59.9999999' +Note 1292 Truncated incorrect time value: '837:59:59.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '837:59:59.9999999' +Note 1292 Truncated incorrect time value: '838:59:59.9999999' +Note 1292 Truncated incorrect time value: '838:59:59.9999999' +Note 1292 Truncated incorrect time value: '838:59:59.9999999' +Note 1292 Truncated incorrect time value: '838:59:59.9999999' +Note 1292 Truncated incorrect time value: '838:59:59.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '838:59:59.9999999' +Note 1292 Truncated incorrect time value: '839:59:59.9999999' +Note 1292 Truncated incorrect time value: '839:59:59.9999999' +Note 1292 Truncated incorrect time value: '839:59:59.9999999' +Note 1292 Truncated incorrect time value: '839:59:59.9999999' +Note 1292 Truncated incorrect time value: '839:59:59.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '839:59:59.9999999' +Note 1292 Truncated incorrect time value: '87649414:59:59.9999999' +Note 1292 Truncated incorrect time value: '87649414:59:59.9999999' +Note 1292 Truncated incorrect time value: '87649414:59:59.9999999' +Note 1292 Truncated incorrect time value: '87649414:59:59.9999999' +Note 1292 Truncated incorrect time value: '87649414:59:59.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '87649414:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '87649415:59:59.9999999' +SELECT +TIME_TO_SEC(a), +CAST(a AS TIME(6)), +a +FROM t1_time_in_varchar ORDER BY id; +TIME_TO_SEC(a) CAST(a AS TIME(6)) a +0.000000 00:00:00.000000 00:00:00 +0.900000 00:00:00.900000 00:00:00.9 +0.990000 00:00:00.990000 00:00:00.99 +0.999000 00:00:00.999000 00:00:00.999 +0.999900 00:00:00.999900 00:00:00.9999 +0.999990 00:00:00.999990 00:00:00.99999 +0.999999 00:00:00.999999 00:00:00.999999 +1.000000 00:00:01.000000 00:00:00.9999999 +3016800.000000 838:00:00.000000 837:59:59.9999999 +3020399.000000 838:59:59.000000 838:59:59 +3020399.900000 838:59:59.900000 838:59:59.9 +3020399.990000 838:59:59.990000 838:59:59.99 +3020399.999000 838:59:59.999000 838:59:59.999 +3020399.999900 838:59:59.999900 838:59:59.9999 +3020399.999990 838:59:59.999990 838:59:59.99999 +3020399.999999 838:59:59.999999 838:59:59.999999 +3020399.999999 838:59:59.999999 838:59:59.9999999 +3020399.999999 838:59:59.999999 839:59:59.9999999 +3020399.999999 838:59:59.999999 87649414:59:59.999999 +3020399.999999 838:59:59.999999 87649414:59:59.9999999 +3020399.999999 838:59:59.999999 87649415:59:59.999999 +3020399.999999 838:59:59.999999 87649415:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '837:59:59.9999999' +Note 1292 Truncated incorrect time value: '837:59:59.9999999' +Warning 1292 Truncated incorrect time value: '838:59:59.9999999' +Warning 1292 Truncated incorrect time value: '838:59:59.9999999' +Warning 1292 Truncated incorrect time value: '839:59:59.9999999' +Warning 1292 Truncated incorrect time value: '839:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649414:59:59.999999' +Warning 1292 Truncated incorrect time value: '87649414:59:59.999999' +Warning 1292 Truncated incorrect time value: '87649414:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649414:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999' +Warning 1292 Truncated incorrect time value: '87649415:59:59.9999999' +# +# Functions with a single TIME interval input, conversion from TIME-interval-in-DECIMAL +# +SELECT +EXTRACT(DAY FROM a), +EXTRACT(HOUR FROM a), +EXTRACT(MINUTE FROM a), +EXTRACT(SECOND FROM a), +EXTRACT(MICROSECOND FROM a), +CAST(a AS INTERVAL DAY_SECOND(6)), +a +FROM t1_time_in_decimal ORDER BY id; +EXTRACT(DAY FROM a) EXTRACT(HOUR FROM a) EXTRACT(MINUTE FROM a) EXTRACT(SECOND FROM a) EXTRACT(MICROSECOND FROM a) CAST(a AS INTERVAL DAY_SECOND(6)) a +0 0 0 0 0 00:00:00.000000 0.0000000000 +0 0 0 0 900000 00:00:00.900000 0.9000000000 +0 0 0 0 990000 00:00:00.990000 0.9900000000 +0 0 0 0 999000 00:00:00.999000 0.9990000000 +0 0 0 0 999900 00:00:00.999900 0.9999000000 +0 0 0 0 999990 00:00:00.999990 0.9999900000 +0 0 0 0 999999 00:00:00.999999 0.9999990000 +0 0 0 1 0 00:00:01.000000 0.9999999000 +34 22 0 0 0 34 22:00:00.000000 8375959.9999999000 +34 22 59 59 0 34 22:59:59.000000 8385959.0000000000 +34 22 59 59 900000 34 22:59:59.900000 8385959.9000000000 +34 22 59 59 990000 34 22:59:59.990000 8385959.9900000000 +34 22 59 59 999000 34 22:59:59.999000 8385959.9990000000 +34 22 59 59 999900 34 22:59:59.999900 8385959.9999000000 +34 22 59 59 999990 34 22:59:59.999990 8385959.9999900000 +34 22 59 59 999999 34 22:59:59.999999 8385959.9999990000 +34 23 0 0 0 34 23:00:00.000000 8385959.9999999000 +35 0 0 0 0 35 00:00:00.000000 8395959.9999999000 +3652058 22 59 59 999999 3652058 22:59:59.999999 876494145959.9999990000 +3652058 23 0 0 0 3652058 23:00:00.000000 876494145959.9999999000 +3652058 23 59 59 999999 3652058 23:59:59.999999 876494155959.9999990000 +3652058 23 59 59 999999 3652058 23:59:59.999999 876494155959.9999999000 +Warnings: +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.0000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9900000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9990000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9999000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9999900000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9999990000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.9999999000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8375959.9999999000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.0000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9900000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9990000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9999000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9999900000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9999990000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.9999999000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8395959.9999999000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494145959.9999990000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494145959.9999999000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494155959.9999990000' +Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22 +Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22 +Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22 +Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22 +Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22 +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '876494155959.9999999000' +SELECT +TIME_TO_SEC(a), +CAST(a AS TIME(6)), +a +FROM t1_time_in_decimal ORDER BY id; +TIME_TO_SEC(a) CAST(a AS TIME(6)) a +0.000000 00:00:00.000000 0.0000000000 +0.900000 00:00:00.900000 0.9000000000 +0.990000 00:00:00.990000 0.9900000000 +0.999000 00:00:00.999000 0.9990000000 +0.999900 00:00:00.999900 0.9999000000 +0.999990 00:00:00.999990 0.9999900000 +0.999999 00:00:00.999999 0.9999990000 +1.000000 00:00:01.000000 0.9999999000 +3016800.000000 838:00:00.000000 8375959.9999999000 +3020399.000000 838:59:59.000000 8385959.0000000000 +3020399.900000 838:59:59.900000 8385959.9000000000 +3020399.990000 838:59:59.990000 8385959.9900000000 +3020399.999000 838:59:59.999000 8385959.9990000000 +3020399.999900 838:59:59.999900 8385959.9999000000 +3020399.999990 838:59:59.999990 8385959.9999900000 +3020399.999999 838:59:59.999999 8385959.9999990000 +3020399.999999 838:59:59.999999 8385959.9999999000 +3020399.999999 838:59:59.999999 8395959.9999999000 +NULL NULL 876494145959.9999990000 +NULL NULL 876494145959.9999999000 +NULL NULL 876494155959.9999990000 +NULL NULL 876494155959.9999999000 +Warnings: +Warning 1292 Incorrect time value: '8385959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 17 +Warning 1292 Incorrect time value: '8385959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 17 +Warning 1292 Incorrect time value: '8395959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 18 +Warning 1292 Incorrect time value: '8395959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 18 +Warning 1292 Incorrect time value: '876494145959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 19 +Warning 1292 Incorrect time value: '876494145959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 19 +Warning 1292 Incorrect time value: '876494145959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 20 +Warning 1292 Incorrect time value: '876494145959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 20 +Warning 1292 Incorrect time value: '876494155959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 21 +Warning 1292 Incorrect time value: '876494155959.9999990000' for column `test`.`t1_time_in_decimal`.`a` at row 21 +Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22 +Warning 1292 Incorrect time value: '876494155959.9999999000' for column `test`.`t1_time_in_decimal`.`a` at row 22 +# +# Functions with a single DATE input, conversion from DATETIME-in-VARCHAR +# +SELECT QUARTER(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +QUARTER(a) CAST(a AS DATE) a +4 2000-12-31 2000-12-31 23:59:59 +4 2000-12-31 2000-12-31 23:59:59.9 +4 2000-12-31 2000-12-31 23:59:59.99 +4 2000-12-31 2000-12-31 23:59:59.999 +4 2000-12-31 2000-12-31 23:59:59.9999 +4 2000-12-31 2000-12-31 23:59:59.99999 +4 2000-12-31 2000-12-31 23:59:59.999999 +1 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +DAY(a) CAST(a AS DATE) a +31 2000-12-31 2000-12-31 23:59:59 +31 2000-12-31 2000-12-31 23:59:59.9 +31 2000-12-31 2000-12-31 23:59:59.99 +31 2000-12-31 2000-12-31 23:59:59.999 +31 2000-12-31 2000-12-31 23:59:59.9999 +31 2000-12-31 2000-12-31 23:59:59.99999 +31 2000-12-31 2000-12-31 23:59:59.999999 +1 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT MONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +MONTH(a) CAST(a AS DATE) a +12 2000-12-31 2000-12-31 23:59:59 +12 2000-12-31 2000-12-31 23:59:59.9 +12 2000-12-31 2000-12-31 23:59:59.99 +12 2000-12-31 2000-12-31 23:59:59.999 +12 2000-12-31 2000-12-31 23:59:59.9999 +12 2000-12-31 2000-12-31 23:59:59.99999 +12 2000-12-31 2000-12-31 23:59:59.999999 +1 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +YEAR(a) CAST(a AS DATE) a +2000 2000-12-31 2000-12-31 23:59:59 +2000 2000-12-31 2000-12-31 23:59:59.9 +2000 2000-12-31 2000-12-31 23:59:59.99 +2000 2000-12-31 2000-12-31 23:59:59.999 +2000 2000-12-31 2000-12-31 23:59:59.9999 +2000 2000-12-31 2000-12-31 23:59:59.99999 +2000 2000-12-31 2000-12-31 23:59:59.999999 +2001 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +DAYNAME(a) CAST(a AS DATE) a +Sunday 2000-12-31 2000-12-31 23:59:59 +Sunday 2000-12-31 2000-12-31 23:59:59.9 +Sunday 2000-12-31 2000-12-31 23:59:59.99 +Sunday 2000-12-31 2000-12-31 23:59:59.999 +Sunday 2000-12-31 2000-12-31 23:59:59.9999 +Sunday 2000-12-31 2000-12-31 23:59:59.99999 +Sunday 2000-12-31 2000-12-31 23:59:59.999999 +Monday 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +MONTHNAME(a) CAST(a AS DATE) a +December 2000-12-31 2000-12-31 23:59:59 +December 2000-12-31 2000-12-31 23:59:59.9 +December 2000-12-31 2000-12-31 23:59:59.99 +December 2000-12-31 2000-12-31 23:59:59.999 +December 2000-12-31 2000-12-31 23:59:59.9999 +December 2000-12-31 2000-12-31 23:59:59.99999 +December 2000-12-31 2000-12-31 23:59:59.999999 +January 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +LAST_DAY(a) CAST(a AS DATE) a +2000-12-31 2000-12-31 2000-12-31 23:59:59 +2000-12-31 2000-12-31 2000-12-31 23:59:59.9 +2000-12-31 2000-12-31 2000-12-31 23:59:59.99 +2000-12-31 2000-12-31 2000-12-31 23:59:59.999 +2000-12-31 2000-12-31 2000-12-31 23:59:59.9999 +2000-12-31 2000-12-31 2000-12-31 23:59:59.99999 +2000-12-31 2000-12-31 2000-12-31 23:59:59.999999 +2000-12-31 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +TO_DAYS(a) CAST(a AS DATE) a +730850 2000-12-31 2000-12-31 23:59:59 +730850 2000-12-31 2000-12-31 23:59:59.9 +730850 2000-12-31 2000-12-31 23:59:59.99 +730850 2000-12-31 2000-12-31 23:59:59.999 +730850 2000-12-31 2000-12-31 23:59:59.9999 +730850 2000-12-31 2000-12-31 23:59:59.99999 +730850 2000-12-31 2000-12-31 23:59:59.999999 +730851 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +DAYOFYEAR(a) CAST(a AS DATE) a +366 2000-12-31 2000-12-31 23:59:59 +366 2000-12-31 2000-12-31 23:59:59.9 +366 2000-12-31 2000-12-31 23:59:59.99 +366 2000-12-31 2000-12-31 23:59:59.999 +366 2000-12-31 2000-12-31 23:59:59.9999 +366 2000-12-31 2000-12-31 23:59:59.99999 +366 2000-12-31 2000-12-31 23:59:59.999999 +1 2000-12-31 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +CREATE TABLE t1 (a VARCHAR(32)); +INSERT INTO t1 VALUES +('2002-01-05 23:59:59'), +('2002-01-05 23:59:59.999999'), +('2002-01-05 23:59:59.9999999'); +SELECT YEARWEEK(a), a FROM t1; +YEARWEEK(a) a +200152 2002-01-05 23:59:59 +200152 2002-01-05 23:59:59.999999 +200201 2002-01-05 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2002-01-05 23:59:59.9999999' +SELECT WEEK(a), a FROM t1; +WEEK(a) a +0 2002-01-05 23:59:59 +0 2002-01-05 23:59:59.999999 +1 2002-01-05 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2002-01-05 23:59:59.9999999' +SELECT WEEKDAY(a), a FROM t1; +WEEKDAY(a) a +5 2002-01-05 23:59:59 +5 2002-01-05 23:59:59.999999 +6 2002-01-05 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2002-01-05 23:59:59.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(32,9)); +INSERT INTO t1 VALUES +(20020105235959), +(20020105235959.999999), +(20020105235959.9999999); +SELECT YEARWEEK(a), a FROM t1; +YEARWEEK(a) a +200152 20020105235959.000000000 +200152 20020105235959.999999000 +200201 20020105235959.999999900 +SELECT WEEK(a), a FROM t1; +WEEK(a) a +0 20020105235959.000000000 +0 20020105235959.999999000 +1 20020105235959.999999900 +SELECT WEEKDAY(a), a FROM t1; +WEEKDAY(a) a +5 20020105235959.000000000 +5 20020105235959.999999000 +6 20020105235959.999999900 +DROP TABLE t1; +# +# Functions with a single DATE input, conversion from DATETIME-in-DECIMAL +# +SELECT QUARTER(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +QUARTER(a) CAST(a AS DATE) a +4 2000-12-31 20001231235959.0000000000 +4 2000-12-31 20001231235959.9000000000 +4 2000-12-31 20001231235959.9900000000 +4 2000-12-31 20001231235959.9990000000 +4 2000-12-31 20001231235959.9999000000 +4 2000-12-31 20001231235959.9999900000 +4 2000-12-31 20001231235959.9999990000 +1 2000-12-31 20001231235959.9999999000 +SELECT DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +DAY(a) CAST(a AS DATE) a +31 2000-12-31 20001231235959.0000000000 +31 2000-12-31 20001231235959.9000000000 +31 2000-12-31 20001231235959.9900000000 +31 2000-12-31 20001231235959.9990000000 +31 2000-12-31 20001231235959.9999000000 +31 2000-12-31 20001231235959.9999900000 +31 2000-12-31 20001231235959.9999990000 +1 2000-12-31 20001231235959.9999999000 +SELECT MONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +MONTH(a) CAST(a AS DATE) a +12 2000-12-31 20001231235959.0000000000 +12 2000-12-31 20001231235959.9000000000 +12 2000-12-31 20001231235959.9900000000 +12 2000-12-31 20001231235959.9990000000 +12 2000-12-31 20001231235959.9999000000 +12 2000-12-31 20001231235959.9999900000 +12 2000-12-31 20001231235959.9999990000 +1 2000-12-31 20001231235959.9999999000 +SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +YEAR(a) CAST(a AS DATE) a +2000 2000-12-31 20001231235959.0000000000 +2000 2000-12-31 20001231235959.9000000000 +2000 2000-12-31 20001231235959.9900000000 +2000 2000-12-31 20001231235959.9990000000 +2000 2000-12-31 20001231235959.9999000000 +2000 2000-12-31 20001231235959.9999900000 +2000 2000-12-31 20001231235959.9999990000 +2001 2000-12-31 20001231235959.9999999000 +SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +DAYNAME(a) CAST(a AS DATE) a +Sunday 2000-12-31 20001231235959.0000000000 +Sunday 2000-12-31 20001231235959.9000000000 +Sunday 2000-12-31 20001231235959.9900000000 +Sunday 2000-12-31 20001231235959.9990000000 +Sunday 2000-12-31 20001231235959.9999000000 +Sunday 2000-12-31 20001231235959.9999900000 +Sunday 2000-12-31 20001231235959.9999990000 +Monday 2000-12-31 20001231235959.9999999000 +SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +MONTHNAME(a) CAST(a AS DATE) a +December 2000-12-31 20001231235959.0000000000 +December 2000-12-31 20001231235959.9000000000 +December 2000-12-31 20001231235959.9900000000 +December 2000-12-31 20001231235959.9990000000 +December 2000-12-31 20001231235959.9999000000 +December 2000-12-31 20001231235959.9999900000 +December 2000-12-31 20001231235959.9999990000 +January 2000-12-31 20001231235959.9999999000 +SELECT YEARWEEK(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +YEARWEEK(a) CAST(a AS DATE) a +200053 2000-12-31 20001231235959.0000000000 +200053 2000-12-31 20001231235959.9000000000 +200053 2000-12-31 20001231235959.9900000000 +200053 2000-12-31 20001231235959.9990000000 +200053 2000-12-31 20001231235959.9999000000 +200053 2000-12-31 20001231235959.9999900000 +200053 2000-12-31 20001231235959.9999990000 +200053 2000-12-31 20001231235959.9999999000 +SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +LAST_DAY(a) CAST(a AS DATE) a +2000-12-31 2000-12-31 20001231235959.0000000000 +2000-12-31 2000-12-31 20001231235959.9000000000 +2000-12-31 2000-12-31 20001231235959.9900000000 +2000-12-31 2000-12-31 20001231235959.9990000000 +2000-12-31 2000-12-31 20001231235959.9999000000 +2000-12-31 2000-12-31 20001231235959.9999900000 +2000-12-31 2000-12-31 20001231235959.9999990000 +2000-12-31 2000-12-31 20001231235959.9999999000 +SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +TO_DAYS(a) CAST(a AS DATE) a +730850 2000-12-31 20001231235959.0000000000 +730850 2000-12-31 20001231235959.9000000000 +730850 2000-12-31 20001231235959.9900000000 +730850 2000-12-31 20001231235959.9990000000 +730850 2000-12-31 20001231235959.9999000000 +730850 2000-12-31 20001231235959.9999900000 +730850 2000-12-31 20001231235959.9999990000 +730851 2000-12-31 20001231235959.9999999000 +SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +DAYOFYEAR(a) CAST(a AS DATE) a +366 2000-12-31 20001231235959.0000000000 +366 2000-12-31 20001231235959.9000000000 +366 2000-12-31 20001231235959.9900000000 +366 2000-12-31 20001231235959.9990000000 +366 2000-12-31 20001231235959.9999000000 +366 2000-12-31 20001231235959.9999900000 +366 2000-12-31 20001231235959.9999990000 +1 2000-12-31 20001231235959.9999999000 +SELECT DAYOFMONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +DAYOFMONTH(a) CAST(a AS DATE) a +31 2000-12-31 20001231235959.0000000000 +31 2000-12-31 20001231235959.9000000000 +31 2000-12-31 20001231235959.9900000000 +31 2000-12-31 20001231235959.9990000000 +31 2000-12-31 20001231235959.9999000000 +31 2000-12-31 20001231235959.9999900000 +31 2000-12-31 20001231235959.9999990000 +1 2000-12-31 20001231235959.9999999000 +# +# Functions with a single DATETIME input, conversion from DATETIME-in-VARCHAR +# +SELECT TO_SECONDS(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +TO_SECONDS(a) CAST(a AS DATETIME(6)) a +63145526399 2000-12-31 23:59:59.000000 2000-12-31 23:59:59 +63145526399 2000-12-31 23:59:59.900000 2000-12-31 23:59:59.9 +63145526399 2000-12-31 23:59:59.990000 2000-12-31 23:59:59.99 +63145526399 2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999 +63145526399 2000-12-31 23:59:59.999900 2000-12-31 23:59:59.9999 +63145526399 2000-12-31 23:59:59.999990 2000-12-31 23:59:59.99999 +63145526399 2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999 +63145526400 2001-01-01 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SET time_zone='+00:00'; +SELECT UNIX_TIMESTAMP(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +UNIX_TIMESTAMP(a) CAST(a AS DATETIME(6)) a +978307199.000000 2000-12-31 23:59:59.000000 2000-12-31 23:59:59 +978307199.900000 2000-12-31 23:59:59.900000 2000-12-31 23:59:59.9 +978307199.990000 2000-12-31 23:59:59.990000 2000-12-31 23:59:59.99 +978307199.999000 2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999 +978307199.999900 2000-12-31 23:59:59.999900 2000-12-31 23:59:59.9999 +978307199.999990 2000-12-31 23:59:59.999990 2000-12-31 23:59:59.99999 +978307199.999999 2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999 +978307200.000000 2001-01-01 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SET time_zone=DEFAULT; +SELECT CONVERT_TZ(a, '+00:00','+00:00'), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +CONVERT_TZ(a, '+00:00','+00:00') CAST(a AS DATETIME(6)) a +2000-12-31 23:59:59.000000 2000-12-31 23:59:59.000000 2000-12-31 23:59:59 +2000-12-31 23:59:59.900000 2000-12-31 23:59:59.900000 2000-12-31 23:59:59.9 +2000-12-31 23:59:59.990000 2000-12-31 23:59:59.990000 2000-12-31 23:59:59.99 +2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999 +2000-12-31 23:59:59.999900 2000-12-31 23:59:59.999900 2000-12-31 23:59:59.9999 +2000-12-31 23:59:59.999990 2000-12-31 23:59:59.999990 2000-12-31 23:59:59.99999 +2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999 +2001-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 2000-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +# +# Functions with a single DATETIME input, conversion from DATETIME-in-DECIMAL +# +SELECT TO_SECONDS(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +TO_SECONDS(a) CAST(a AS DATETIME(6)) a +63145526399 2000-12-31 23:59:59.000000 20001231235959.0000000000 +63145526399 2000-12-31 23:59:59.900000 20001231235959.9000000000 +63145526399 2000-12-31 23:59:59.990000 20001231235959.9900000000 +63145526399 2000-12-31 23:59:59.999000 20001231235959.9990000000 +63145526399 2000-12-31 23:59:59.999900 20001231235959.9999000000 +63145526399 2000-12-31 23:59:59.999990 20001231235959.9999900000 +63145526399 2000-12-31 23:59:59.999999 20001231235959.9999990000 +63145526400 2001-01-01 00:00:00.000000 20001231235959.9999999000 +SET time_zone='+00:00'; +SELECT UNIX_TIMESTAMP(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +UNIX_TIMESTAMP(a) CAST(a AS DATETIME(6)) a +978307199.000000 2000-12-31 23:59:59.000000 20001231235959.0000000000 +978307199.900000 2000-12-31 23:59:59.900000 20001231235959.9000000000 +978307199.990000 2000-12-31 23:59:59.990000 20001231235959.9900000000 +978307199.999000 2000-12-31 23:59:59.999000 20001231235959.9990000000 +978307199.999900 2000-12-31 23:59:59.999900 20001231235959.9999000000 +978307199.999990 2000-12-31 23:59:59.999990 20001231235959.9999900000 +978307199.999999 2000-12-31 23:59:59.999999 20001231235959.9999990000 +978307200.000000 2001-01-01 00:00:00.000000 20001231235959.9999999000 +SET time_zone=DEFAULT; +SELECT CONVERT_TZ(a, '+00:00','+00:00'), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +CONVERT_TZ(a, '+00:00','+00:00') CAST(a AS DATETIME(6)) a +2000-12-31 23:59:59.000000 2000-12-31 23:59:59.000000 20001231235959.0000000000 +2000-12-31 23:59:59.900000 2000-12-31 23:59:59.900000 20001231235959.9000000000 +2000-12-31 23:59:59.990000 2000-12-31 23:59:59.990000 20001231235959.9900000000 +2000-12-31 23:59:59.999000 2000-12-31 23:59:59.999000 20001231235959.9990000000 +2000-12-31 23:59:59.999900 2000-12-31 23:59:59.999900 20001231235959.9999000000 +2000-12-31 23:59:59.999990 2000-12-31 23:59:59.999990 20001231235959.9999900000 +2000-12-31 23:59:59.999999 2000-12-31 23:59:59.999999 20001231235959.9999990000 +2001-01-01 00:00:00.000000 2001-01-01 00:00:00.000000 20001231235959.9999999000 +DROP TABLE t1_datetime_in_varchar; +DROP TABLE t1_datetime_in_decimal; +DROP TABLE t1_time_in_varchar; +DROP TABLE t1_time_in_decimal; +# +# Functions that construct DATETIME +# +SET time_zone='+00:00'; +CREATE TABLE t1_unix_timestamp (id SERIAL, a DECIMAL(30,10)); +INSERT INTO t1_unix_timestamp (a) VALUES +(980639999), +(980639999.9), +(980639999.999999), +(980639999.9999999), +(2147483647), +(2147483647.9), +(2147483647.999999), +(2147483647.9999999); +SELECT a, FROM_UNIXTIME(a) FROM t1_unix_timestamp ORDER BY id; +a FROM_UNIXTIME(a) +980639999.0000000000 2001-01-27 23:59:59.000000 +980639999.9000000000 2001-01-27 23:59:59.900000 +980639999.9999990000 2001-01-27 23:59:59.999999 +980639999.9999999000 2001-01-28 00:00:00.000000 +2147483647.0000000000 2038-01-19 03:14:07.000000 +2147483647.9000000000 2038-01-19 03:14:07.900000 +2147483647.9999990000 2038-01-19 03:14:07.999999 +2147483647.9999999000 NULL +DROP TABLE t1_unix_timestamp; +SET time_zone=DEFAULT; +# +# Functions that construct TIME +# +CREATE TABLE t1_sec (id SERIAL, a DECIMAL(38,10)); +INSERT INTO t1_sec (a) VALUES +(59), +(59.9), +(59.999999), +(59.9999999), +(3020398), +(3020398.999999), +(3020398.9999999), +(3020399), +(3020399.999999), +(3020399.9999999), +(9223372036854775807), +(9223372036854775807.9), +(9223372036854775807.999999), +(9223372036854775807.9999999), +(18446744073709551615), +(18446744073709551615.9), +(18446744073709551615.999999), +(18446744073709551615.9999999); +SELECT a, SEC_TO_TIME(a) FROM t1_sec ORDER BY id; +a SEC_TO_TIME(a) +59.0000000000 00:00:59.000000 +59.9000000000 00:00:59.900000 +59.9999990000 00:00:59.999999 +59.9999999000 00:01:00.000000 +3020398.0000000000 838:59:58.000000 +3020398.9999990000 838:59:58.999999 +3020398.9999999000 838:59:59.000000 +3020399.0000000000 838:59:59.000000 +3020399.9999990000 838:59:59.999999 +3020399.9999999000 838:59:59.999999 +9223372036854775807.0000000000 838:59:59.999999 +9223372036854775807.9000000000 838:59:59.999999 +9223372036854775807.9999990000 838:59:59.999999 +9223372036854775807.9999999000 838:59:59.999999 +18446744073709551615.0000000000 838:59:59.999999 +18446744073709551615.9000000000 838:59:59.999999 +18446744073709551615.9999990000 838:59:59.999999 +18446744073709551615.9999999000 838:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect seconds value: '3020400' +Warning 1292 Truncated incorrect seconds value: '9223372036854775807.0000000000' +Warning 1292 Truncated incorrect seconds value: '9223372036854775807.9000000000' +Warning 1292 Truncated incorrect seconds value: '9223372036854775807.9999990000' +Warning 1292 Truncated incorrect seconds value: '9223372036854775807.9999999000' +Warning 1292 Truncated incorrect seconds value: '18446744073709551615.0000000000' +Warning 1292 Truncated incorrect seconds value: '18446744073709551615.9000000000' +Warning 1292 Truncated incorrect seconds value: '18446744073709551615.9999990000' +Warning 1292 Truncated incorrect seconds value: '18446744073709551615.9999999000' +DROP TABLE t1_sec; +CREATE TABLE t1_sec (id SERIAL, a DECIMAL(38,10)); +INSERT INTO t1_sec (a) VALUES +(0), +(0.9), +(0.999999), +(0.9999999); +SELECT a, MAKETIME(0, 0, a) FROM t1_sec ORDER BY id; +a MAKETIME(0, 0, a) +0.0000000000 00:00:00.000000 +0.9000000000 00:00:00.900000 +0.9999990000 00:00:00.999999 +0.9999999000 00:00:01.000000 +DROP TABLE t1_sec; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2017-12-31 23:59:59'), +('2017-12-31 23:59:59.9'), +('2017-12-31 23:59:59.999999'), +('2017-12-31 23:59:59.9999999'); +SELECT +'----', +a, +DATE_FORMAT(a, '%Y') AS yyyy, +DATE_FORMAT(a, '%Y-%m-%d') AS d, +DATE_FORMAT(a, '%H:%i:%s') AS t0, +DATE_FORMAT(a, '%H:%i:%s.%f') AS t6, +DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s') AS dt0, +DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s.%f') AS dt6 +FROM t1; +---- ---- +a 2017-12-31 23:59:59 +yyyy 2017 +d 2017-12-31 +t0 23:59:59 +t6 23:59:59.000000 +dt0 2017-12-31 23:59:59 +dt6 2017-12-31 23:59:59.000000 +---- ---- +a 2017-12-31 23:59:59.9 +yyyy 2017 +d 2017-12-31 +t0 23:59:59 +t6 23:59:59.900000 +dt0 2017-12-31 23:59:59 +dt6 2017-12-31 23:59:59.900000 +---- ---- +a 2017-12-31 23:59:59.999999 +yyyy 2017 +d 2017-12-31 +t0 23:59:59 +t6 23:59:59.999999 +dt0 2017-12-31 23:59:59 +dt6 2017-12-31 23:59:59.999999 +---- ---- +a 2017-12-31 23:59:59.9999999 +yyyy 2018 +d 2018-01-01 +t0 00:00:00 +t6 00:00:00.000000 +dt0 2018-01-01 00:00:00 +dt6 2018-01-01 00:00:00.000000 +Warnings: +Level Note +Code 1292 +Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Level Note +Code 1292 +Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Level Note +Code 1292 +Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Level Note +Code 1292 +Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Level Note +Code 1292 +Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Level Note +Code 1292 +Message Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(32,9)); +INSERT INTO t1 VALUES +(20171231235959), +(20171231235959.9), +(20171231235959.999999), +(20171231235959.9999999); +SELECT +'----', +a, +DATE_FORMAT(a, '%Y') AS yyyy, +DATE_FORMAT(a, '%Y-%m-%d') AS d, +DATE_FORMAT(a, '%H:%i:%s') AS t0, +DATE_FORMAT(a, '%H:%i:%s.%f') AS t6, +DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s') AS dt0, +DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s.%f') AS dt6 +FROM t1; +---- ---- +a 20171231235959.000000000 +yyyy 2017 +d 2017-12-31 +t0 23:59:59 +t6 23:59:59.000000 +dt0 2017-12-31 23:59:59 +dt6 2017-12-31 23:59:59.000000 +---- ---- +a 20171231235959.900000000 +yyyy 2017 +d 2017-12-31 +t0 23:59:59 +t6 23:59:59.900000 +dt0 2017-12-31 23:59:59 +dt6 2017-12-31 23:59:59.900000 +---- ---- +a 20171231235959.999999000 +yyyy 2017 +d 2017-12-31 +t0 23:59:59 +t6 23:59:59.999999 +dt0 2017-12-31 23:59:59 +dt6 2017-12-31 23:59:59.999999 +---- ---- +a 20171231235959.999999900 +yyyy 2018 +d 2018-01-01 +t0 00:00:00 +t6 00:00:00.000000 +dt0 2018-01-01 00:00:00 +dt6 2018-01-01 00:00:00.000000 +DROP TABLE t1; +# +# Functions with two temporal parameters that round nanoseconds in both parameters in MySQL +# +CREATE TABLE t1 (a VARCHAR(64)); +CREATE TABLE t2 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2017-12-31 23:59:59'), +('2017-12-31 23:59:59.9'), +('2017-12-31 23:59:59.999999'), +('2017-12-31 23:59:59.9999999'); +INSERT INTO t2 VALUES +('00:00:00'), +('00:00:00.9'), +('00:00:00.999999'), +('00:00:00.9999999'); +SELECT TIMESTAMP(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +TIMESTAMP(t1.a, t2.a) a a +2017-12-31 23:59:59.000000 2017-12-31 23:59:59 00:00:00 +2017-12-31 23:59:59.900000 2017-12-31 23:59:59 00:00:00.9 +2017-12-31 23:59:59.999999 2017-12-31 23:59:59 00:00:00.999999 +2018-01-01 00:00:00.000000 2017-12-31 23:59:59 00:00:00.9999999 +2017-12-31 23:59:59.900000 2017-12-31 23:59:59.9 00:00:00 +2018-01-01 00:00:00.800000 2017-12-31 23:59:59.9 00:00:00.9 +2018-01-01 00:00:00.899999 2017-12-31 23:59:59.9 00:00:00.999999 +2018-01-01 00:00:00.900000 2017-12-31 23:59:59.9 00:00:00.9999999 +2017-12-31 23:59:59.999999 2017-12-31 23:59:59.999999 00:00:00 +2018-01-01 00:00:00.899999 2017-12-31 23:59:59.999999 00:00:00.9 +2018-01-01 00:00:00.999998 2017-12-31 23:59:59.999999 00:00:00.999999 +2018-01-01 00:00:00.999999 2017-12-31 23:59:59.999999 00:00:00.9999999 +2018-01-01 00:00:00.000000 2017-12-31 23:59:59.9999999 00:00:00 +2018-01-01 00:00:00.900000 2017-12-31 23:59:59.9999999 00:00:00.9 +2018-01-01 00:00:00.999999 2017-12-31 23:59:59.9999999 00:00:00.999999 +2018-01-01 00:00:01.000000 2017-12-31 23:59:59.9999999 00:00:00.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +SELECT ADDTIME(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +ADDTIME(t1.a, t2.a) a a +2017-12-31 23:59:59 2017-12-31 23:59:59 00:00:00 +2017-12-31 23:59:59.900000 2017-12-31 23:59:59 00:00:00.9 +2017-12-31 23:59:59.999999 2017-12-31 23:59:59 00:00:00.999999 +2018-01-01 00:00:00 2017-12-31 23:59:59 00:00:00.9999999 +2017-12-31 23:59:59.900000 2017-12-31 23:59:59.9 00:00:00 +2018-01-01 00:00:00.800000 2017-12-31 23:59:59.9 00:00:00.9 +2018-01-01 00:00:00.899999 2017-12-31 23:59:59.9 00:00:00.999999 +2018-01-01 00:00:00.900000 2017-12-31 23:59:59.9 00:00:00.9999999 +2017-12-31 23:59:59.999999 2017-12-31 23:59:59.999999 00:00:00 +2018-01-01 00:00:00.899999 2017-12-31 23:59:59.999999 00:00:00.9 +2018-01-01 00:00:00.999998 2017-12-31 23:59:59.999999 00:00:00.999999 +2018-01-01 00:00:00.999999 2017-12-31 23:59:59.999999 00:00:00.9999999 +2018-01-01 00:00:00 2017-12-31 23:59:59.9999999 00:00:00 +2018-01-01 00:00:00.900000 2017-12-31 23:59:59.9999999 00:00:00.9 +2018-01-01 00:00:00.999999 2017-12-31 23:59:59.9999999 00:00:00.999999 +2018-01-01 00:00:01 2017-12-31 23:59:59.9999999 00:00:00.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '00:00:00.9999999' +DROP TABLE t1, t2; +CREATE TABLE t1 (a VARCHAR(64)); +CREATE TABLE t2 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('23:59:59'), +('23:59:59.9'), +('23:59:59.999999'), +('23:59:59.9999999'); +INSERT INTO t2 VALUES +('00:00:00'), +('00:00:00.9'), +('00:00:00.999999'), +('00:00:00.9999999'); +SELECT TIMEDIFF(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +TIMEDIFF(t1.a, t2.a) a a +23:59:59.000000 23:59:59 00:00:00 +23:59:58.100000 23:59:59 00:00:00.9 +23:59:58.000001 23:59:59 00:00:00.999999 +23:59:58.000000 23:59:59 00:00:00.9999999 +23:59:59.900000 23:59:59.9 00:00:00 +23:59:59.000000 23:59:59.9 00:00:00.9 +23:59:58.900001 23:59:59.9 00:00:00.999999 +23:59:58.900000 23:59:59.9 00:00:00.9999999 +23:59:59.999999 23:59:59.999999 00:00:00 +23:59:59.099999 23:59:59.999999 00:00:00.9 +23:59:59.000000 23:59:59.999999 00:00:00.999999 +23:59:58.999999 23:59:59.999999 00:00:00.9999999 +24:00:00.000000 23:59:59.9999999 00:00:00 +23:59:59.100000 23:59:59.9999999 00:00:00.9 +23:59:59.000001 23:59:59.9999999 00:00:00.999999 +23:59:59.000000 23:59:59.9999999 00:00:00.9999999 +Warnings: +Note 1292 Truncated incorrect time value: '23:59:59.9999999' +Note 1292 Truncated incorrect time value: '23:59:59.9999999' +Note 1292 Truncated incorrect time value: '23:59:59.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '23:59:59.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +DROP TABLE t1, t2; +CREATE TABLE t1 (a VARCHAR(64)); +CREATE TABLE t2 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2001-12-31 23:59:59'), +('2001-12-31 23:59:59.9'), +('2001-12-31 23:59:59.999999'), +('2001-12-31 23:59:59.9999999'); +INSERT INTO t2 VALUES +('2001-12-31 23:59:59'), +('2001-12-31 23:59:59.9'), +('2001-12-31 23:59:59.999999'), +('2001-12-31 23:59:59.9999999'); +SELECT TIMESTAMPDIFF(MICROSECOND,t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +TIMESTAMPDIFF(MICROSECOND,t1.a, t2.a) a a +0 2001-12-31 23:59:59 2001-12-31 23:59:59 +900000 2001-12-31 23:59:59 2001-12-31 23:59:59.9 +999999 2001-12-31 23:59:59 2001-12-31 23:59:59.999999 +1000000 2001-12-31 23:59:59 2001-12-31 23:59:59.9999999 +-900000 2001-12-31 23:59:59.9 2001-12-31 23:59:59 +0 2001-12-31 23:59:59.9 2001-12-31 23:59:59.9 +99999 2001-12-31 23:59:59.9 2001-12-31 23:59:59.999999 +100000 2001-12-31 23:59:59.9 2001-12-31 23:59:59.9999999 +-999999 2001-12-31 23:59:59.999999 2001-12-31 23:59:59 +-99999 2001-12-31 23:59:59.999999 2001-12-31 23:59:59.9 +0 2001-12-31 23:59:59.999999 2001-12-31 23:59:59.999999 +1 2001-12-31 23:59:59.999999 2001-12-31 23:59:59.9999999 +-1000000 2001-12-31 23:59:59.9999999 2001-12-31 23:59:59 +-100000 2001-12-31 23:59:59.9999999 2001-12-31 23:59:59.9 +-1 2001-12-31 23:59:59.9999999 2001-12-31 23:59:59.999999 +0 2001-12-31 23:59:59.9999999 2001-12-31 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-12-31 23:59:59.9999999' +DROP TABLE t1, t2; +CREATE TABLE t1 (a VARCHAR(64)); +CREATE TABLE t2 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('23:59:59'), +('23:59:59.9'), +('23:59:59.999999'), +('23:59:59.9999999'); +INSERT INTO t2 VALUES +('00:00:00'), +('00:00:00.9'), +('00:00:00.999999'), +('00:00:00.9999999'); +SELECT TIMEDIFF(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +TIMEDIFF(t1.a, t2.a) a a +23:59:59.000000 23:59:59 00:00:00 +23:59:58.100000 23:59:59 00:00:00.9 +23:59:58.000001 23:59:59 00:00:00.999999 +23:59:58.000000 23:59:59 00:00:00.9999999 +23:59:59.900000 23:59:59.9 00:00:00 +23:59:59.000000 23:59:59.9 00:00:00.9 +23:59:58.900001 23:59:59.9 00:00:00.999999 +23:59:58.900000 23:59:59.9 00:00:00.9999999 +23:59:59.999999 23:59:59.999999 00:00:00 +23:59:59.099999 23:59:59.999999 00:00:00.9 +23:59:59.000000 23:59:59.999999 00:00:00.999999 +23:59:58.999999 23:59:59.999999 00:00:00.9999999 +24:00:00.000000 23:59:59.9999999 00:00:00 +23:59:59.100000 23:59:59.9999999 00:00:00.9 +23:59:59.000001 23:59:59.9999999 00:00:00.999999 +23:59:59.000000 23:59:59.9999999 00:00:00.9999999 +Warnings: +Note 1292 Truncated incorrect time value: '23:59:59.9999999' +Note 1292 Truncated incorrect time value: '23:59:59.9999999' +Note 1292 Truncated incorrect time value: '23:59:59.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +Note 1292 Truncated incorrect time value: '23:59:59.9999999' +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +DROP TABLE t1, t2; +# +# STR_TO_DATE behaviour is questionable in MySQL 5.6 (MySQL Bug #92474) +# +# It truncates nanoseconds, but this may change in the future. +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2017-12-31 23:59:59'), +('2017-12-31 23:59:59.9'), +('2017-12-31 23:59:59.999999'), +('2017-12-31 23:59:59.9999999'); +SELECT +a, +STR_TO_DATE(a, '%Y-%m-%d %H:%i:%s') AS c0, +STR_TO_DATE(a, '%Y-%m-%d %H:%i:%s.%f') AS c6 +FROM t1; +a c0 c6 +2017-12-31 23:59:59 2017-12-31 23:59:59 2017-12-31 23:59:59.000000 +2017-12-31 23:59:59.9 2017-12-31 23:59:59 2017-12-31 23:59:59.900000 +2017-12-31 23:59:59.999999 2017-12-31 23:59:59 2017-12-31 23:59:59.999999 +2017-12-31 23:59:59.9999999 2017-12-31 23:59:59 2017-12-31 23:59:59.999999 +Warnings: +Warning 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9' +Warning 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.999999' +Warning 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Warning 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +DROP TABLE t1; +# +# DATE_ADD behaviour is questionable in MySQL 5.6 (MySQL Bug#92473) +# It rounds nanoseconds in the first argument, but truncates nanoseconds in the second argument. +# This may change in the future, to round both arguments. +# +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2017-12-31 23:59:59'), +('2017-12-31 23:59:59.9'), +('2017-12-31 23:59:59.999999'), +('2017-12-31 23:59:59.9999999'); +CREATE TABLE t2 (b DECIMAL(32,9)); +INSERT INTO t2 VALUES +(0), +(0.9), +(0.999999), +(0.9999999); +SELECT a, b, DATE_ADD(a, INTERVAL b SECOND) FROM t1,t2 ORDER BY a,b; +a b DATE_ADD(a, INTERVAL b SECOND) +2017-12-31 23:59:59 0.000000000 2017-12-31 23:59:59.000000 +2017-12-31 23:59:59 0.900000000 2017-12-31 23:59:59.900000 +2017-12-31 23:59:59 0.999999000 2017-12-31 23:59:59.999999 +2017-12-31 23:59:59 0.999999900 2017-12-31 23:59:59.999999 +2017-12-31 23:59:59.9 0.000000000 2017-12-31 23:59:59.900000 +2017-12-31 23:59:59.9 0.900000000 2018-01-01 00:00:00.800000 +2017-12-31 23:59:59.9 0.999999000 2018-01-01 00:00:00.899999 +2017-12-31 23:59:59.9 0.999999900 2018-01-01 00:00:00.899999 +2017-12-31 23:59:59.999999 0.000000000 2017-12-31 23:59:59.999999 +2017-12-31 23:59:59.999999 0.900000000 2018-01-01 00:00:00.899999 +2017-12-31 23:59:59.999999 0.999999000 2018-01-01 00:00:00.999998 +2017-12-31 23:59:59.999999 0.999999900 2018-01-01 00:00:00.999998 +2017-12-31 23:59:59.9999999 0.000000000 2018-01-01 00:00:00.000000 +2017-12-31 23:59:59.9999999 0.900000000 2018-01-01 00:00:00.900000 +2017-12-31 23:59:59.9999999 0.999999000 2018-01-01 00:00:00.999999 +2017-12-31 23:59:59.9999999 0.999999900 2018-01-01 00:00:00.999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2017-12-31 23:59:59.9999999' +DROP TABLE t1, t2; diff --git a/mysql-test/main/func_time_round.test b/mysql-test/main/func_time_round.test new file mode 100644 index 00000000000..12d3a50a10f --- /dev/null +++ b/mysql-test/main/func_time_round.test @@ -0,0 +1,461 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; + +CREATE TABLE t1_datetime_in_varchar (id SERIAL, a VARCHAR(64)); +INSERT INTO t1_datetime_in_varchar (a) VALUES +('2000-12-31 23:59:59'), +('2000-12-31 23:59:59.9'), +('2000-12-31 23:59:59.99'), +('2000-12-31 23:59:59.999'), +('2000-12-31 23:59:59.9999'), +('2000-12-31 23:59:59.99999'), +('2000-12-31 23:59:59.999999'), +('2000-12-31 23:59:59.9999999'); + +CREATE TABLE t1_datetime_in_decimal (id SERIAL, a DECIMAL(38,10)); +INSERT INTO t1_datetime_in_decimal (a) VALUES +(20001231235959), +(20001231235959.9), +(20001231235959.99), +(20001231235959.999), +(20001231235959.9999), +(20001231235959.99999), +(20001231235959.999999), +(20001231235959.9999999); + + +CREATE TABLE t1_time_in_varchar (id SERIAL, a VARCHAR(64)); +INSERT INTO t1_time_in_varchar (a) VALUES +('00:00:00'), +('00:00:00.9'), +('00:00:00.99'), +('00:00:00.999'), +('00:00:00.9999'), +('00:00:00.99999'), +('00:00:00.999999'), +('00:00:00.9999999'); +INSERT INTO t1_time_in_varchar (a) VALUES +('837:59:59.9999999'), +('838:59:59'), +('838:59:59.9'), +('838:59:59.99'), +('838:59:59.999'), +('838:59:59.9999'), +('838:59:59.99999'), +('838:59:59.999999'), +('838:59:59.9999999'), +('839:59:59.9999999'), +('87649414:59:59.999999'), +('87649414:59:59.9999999'), +('87649415:59:59.999999'), +('87649415:59:59.9999999'); + + +CREATE TABLE t1_time_in_decimal (id SERIAL, a DECIMAL(38,10)); +INSERT INTO t1_time_in_decimal (a) VALUES +(0), +(0.9), +(0.99), +(0.999), +(0.9999), +(0.99999), +(0.999999), +(0.9999999); +INSERT INTO t1_time_in_decimal (a) VALUES +(8375959.9999999), +(8385959), +(8385959.9), +(8385959.99), +(8385959.999), +(8385959.9999), +(8385959.99999), +(8385959.999999), +(8385959.9999999), +(8395959.9999999), +(876494145959.999999), +(876494145959.9999999), +(876494155959.999999), +(876494155959.9999999); + +--echo # +--echo # TIME: LEAST/GREATEST +--echo # + +SELECT GREATEST(TIME'00:00:00', a) FROM t1_time_in_varchar; +SELECT GREATEST(TIME'00:00:00', a) FROM t1_time_in_decimal; + +SELECT GREATEST(TIME'00:00:00', '00:00:00.0000004'); +SELECT GREATEST(TIME'00:00:00', 0.0000004); + +SELECT GREATEST(TIME'00:00:00', '00:00:00.0000005'); +SELECT GREATEST(TIME'00:00:00', 0.0000005); + + +--echo # +--echo # Functions with a single TIME input, conversion from DATETIME-in-VARCHAR +--echo # + +SELECT SECOND(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT MINUTE(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT HOUR(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; + +SELECT EXTRACT(SECOND FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT EXTRACT(MINUTE FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT EXTRACT(HOUR FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; + +SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; + + +--echo # +--echo # Functions with a single TIME input, conversion from DATETIME-in-DECIMAL +--echo # + + +SELECT SECOND(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT MINUTE(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT HOUR(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; + +SELECT EXTRACT(SECOND FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT EXTRACT(MINUTE FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT EXTRACT(HOUR FROM a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; + +SELECT TIME_TO_SEC(a), CAST(a AS TIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; + + +--echo # +--echo # Functions with a single TIME interval input, conversion from TIME-interval-in-VARCHAR +--echo # + +SELECT + EXTRACT(DAY FROM a), + EXTRACT(HOUR FROM a), + EXTRACT(MINUTE FROM a), + EXTRACT(SECOND FROM a), + EXTRACT(MICROSECOND FROM a), + CAST(a AS INTERVAL DAY_SECOND(6)), + a +FROM t1_time_in_varchar ORDER BY id; + +SELECT + TIME_TO_SEC(a), + CAST(a AS TIME(6)), + a +FROM t1_time_in_varchar ORDER BY id; + +--echo # +--echo # Functions with a single TIME interval input, conversion from TIME-interval-in-DECIMAL +--echo # + +SELECT + EXTRACT(DAY FROM a), + EXTRACT(HOUR FROM a), + EXTRACT(MINUTE FROM a), + EXTRACT(SECOND FROM a), + EXTRACT(MICROSECOND FROM a), + CAST(a AS INTERVAL DAY_SECOND(6)), + a +FROM t1_time_in_decimal ORDER BY id; + +SELECT + TIME_TO_SEC(a), + CAST(a AS TIME(6)), + a +FROM t1_time_in_decimal ORDER BY id; + + +--echo # +--echo # Functions with a single DATE input, conversion from DATETIME-in-VARCHAR +--echo # + +SELECT QUARTER(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT MONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; + +SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; + +SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; +SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_varchar ORDER BY id; + + +CREATE TABLE t1 (a VARCHAR(32)); +INSERT INTO t1 VALUES +('2002-01-05 23:59:59'), +('2002-01-05 23:59:59.999999'), +('2002-01-05 23:59:59.9999999'); +SELECT YEARWEEK(a), a FROM t1; +SELECT WEEK(a), a FROM t1; +SELECT WEEKDAY(a), a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(32,9)); +INSERT INTO t1 VALUES +(20020105235959), +(20020105235959.999999), +(20020105235959.9999999); +SELECT YEARWEEK(a), a FROM t1; +SELECT WEEK(a), a FROM t1; +SELECT WEEKDAY(a), a FROM t1; +DROP TABLE t1; + +--echo # +--echo # Functions with a single DATE input, conversion from DATETIME-in-DECIMAL +--echo # + +SELECT QUARTER(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT MONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT YEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; + +SELECT DAYNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT MONTHNAME(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT YEARWEEK(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; + +SELECT LAST_DAY(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT TO_DAYS(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT DAYOFYEAR(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; +SELECT DAYOFMONTH(a), CAST(a AS DATE), a FROM t1_datetime_in_decimal ORDER BY id; + + +--echo # +--echo # Functions with a single DATETIME input, conversion from DATETIME-in-VARCHAR +--echo # + +SELECT TO_SECONDS(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; + +SET time_zone='+00:00'; +SELECT UNIX_TIMESTAMP(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; +SET time_zone=DEFAULT; + +SELECT CONVERT_TZ(a, '+00:00','+00:00'), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_varchar ORDER BY id; + + +--echo # +--echo # Functions with a single DATETIME input, conversion from DATETIME-in-DECIMAL +--echo # + +SELECT TO_SECONDS(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; + +SET time_zone='+00:00'; +SELECT UNIX_TIMESTAMP(a), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; +SET time_zone=DEFAULT; + +SELECT CONVERT_TZ(a, '+00:00','+00:00'), CAST(a AS DATETIME(6)), a FROM t1_datetime_in_decimal ORDER BY id; + +DROP TABLE t1_datetime_in_varchar; +DROP TABLE t1_datetime_in_decimal; +DROP TABLE t1_time_in_varchar; +DROP TABLE t1_time_in_decimal; + + +--echo # +--echo # Functions that construct DATETIME +--echo # + +SET time_zone='+00:00'; +CREATE TABLE t1_unix_timestamp (id SERIAL, a DECIMAL(30,10)); +INSERT INTO t1_unix_timestamp (a) VALUES +(980639999), +(980639999.9), +(980639999.999999), +(980639999.9999999), +(2147483647), +(2147483647.9), +(2147483647.999999), +(2147483647.9999999); +SELECT a, FROM_UNIXTIME(a) FROM t1_unix_timestamp ORDER BY id; +DROP TABLE t1_unix_timestamp; +SET time_zone=DEFAULT; + + +--echo # +--echo # Functions that construct TIME +--echo # + +CREATE TABLE t1_sec (id SERIAL, a DECIMAL(38,10)); +INSERT INTO t1_sec (a) VALUES +(59), +(59.9), +(59.999999), +(59.9999999), +(3020398), +(3020398.999999), +(3020398.9999999), +(3020399), +(3020399.999999), +(3020399.9999999), +(9223372036854775807), +(9223372036854775807.9), +(9223372036854775807.999999), +(9223372036854775807.9999999), +(18446744073709551615), +(18446744073709551615.9), +(18446744073709551615.999999), +(18446744073709551615.9999999); +SELECT a, SEC_TO_TIME(a) FROM t1_sec ORDER BY id; +DROP TABLE t1_sec; + + +CREATE TABLE t1_sec (id SERIAL, a DECIMAL(38,10)); +INSERT INTO t1_sec (a) VALUES +(0), +(0.9), +(0.999999), +(0.9999999); +SELECT a, MAKETIME(0, 0, a) FROM t1_sec ORDER BY id; +DROP TABLE t1_sec; + + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2017-12-31 23:59:59'), +('2017-12-31 23:59:59.9'), +('2017-12-31 23:59:59.999999'), +('2017-12-31 23:59:59.9999999'); +--vertical_results +SELECT + '----', + a, + DATE_FORMAT(a, '%Y') AS yyyy, + DATE_FORMAT(a, '%Y-%m-%d') AS d, + DATE_FORMAT(a, '%H:%i:%s') AS t0, + DATE_FORMAT(a, '%H:%i:%s.%f') AS t6, + DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s') AS dt0, + DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s.%f') AS dt6 +FROM t1; +--horizontal_results +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(32,9)); +INSERT INTO t1 VALUES +(20171231235959), +(20171231235959.9), +(20171231235959.999999), +(20171231235959.9999999); +--vertical_results +SELECT + '----', + a, + DATE_FORMAT(a, '%Y') AS yyyy, + DATE_FORMAT(a, '%Y-%m-%d') AS d, + DATE_FORMAT(a, '%H:%i:%s') AS t0, + DATE_FORMAT(a, '%H:%i:%s.%f') AS t6, + DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s') AS dt0, + DATE_FORMAT(a, '%Y-%m-%d %H:%i:%s.%f') AS dt6 +FROM t1; +--horizontal_results +DROP TABLE t1; + + +--echo # +--echo # Functions with two temporal parameters that round nanoseconds in both parameters in MySQL +--echo # + +CREATE TABLE t1 (a VARCHAR(64)); +CREATE TABLE t2 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2017-12-31 23:59:59'), +('2017-12-31 23:59:59.9'), +('2017-12-31 23:59:59.999999'), +('2017-12-31 23:59:59.9999999'); +INSERT INTO t2 VALUES +('00:00:00'), +('00:00:00.9'), +('00:00:00.999999'), +('00:00:00.9999999'); + +SELECT TIMESTAMP(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +SELECT ADDTIME(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; + +DROP TABLE t1, t2; + + +CREATE TABLE t1 (a VARCHAR(64)); +CREATE TABLE t2 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('23:59:59'), +('23:59:59.9'), +('23:59:59.999999'), +('23:59:59.9999999'); +INSERT INTO t2 VALUES +('00:00:00'), +('00:00:00.9'), +('00:00:00.999999'), +('00:00:00.9999999'); +SELECT TIMEDIFF(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +DROP TABLE t1, t2; + + +CREATE TABLE t1 (a VARCHAR(64)); +CREATE TABLE t2 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2001-12-31 23:59:59'), +('2001-12-31 23:59:59.9'), +('2001-12-31 23:59:59.999999'), +('2001-12-31 23:59:59.9999999'); +INSERT INTO t2 VALUES +('2001-12-31 23:59:59'), +('2001-12-31 23:59:59.9'), +('2001-12-31 23:59:59.999999'), +('2001-12-31 23:59:59.9999999'); +SELECT TIMESTAMPDIFF(MICROSECOND,t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a VARCHAR(64)); +CREATE TABLE t2 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('23:59:59'), +('23:59:59.9'), +('23:59:59.999999'), +('23:59:59.9999999'); +INSERT INTO t2 VALUES +('00:00:00'), +('00:00:00.9'), +('00:00:00.999999'), +('00:00:00.9999999'); +SELECT TIMEDIFF(t1.a, t2.a), t1.a, t2.a FROM t1,t2 ORDER BY t1.a, t2.a; +DROP TABLE t1, t2; + + +--echo # +--echo # STR_TO_DATE behaviour is questionable in MySQL 5.6 (MySQL Bug #92474) +--echo # + +--echo # It truncates nanoseconds, but this may change in the future. +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2017-12-31 23:59:59'), +('2017-12-31 23:59:59.9'), +('2017-12-31 23:59:59.999999'), +('2017-12-31 23:59:59.9999999'); + +SELECT + a, + STR_TO_DATE(a, '%Y-%m-%d %H:%i:%s') AS c0, + STR_TO_DATE(a, '%Y-%m-%d %H:%i:%s.%f') AS c6 +FROM t1; +DROP TABLE t1; + + +--echo # +--echo # DATE_ADD behaviour is questionable in MySQL 5.6 (MySQL Bug#92473) +--echo # It rounds nanoseconds in the first argument, but truncates nanoseconds in the second argument. +--echo # This may change in the future, to round both arguments. +--echo # + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES +('2017-12-31 23:59:59'), +('2017-12-31 23:59:59.9'), +('2017-12-31 23:59:59.999999'), +('2017-12-31 23:59:59.9999999'); +CREATE TABLE t2 (b DECIMAL(32,9)); +INSERT INTO t2 VALUES +(0), +(0.9), +(0.999999), +(0.9999999); +SELECT a, b, DATE_ADD(a, INTERVAL b SECOND) FROM t1,t2 ORDER BY a,b; +DROP TABLE t1, t2; diff --git a/mysql-test/main/gis-precise.result b/mysql-test/main/gis-precise.result index 7b553387fde..8382a94e358 100644 --- a/mysql-test/main/gis-precise.result +++ b/mysql-test/main/gis-precise.result @@ -504,6 +504,9 @@ GEOMETRYFROMTEXT('POINT(4599 60359)'), ) as relate_res; relate_res 0 +with cte1 as( select (st_symdifference(point(1,1),point(1,1))) as a1 ), cte2 as(select 1 as a2) select 1 from cte1 where cte1.a1 < '1'; +1 +1 DROP TABLE IF EXISTS p1; CREATE PROCEDURE p1(dist DOUBLE, geom TEXT) BEGIN diff --git a/mysql-test/main/gis-precise.test b/mysql-test/main/gis-precise.test index 07fabae6025..0bb445924b8 100644 --- a/mysql-test/main/gis-precise.test +++ b/mysql-test/main/gis-precise.test @@ -382,5 +382,9 @@ SELECT ST_RELATE( 'F*FFFF**F' ) as relate_res; +# MDEV- 16050 cte + geometry functions lead to crash. + +with cte1 as( select (st_symdifference(point(1,1),point(1,1))) as a1 ), cte2 as(select 1 as a2) select 1 from cte1 where cte1.a1 < '1'; + --source include/gis_debug.inc diff --git a/mysql-test/main/gis-rtree.result b/mysql-test/main/gis-rtree.result index 5d4708dd111..2ef8757339e 100644 --- a/mysql-test/main/gis-rtree.result +++ b/mysql-test/main/gis-rtree.result @@ -744,6 +744,7 @@ Table Op Msg_type Msg_text test.t1 check status OK analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK drop table t1; CREATE TABLE t1 ( diff --git a/mysql-test/main/gis.result b/mysql-test/main/gis.result index 886b1b5f6a8..7695cef15c5 100644 --- a/mysql-test/main/gis.result +++ b/mysql-test/main/gis.result @@ -1679,7 +1679,7 @@ NULL # create table t1 (pt point); insert into t1 values(Geomfromtext('POLYGON((1 1, 2 2, 2 1, 1 1))')); -ERROR 22007: Incorrect POINT value: 'POLYGON' for column 'pt' at row 1 +ERROR 22007: Incorrect POINT value: 'POLYGON' for column `test`.`t1`.`pt` at row 1 drop table t1; SELECT st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)); st_astext(ST_Buffer(ST_PolygonFromText('POLYGON((3 5, 2 4, 2 5, 3 5))'), -100)) @@ -1721,6 +1721,22 @@ c2 DROP TABLE t1; SET optimizer_switch=@save_optimizer_switch; # +# MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +# optimizer_use_condition_selectivity>=3 +# +CREATE TABLE t1 (a POINT); +INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3)); +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=3; +SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1'); +COUNT(*) +0 +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; +# # End 10.0 tests # SHOW CREATE TABLE information_schema.geometry_columns; diff --git a/mysql-test/main/gis.test b/mysql-test/main/gis.test index 97a655bf51e..c3d0fb43520 100644 --- a/mysql-test/main/gis.test +++ b/mysql-test/main/gis.test @@ -1481,6 +1481,21 @@ SELECT LENGTH(CONCAT(t2,'--',t2)) c2 FROM (SELECT ST_BUFFER(POINT(x,y), 0) t2 FR DROP TABLE t1; SET optimizer_switch=@save_optimizer_switch; +--echo # +--echo # MDEV-16995: ER_CANT_CREATE_GEOMETRY_OBJECT encountered for a query with +--echo # optimizer_use_condition_selectivity>=3 +--echo # + +CREATE TABLE t1 (a POINT); +INSERT INTO t1 VALUES (POINT(1,1)),(POINT(1,2)),(POINT(1,3)); +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=3; +SELECT COUNT(*) FROM t1 WHERE a IN ('test','test1'); +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +drop table t1; --echo # --echo # End 10.0 tests diff --git a/mysql-test/main/gis2.result b/mysql-test/main/gis2.result index c0b476e080b..cb919ecdeb1 100644 --- a/mysql-test/main/gis2.result +++ b/mysql-test/main/gis2.result @@ -27,12 +27,12 @@ drop table t1; create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); set timestamp=10; insert into t1 values(default); -ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1 +ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`t1`.`p` at row 1 drop table t1; SET timestamp=default; create table t1 (p point not null default if(unix_timestamp()>10,POINT(1,1),LineString(Point(0,0),Point(1,1)))); set timestamp=10; alter table t1 add column i int; -ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column 'p' at row 1 +ERROR 22007: Incorrect POINT value: 'GEOMETRYCOLLECTION' for column `test`.`(temporary)`.`p` at row 1 drop table t1; SET timestamp=default; diff --git a/mysql-test/main/grant.result b/mysql-test/main/grant.result index 4b639bf969c..46d87a4777f 100644 --- a/mysql-test/main/grant.result +++ b/mysql-test/main/grant.result @@ -2,6 +2,7 @@ set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; drop table if exists t1; drop database if exists mysqltest; connect master,localhost,root,,; @@ -58,7 +59,7 @@ max_questions 0 max_updates 0 max_connections 0 max_user_connections 0 -plugin +plugin mysql_native_password authentication_string password_expired N is_role N @@ -134,7 +135,7 @@ max_questions 10 max_updates 0 max_connections 0 max_user_connections 0 -plugin +plugin mysql_native_password authentication_string password_expired N is_role N @@ -186,7 +187,7 @@ max_questions 10 max_updates 20 max_connections 30 max_user_connections 0 -plugin +plugin mysql_native_password authentication_string password_expired N is_role N @@ -298,12 +299,7 @@ ERROR HY000: Incorrect usage of DB GRANT and GLOBAL PRIVILEGES select 1; 1 1 -insert into mysql.user (host, user) values ('localhost', 'test11'); -Warnings: -Warning 1364 Field 'ssl_cipher' doesn't have a default value -Warning 1364 Field 'x509_issuer' doesn't have a default value -Warning 1364 Field 'x509_subject' doesn't have a default value -Warning 1364 Field 'authentication_string' doesn't have a default value +insert into mysql.global_priv (host, user) values ('localhost', 'test11'); insert into mysql.db (host, db, user, select_priv) values ('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y'); alter table mysql.db order by db asc; @@ -842,9 +838,6 @@ drop database db27515; End of 4.1 tests use test; create table t1 (a int); -create table t2 as select * from mysql.user where user=''; -delete from mysql.user where user=''; -flush privileges; create user mysqltest_8@''; create user mysqltest_8@host8; create user mysqltest_8@''; @@ -854,7 +847,7 @@ ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'%' create user mysqltest_8@host8; ERROR HY000: Operation CREATE USER failed for 'mysqltest_8'@'host8' select user, QUOTE(host) from mysql.user where user="mysqltest_8"; -user QUOTE(host) +User QUOTE(host) mysqltest_8 '%' mysqltest_8 'host8' Schema privileges @@ -1044,9 +1037,6 @@ ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host '%' drop user mysqltest_8@host8; show grants for mysqltest_8@host8; ERROR 42000: There is no such grant defined for user 'mysqltest_8' on host 'host8' -insert into mysql.user select * from t2; -flush privileges; -drop table t2; drop table t1; connection master; CREATE DATABASE mysqltest3; @@ -1453,7 +1443,6 @@ CURRENT_USER() root@localhost SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); -update mysql.user set plugin=''; # Bug#57952 @@ -1925,7 +1914,7 @@ DROP DATABASE db2; grant usage on Foo.* to myuser@Localhost identified by 'foo'; grant select on Foo.* to myuser@localhost; select host,user from mysql.user where User='myuser'; -host user +Host User localhost myuser revoke select on Foo.* from myuser@localhost; delete from mysql.user where User='myuser'; @@ -2672,6 +2661,38 @@ disconnect conn2; disconnect conn3; DROP USER foo@'127.0.0.1'; # End of Bug#12766319 +create user foo@localhost; +create database foodb; +grant create routine on foodb.* to foo@localhost; +connect con1,localhost,foo; +create procedure fooproc() select 'i am fooproc'; +show grants; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost' +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'localhost' +disconnect con1; +connection default; +rename table mysql.procs_priv to mysql.procs_priv1; +flush privileges; +show grants for foo@localhost; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost' +rename table mysql.procs_priv1 to mysql.procs_priv; +show grants for foo@localhost; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost' +flush privileges; +show grants for foo@localhost; +Grants for foo@localhost +GRANT USAGE ON *.* TO 'foo'@'localhost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'localhost' +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'localhost' +drop user foo@localhost; +drop procedure fooproc; +drop database foodb; # # Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS # DATABASE SECURITY @@ -2701,7 +2722,7 @@ DROP USER untrusted@localhost; DROP DATABASE secret; set GLOBAL sql_mode=default; # -# Start of 10.2 tests +# End of 10.1 tests # # # MDEV-10134 Add full support for DEFAULT @@ -2730,3 +2751,24 @@ DROP USER dummy@localhost; # # End of 10.2 tests # +# +# MDEV-17932 : Assertion upon double RENAME USER +# +CREATE USER foo@localhost; +CREATE USER bar2@localhost; +RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost; +DROP USER bar2@localhost; +DROP USER bar3@localhost; +# +# MDEV-17946 : Unsorted acl_dbs after RENAME USER +# +CREATE USER foo; +GRANT SELECT ON test.* TO foo; +RENAME USER '' TO 'name'; +GRANT UPDATE ON test.* TO foo; +RENAME USER 'name' to ''; +DROP USER foo; +# +# End of 10.4 tests +# +update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/grant.test b/mysql-test/main/grant.test index c3bb987acc8..8ae64c9ad4d 100644 --- a/mysql-test/main/grant.test +++ b/mysql-test/main/grant.test @@ -10,6 +10,7 @@ set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET @old_log_bin_trust_function_creators= @@global.log_bin_trust_function_creators; SET GLOBAL log_bin_trust_function_creators = 1; +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; # Cleanup --disable_warnings @@ -131,7 +132,7 @@ select 1; # To test that the previous command didn't cause problems # # Bug#4898 User privileges depending on ORDER BY Settings of table db # -insert into mysql.user (host, user) values ('localhost', 'test11'); +insert into mysql.global_priv (host, user) values ('localhost', 'test11'); insert into mysql.db (host, db, user, select_priv) values ('localhost', 'a%', 'test11', 'Y'), ('localhost', 'ab%', 'test11', 'Y'); alter table mysql.db order by db asc; @@ -581,12 +582,6 @@ drop database db27515; use test; create table t1 (a int); -# Backup anonymous users and remove them. (They get in the way of -# the one we test with here otherwise.) -create table t2 as select * from mysql.user where user=''; -delete from mysql.user where user=''; -flush privileges; - # Create some users with different hostnames create user mysqltest_8@''; create user mysqltest_8@host8; @@ -700,10 +695,6 @@ drop user mysqltest_8@host8; --error ER_NONEXISTING_GRANT show grants for mysqltest_8@host8; -# Restore the anonymous users. -insert into mysql.user select * from t2; -flush privileges; -drop table t2; drop table t1; # @@ -1265,9 +1256,6 @@ SELECT CURRENT_USER(); SET PASSWORD FOR CURRENT_USER() = PASSWORD("admin"); SET PASSWORD FOR CURRENT_USER() = PASSWORD(""); -#cleanup after MDEV-16238 -update mysql.user set plugin=''; - # # Bug#57952: privilege change is not taken into account by EXECUTE. # @@ -2175,6 +2163,28 @@ DROP USER foo@'127.0.0.1'; --echo # End of Bug#12766319 +# +# Bug#27230925: HANDLE_FATAL_SIGNAL (SIG=11) IN SHOW_ROUTINE_GRANTS +# +create user foo@localhost; +create database foodb; +grant create routine on foodb.* to foo@localhost; +connect con1,localhost,foo; +create procedure fooproc() select 'i am fooproc'; +show grants; +disconnect con1; +connection default; +rename table mysql.procs_priv to mysql.procs_priv1; +flush privileges; +show grants for foo@localhost; +rename table mysql.procs_priv1 to mysql.procs_priv; +show grants for foo@localhost; +flush privileges; +show grants for foo@localhost; +drop user foo@localhost; +drop procedure fooproc; +drop database foodb; + --echo # --echo # Bug#11756966 - 48958: STORED PROCEDURES CAN BE LEVERAGED TO BYPASS @@ -2211,7 +2221,7 @@ set GLOBAL sql_mode=default; --source include/wait_until_count_sessions.inc --echo # ---echo # Start of 10.2 tests +--echo # End of 10.1 tests --echo # --echo # @@ -2236,3 +2246,28 @@ DROP USER dummy@localhost; --echo # --echo # End of 10.2 tests --echo # + +--echo # +--echo # MDEV-17932 : Assertion upon double RENAME USER +--echo # +CREATE USER foo@localhost; +CREATE USER bar2@localhost; +RENAME USER foo@localhost TO bar1@localhost, bar1@localhost TO bar3@localhost; +DROP USER bar2@localhost; +DROP USER bar3@localhost; + +--echo # +--echo # MDEV-17946 : Unsorted acl_dbs after RENAME USER +--echo # +CREATE USER foo; +GRANT SELECT ON test.* TO foo; +RENAME USER '' TO 'name'; +GRANT UPDATE ON test.* TO foo; +RENAME USER 'name' to ''; +DROP USER foo; + +--echo # +--echo # End of 10.4 tests +--echo # + +update mysql.global_priv set priv=@root_priv where user='root' and host='localhost'; diff --git a/mysql-test/main/grant2.result b/mysql-test/main/grant2.result index 632a9524b45..5d168a04455 100644 --- a/mysql-test/main/grant2.result +++ b/mysql-test/main/grant2.result @@ -1,3 +1,4 @@ +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET NAMES binary; @@ -181,19 +182,19 @@ grant select on *.* to 'mysqltest_2'; grant insert on test.* to 'mysqltest_2'; grant update on test.t1 to 'mysqltest_2'; grant update (c2) on test.t2 to 'mysqltest_2'; -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; -host user password -% mysqltest_1 -% mysqltest_2 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 -% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff -select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user; +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%'; +Host User Password plugin authentication_string +% mysqltest_1 mysql_native_password +% mysqltest_2 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 +% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff +select host,db,user from mysql.db where user like 'mysqltest_%'; host db user % test mysqltest_2 -select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name; +select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%'; host db user table_name % test mysqltest_2 t1 % test mysqltest_2 t2 -select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name; +select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%'; host db user table_name column_name % test mysqltest_2 t2 c2 show grants for 'mysqltest_1'; @@ -206,35 +207,35 @@ GRANT INSERT ON "test".* TO 'mysqltest_2'@'%' GRANT UPDATE (c2) ON "test"."t2" TO 'mysqltest_2'@'%' GRANT UPDATE ON "test"."t1" TO 'mysqltest_2'@'%' drop user 'mysqltest_1'; -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; -host user password -% mysqltest_2 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 -% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff -select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user; +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%'; +Host User Password plugin authentication_string +% mysqltest_2 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 +% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff +select host,db,user from mysql.db where user like 'mysqltest_%'; host db user % test mysqltest_2 -select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name; +select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%'; host db user table_name % test mysqltest_2 t1 % test mysqltest_2 t2 -select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name; +select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%'; host db user table_name column_name % test mysqltest_2 t2 c2 show grants for 'mysqltest_1'; ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%' rename user 'mysqltest_2' to 'mysqltest_1'; -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; -host user password -% mysqltest_1 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 -% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff -select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user; +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; +Host User Password plugin authentication_string +% mysqltest_1 *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 mysql_native_password *BD447CBA355AF58578D3AE33BA2E2CD388BA08D1 +% mysqltest_3 fffffffffffffffffffffffffffffffffffffffff mysql_native_password fffffffffffffffffffffffffffffffffffffffff +select host,db,user from mysql.db where user like 'mysqltest_%' ; host db user % test mysqltest_1 -select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name; +select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' ; host db user table_name % test mysqltest_1 t1 % test mysqltest_1 t2 -select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name; +select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' ; host db user table_name column_name % test mysqltest_1 t2 c2 show grants for 'mysqltest_1'; @@ -254,21 +255,21 @@ ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%' revoke all privileges, grant option from 'mysqltest_1'; ERROR HY000: Can't revoke all privileges for one or more of the requested users drop user 'mysqltest_1'; -select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,user; +select host,db,user from mysql.db where user = 'mysqltest_1' ; host db user insert into mysql.tables_priv set host='%', db='test', user='mysqltest_1', table_name='t1'; flush privileges; show grants for 'mysqltest_1'; ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%' drop user 'mysqltest_1'; -select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1' order by host,db,user,table_name; +select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1' ; host db user table_name insert into mysql.columns_priv set host='%', db='test', user='mysqltest_1', table_name='t1', column_name='c1'; flush privileges; show grants for 'mysqltest_1'; ERROR 42000: There is no such grant defined for user 'mysqltest_1' on host '%' drop user 'mysqltest_1'; -select host,db,user,table_name,column_name from mysql.columns_priv where user = 'mysqltest_1' order by host,db,user,table_name,column_name; +select host,db,user,table_name,column_name from mysql.columns_priv where user = 'mysqltest_1' ; host db user table_name column_name create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3'; drop user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3'; @@ -310,7 +311,7 @@ create user mysqltest_2@localhost; grant create user on *.* to mysqltest_2@localhost; connect user3,localhost,mysqltest_2,,; connection user3; -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; ERROR 42000: SELECT command denied to user 'mysqltest_2'@'localhost' for table 'user' create user mysqltest_A@'%'; rename user mysqltest_A@'%' to mysqltest_B@'%'; @@ -326,14 +327,9 @@ show grants; Grants for mysqltest_3@localhost GRANT USAGE ON *.* TO 'mysqltest_3'@'localhost' GRANT INSERT, UPDATE, DELETE ON `mysql`.* TO 'mysqltest_3'@'localhost' -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; ERROR 42000: SELECT command denied to user 'mysqltest_3'@'localhost' for table 'user' -insert into mysql.user set host='%', user='mysqltest_B'; -Warnings: -Warning 1364 Field 'ssl_cipher' doesn't have a default value -Warning 1364 Field 'x509_issuer' doesn't have a default value -Warning 1364 Field 'x509_subject' doesn't have a default value -Warning 1364 Field 'authentication_string' doesn't have a default value +insert into mysql.global_priv set host='%', user='mysqltest_B'; create user mysqltest_A@'%'; rename user mysqltest_B@'%' to mysqltest_C@'%'; drop user mysqltest_C@'%'; @@ -373,7 +369,7 @@ set password = password('changed'); disconnect b12302; connection default; select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1'; -host length(authentication_string) +Host length(authentication_string) 127.0.0.1 41 revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.1'; delete from mysql.user where user like 'mysqltest\_1'; @@ -388,7 +384,7 @@ set password = password('changed'); disconnect b12302_2; connection default; select host, length(authentication_string) from mysql.user where user like 'mysqltest\_1'; -host length(authentication_string) +Host length(authentication_string) 127.0.0.0/255.0.0.0 41 revoke all on mysqltest_1.* from mysqltest_1@'127.0.0.0/255.0.0.0'; delete from mysql.user where user like 'mysqltest\_1'; @@ -428,15 +424,10 @@ disconnect con2root; disconnect con3root; create database TESTDB; create table t2(a int); -create temporary table t1 as select * from mysql.user; -delete from mysql.user where host='localhost'; -INSERT INTO mysql.user (host, user, password) VALUES -('%','mysqltest_1',password('password')); -Warnings: -Warning 1364 Field 'ssl_cipher' doesn't have a default value -Warning 1364 Field 'x509_issuer' doesn't have a default value -Warning 1364 Field 'x509_subject' doesn't have a default value -Warning 1364 Field 'authentication_string' doesn't have a default value +create temporary table t1 as select * from mysql.global_priv; +delete from mysql.global_priv where host='localhost'; +INSERT INTO mysql.global_priv (host, user, priv) VALUES +('%','mysqltest_1',json_object('authentication_string', password('password'))); INSERT INTO mysql.db (host, db, user, select_priv) VALUES ('%','TESTDB','mysqltest_1','Y'); FLUSH PRIVILEGES; @@ -445,9 +436,9 @@ create database TEStdb; Got one of the listed errors connection default; disconnect con1; -delete from mysql.user; +delete from mysql.global_priv; delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB'; -insert into mysql.user select * from t1; +insert into mysql.global_priv select * from t1; drop table t1, t2; drop database TESTDB; flush privileges; @@ -555,29 +546,18 @@ End of 5.0 tests USE mysql; SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u; SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h; -SELECT password FROM user WHERE user=@u AND host=@h INTO @pwd; -Warnings: -Warning 1287 ' INTO FROM...' instead -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; -user host password insert_priv -root localhost Y -UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h; -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; -user host password insert_priv -root localhost N +SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; +User Host Password plugin authentication_string Insert_priv +root localhost Y GRANT INSERT ON *.* TO CURRENT_USER(); -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; -user host password insert_priv -root localhost Y -UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h; +SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; +User Host Password plugin authentication_string Insert_priv +root localhost mysql_native_password Y GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose'; -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; -user host password insert_priv -root localhost *0BB7188CF0DE9B403BA66E9DD810D82652D002EB Y -UPDATE user SET password=@pwd WHERE user=@u AND host=@h; -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; -user host password insert_priv -root localhost Y +SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; +User Host Password plugin authentication_string Insert_priv +root localhost *0BB7188CF0DE9B403BA66E9DD810D82652D002EB mysql_native_password *0BB7188CF0DE9B403BA66E9DD810D82652D002EB Y +UPDATE global_priv SET priv=@root_priv; FLUSH PRIVILEGES; USE test; End of 5.1 tests diff --git a/mysql-test/main/grant2.test b/mysql-test/main/grant2.test index 1f7450df6c1..b33d7d63992 100644 --- a/mysql-test/main/grant2.test +++ b/mysql-test/main/grant2.test @@ -4,7 +4,7 @@ # Save the initial number of concurrent sessions --source include/count_sessions.inc - +select priv into @root_priv from mysql.global_priv where user='root' and host='localhost'; set GLOBAL sql_mode=""; set LOCAL sql_mode=""; SET NAMES binary; @@ -231,28 +231,40 @@ grant select on *.* to 'mysqltest_2'; grant insert on test.* to 'mysqltest_2'; grant update on test.t1 to 'mysqltest_2'; grant update (c2) on test.t2 to 'mysqltest_2'; -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; -select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user; -select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name; -select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name; +--sorted_result +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%'; +--sorted_result +select host,db,user from mysql.db where user like 'mysqltest_%'; +--sorted_result +select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%'; +--sorted_result +select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%'; show grants for 'mysqltest_1'; show grants for 'mysqltest_2'; # # Drop drop user 'mysqltest_1'; -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; -select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user; -select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name; -select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name; +--sorted_result +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%'; +--sorted_result +select host,db,user from mysql.db where user like 'mysqltest_%'; +--sorted_result +select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%'; +--sorted_result +select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%'; --error ER_NONEXISTING_GRANT show grants for 'mysqltest_1'; # # Rename rename user 'mysqltest_2' to 'mysqltest_1'; -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; -select host,db,user from mysql.db where user like 'mysqltest_%' order by host,db,user; -select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' order by host,db,user,table_name; -select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' order by host,db,user,table_name,column_name; +--sorted_result +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; +--sorted_result +select host,db,user from mysql.db where user like 'mysqltest_%' ; +--sorted_result +select host,db,user,table_name from mysql.tables_priv where user like 'mysqltest_%' ; +--sorted_result +select host,db,user,table_name,column_name from mysql.columns_priv where user like 'mysqltest_%' ; show grants for 'mysqltest_1'; drop user 'mysqltest_1', 'mysqltest_3'; --error ER_CANNOT_USER @@ -269,7 +281,8 @@ show grants for 'mysqltest_1'; --error ER_REVOKE_GRANTS revoke all privileges, grant option from 'mysqltest_1'; drop user 'mysqltest_1'; -select host,db,user from mysql.db where user = 'mysqltest_1' order by host,db,user; +--sorted_result +select host,db,user from mysql.db where user = 'mysqltest_1' ; # # Add a stray record insert into mysql.tables_priv set host='%', db='test', user='mysqltest_1', table_name='t1'; @@ -277,7 +290,8 @@ flush privileges; --error ER_NONEXISTING_GRANT show grants for 'mysqltest_1'; drop user 'mysqltest_1'; -select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1' order by host,db,user,table_name; +--sorted_result +select host,db,user,table_name from mysql.tables_priv where user = 'mysqltest_1' ; # # Add a stray record insert into mysql.columns_priv set host='%', db='test', user='mysqltest_1', table_name='t1', column_name='c1'; @@ -285,7 +299,8 @@ flush privileges; --error ER_NONEXISTING_GRANT show grants for 'mysqltest_1'; drop user 'mysqltest_1'; -select host,db,user,table_name,column_name from mysql.columns_priv where user = 'mysqltest_1' order by host,db,user,table_name,column_name; +--sorted_result +select host,db,user,table_name,column_name from mysql.columns_priv where user = 'mysqltest_1' ; # # Handle multi user lists create user 'mysqltest_1', 'mysqltest_2', 'mysqltest_3'; @@ -330,7 +345,7 @@ grant create user on *.* to mysqltest_2@localhost; connect (user3,localhost,mysqltest_2,,); connection user3; --error ER_TABLEACCESS_DENIED_ERROR -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; create user mysqltest_A@'%'; rename user mysqltest_A@'%' to mysqltest_B@'%'; drop user mysqltest_B@'%'; @@ -345,8 +360,8 @@ connect (user4,localhost,mysqltest_3,,); connection user4; show grants; --error ER_TABLEACCESS_DENIED_ERROR -select host,user,password from mysql.user where user like 'mysqltest_%' order by host,user,password; -insert into mysql.user set host='%', user='mysqltest_B'; +select host,user,password,plugin,authentication_string from mysql.user where user like 'mysqltest_%' ; +insert into mysql.global_priv set host='%', user='mysqltest_B'; create user mysqltest_A@'%'; rename user mysqltest_B@'%' to mysqltest_C@'%'; drop user mysqltest_C@'%'; @@ -466,10 +481,10 @@ disconnect con3root; create database TESTDB; create table t2(a int); -create temporary table t1 as select * from mysql.user; -delete from mysql.user where host='localhost'; -INSERT INTO mysql.user (host, user, password) VALUES -('%','mysqltest_1',password('password')); +create temporary table t1 as select * from mysql.global_priv; +delete from mysql.global_priv where host='localhost'; +INSERT INTO mysql.global_priv (host, user, priv) VALUES +('%','mysqltest_1',json_object('authentication_string', password('password'))); INSERT INTO mysql.db (host, db, user, select_priv) VALUES ('%','TESTDB','mysqltest_1','Y'); FLUSH PRIVILEGES; @@ -485,9 +500,9 @@ create database TEStdb; # Clean-up connection default; disconnect con1; -delete from mysql.user; +delete from mysql.global_priv; delete from mysql.db where host='%' and user='mysqltest_1' and db='TESTDB'; -insert into mysql.user select * from t1; +insert into mysql.global_priv select * from t1; drop table t1, t2; drop database TESTDB; flush privileges; @@ -642,27 +657,19 @@ DROP DATABASE db1; USE mysql; SELECT LEFT(CURRENT_USER(),INSTR(CURRENT_USER(),'@')-1) INTO @u; SELECT MID(CURRENT_USER(),INSTR(CURRENT_USER(),'@')+1) INTO @h; -SELECT password FROM user WHERE user=@u AND host=@h INTO @pwd; # show current privs. -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; - -# toggle INSERT -UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h; -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; +SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; # show that GRANT ... TO CURRENT_USER() no longer crashes GRANT INSERT ON *.* TO CURRENT_USER(); -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; -UPDATE user SET insert_priv='N' WHERE user=@u AND host=@h; +SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; # show that GRANT ... TO CURRENT_USER() IDENTIFIED BY ... works now GRANT INSERT ON *.* TO CURRENT_USER() IDENTIFIED BY 'keksdose'; -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; - -UPDATE user SET password=@pwd WHERE user=@u AND host=@h; -SELECT user,host,password,insert_priv FROM user WHERE user=@u AND host=@h; +SELECT user,host,password,plugin,authentication_string,insert_priv FROM user WHERE user=@u AND host=@h; +UPDATE global_priv SET priv=@root_priv; FLUSH PRIVILEGES; USE test; diff --git a/mysql-test/main/grant3.result b/mysql-test/main/grant3.result index 4c99fb02f19..1bc6e7572c5 100644 --- a/mysql-test/main/grant3.result +++ b/mysql-test/main/grant3.result @@ -29,7 +29,7 @@ grant select on test.* to CUser@localhost; grant select on test.* to CUser@LOCALHOST; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2; user host db select_priv @@ -37,14 +37,14 @@ CUser localhost test Y REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2; user host db select_priv REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser' order by 1,2; user host db select_priv @@ -56,7 +56,7 @@ grant select on test.t1 to CUser@localhost; grant select on test.t1 to CUser@LOCALHOST; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv @@ -64,14 +64,14 @@ CUser localhost test t1 Select REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv @@ -82,7 +82,7 @@ grant select(a) on test.t1 to CUser@localhost; grant select(a) on test.t1 to CUser@LOCALHOST; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv @@ -90,14 +90,14 @@ CUser localhost test t1 Select REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'LOCALHOST'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv REVOKE ALL PRIVILEGES, GRANT OPTION FROM 'CUser'@'localhost'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser' order by 1,2; -user host +User Host CUser localhost SELECT user, host, db, Table_name, Table_priv, Column_priv FROM mysql.tables_priv where user = 'CUser' order by 1,2; user host db Table_name Table_priv Column_priv @@ -109,7 +109,7 @@ grant select on test.* to CUser2@localhost; grant select on test.* to CUser2@LOCALHOST; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2; -user host +User Host CUser2 localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2; user host db select_priv @@ -117,7 +117,7 @@ CUser2 localhost test Y REVOKE SELECT ON test.* FROM 'CUser2'@'LOCALHOST'; flush privileges; SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2; -user host +User Host CUser2 localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2; user host db select_priv @@ -125,7 +125,7 @@ REVOKE SELECT ON test.* FROM 'CUser2'@'localhost'; ERROR 42000: There is no such grant defined for user 'CUser2' on host 'localhost' flush privileges; SELECT user, host FROM mysql.user where user = 'CUser2' order by 1,2; -user host +User Host CUser2 localhost SELECT user, host, db, select_priv FROM mysql.db where user = 'CUser2' order by 1,2; user host db select_priv diff --git a/mysql-test/main/grant4.result b/mysql-test/main/grant4.result index c3db2e03e3e..9aad70205ec 100644 --- a/mysql-test/main/grant4.result +++ b/mysql-test/main/grant4.result @@ -198,15 +198,15 @@ grant select on test.* to foo6 identified by password '2222222222222222'; grant select on test.* to foo7 identified via mysql_native_password using '11111111111111111111111111111111111111111'; grant select on test.* to foo8 identified via mysql_old_password using '2222222222222222'; select user,password,plugin,authentication_string from mysql.user where user like 'foo%'; -user password plugin authentication_string -foo1 11111111111111111111111111111111111111111 -foo2 2222222222222222 -foo3 11111111111111111111111111111111111111111 -foo4 2222222222222222 -foo5 11111111111111111111111111111111111111111 -foo6 2222222222222222 -foo7 11111111111111111111111111111111111111111 -foo8 2222222222222222 +User Password plugin authentication_string +foo1 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111 +foo2 2222222222222222 mysql_old_password 2222222222222222 +foo3 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111 +foo4 2222222222222222 mysql_old_password 2222222222222222 +foo5 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111 +foo6 2222222222222222 mysql_old_password 2222222222222222 +foo7 11111111111111111111111111111111111111111 mysql_native_password 11111111111111111111111111111111111111111 +foo8 2222222222222222 mysql_old_password 2222222222222222 drop user foo1; drop user foo2; drop user foo3; diff --git a/mysql-test/main/grant5.result b/mysql-test/main/grant5.result index 24abc61a348..c35e8201582 100644 --- a/mysql-test/main/grant5.result +++ b/mysql-test/main/grant5.result @@ -18,3 +18,87 @@ ERROR 42000: Access denied for user 'test'@'%' to database 'mysql' connection default; drop user test, foo; drop role foo; +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +REVOKE EXECUTE ON PROCEDURE sp FROM u; +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 user u1@h identified with 'mysql_native_password' using 'pwd'; +ERROR HY000: Password hash should be a 41-digit hexadecimal number +create user u1@h identified with 'mysql_native_password' using password('pwd'); +create user u2@h identified with 'mysql_native_password' using '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD'; +create user u3@h identified with 'mysql_native_password'; +set password for u3@h = 'pwd'; +ERROR HY000: Password hash should be a 41-digit hexadecimal number +set password for u3@h = password('pwd'); +create user u4@h identified with 'mysql_native_password'; +set password for u4@h = '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD'; +create user u5@h identified with 'mysql_old_password' using 'pwd'; +ERROR HY000: Password hash should be a 16-digit hexadecimal number +create user u5@h identified with 'mysql_old_password' using password('pwd'); +create user u6@h identified with 'mysql_old_password' using '78a302dd267f6044'; +create user u7@h identified with 'mysql_old_password'; +set password for u7@h = 'pwd'; +ERROR HY000: Password hash should be a 41-digit hexadecimal number +set password for u7@h = old_password('pwd'); +create user u8@h identified with 'mysql_old_password'; +set password for u8@h = '78a302dd267f6044'; +select user,host,plugin,authentication_string from mysql.user where host='h'; +User Host plugin authentication_string +u1 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u2 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u3 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u4 h mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u5 h mysql_old_password 78a302dd267f6044 +u6 h mysql_old_password 78a302dd267f6044 +u7 h mysql_old_password 78a302dd267f6044 +u8 h mysql_old_password 78a302dd267f6044 +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u1'; +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u5'; +update mysql.global_priv set priv=json_set(priv, '$.plugin', 'nonexistent') where user='u8'; +flush privileges; +show create user u1@h; +CREATE USER for u1@h +CREATE USER 'u1'@'h' IDENTIFIED BY PASSWORD 'bad' +show create user u2@h; +CREATE USER for u2@h +CREATE USER 'u2'@'h' IDENTIFIED BY PASSWORD '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD' +show create user u3@h; +CREATE USER for u3@h +CREATE USER 'u3'@'h' IDENTIFIED BY PASSWORD '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD' +show create user u4@h; +CREATE USER for u4@h +CREATE USER 'u4'@'h' IDENTIFIED BY PASSWORD '*975B2CD4FF9AE554FE8AD33168FBFC326D2021DD' +show create user u5@h; +CREATE USER for u5@h +CREATE USER 'u5'@'h' IDENTIFIED BY PASSWORD 'bad' +show create user u6@h; +CREATE USER for u6@h +CREATE USER 'u6'@'h' IDENTIFIED BY PASSWORD '78a302dd267f6044' +show create user u7@h; +CREATE USER for u7@h +CREATE USER 'u7'@'h' IDENTIFIED BY PASSWORD '78a302dd267f6044' +show create user u8@h; +CREATE USER for u8@h +CREATE USER 'u8'@'h' IDENTIFIED VIA nonexistent USING '78a302dd267f6044' +grant select on *.* to u1@h; +grant select on *.* to u2@h; +grant select on *.* to u3@h; +grant select on *.* to u4@h; +grant select on *.* to u5@h; +grant select on *.* to u6@h; +grant select on *.* to u7@h; +grant select on *.* to u8@h; +select user,select_priv,plugin,authentication_string from mysql.user where user like 'u_'; +User Select_priv plugin authentication_string +u1 Y mysql_native_password bad +u2 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u3 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u4 Y mysql_native_password *975B2CD4FF9AE554FE8AD33168FBFC326D2021DD +u5 Y mysql_old_password bad +u6 Y mysql_old_password 78a302dd267f6044 +u7 Y mysql_old_password 78a302dd267f6044 +u8 Y nonexistent 78a302dd267f6044 +drop user u1@h, u2@h, u3@h, u4@h, u5@h, u6@h, u7@h, u8@h; diff --git a/mysql-test/main/grant5.test b/mysql-test/main/grant5.test index 14f2fd65020..cc673754461 100644 --- a/mysql-test/main/grant5.test +++ b/mysql-test/main/grant5.test @@ -23,3 +23,66 @@ show grants for foo@'%'; # user drop user test, foo; drop role foo; +# +# MDEV-17975 Assertion `! is_set()' or `!is_set() || (m_status == DA_OK_BULK && is_bulk_op())' failed upon REVOKE under LOCK TABLE +# +CREATE TABLE t1 (a INT); +LOCK TABLE t1 WRITE; +--error ER_TABLE_NOT_LOCKED +REVOKE EXECUTE ON PROCEDURE sp FROM u; +--error ER_TABLE_NOT_LOCKED +REVOKE PROCESS ON *.* FROM u; +DROP TABLE t1; + +# +# MDEV-12321 authentication plugin: SET PASSWORD support +# +error ER_PASSWD_LENGTH; +create user u1@h identified with 'mysql_native_password' using 'pwd'; +create user u1@h identified with 'mysql_native_password' using password('pwd'); +let p=`select password('pwd')`; +eval create user u2@h identified with 'mysql_native_password' using '$p'; +create user u3@h identified with 'mysql_native_password'; +error ER_PASSWD_LENGTH; +set password for u3@h = 'pwd'; +set password for u3@h = password('pwd'); +create user u4@h identified with 'mysql_native_password'; +eval set password for u4@h = '$p'; +error ER_PASSWD_LENGTH; +create user u5@h identified with 'mysql_old_password' using 'pwd'; +create user u5@h identified with 'mysql_old_password' using password('pwd'); +let p=`select old_password('pwd')`; +eval create user u6@h identified with 'mysql_old_password' using '$p'; +create user u7@h identified with 'mysql_old_password'; +error ER_PASSWD_LENGTH; +set password for u7@h = 'pwd'; +set password for u7@h = old_password('pwd'); +create user u8@h identified with 'mysql_old_password'; +eval set password for u8@h = '$p'; +sorted_result; +select user,host,plugin,authentication_string from mysql.user where host='h'; +# test with invalid entries +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u1'; +update mysql.global_priv set priv=json_set(priv, '$.authentication_string', 'bad') where user='u5'; +update mysql.global_priv set priv=json_set(priv, '$.plugin', 'nonexistent') where user='u8'; +flush privileges; +show create user u1@h; +show create user u2@h; +show create user u3@h; +show create user u4@h; +show create user u5@h; +show create user u6@h; +show create user u7@h; +show create user u8@h; +grant select on *.* to u1@h; +grant select on *.* to u2@h; +grant select on *.* to u3@h; +grant select on *.* to u4@h; +grant select on *.* to u5@h; +grant select on *.* to u6@h; +grant select on *.* to u7@h; +grant select on *.* to u8@h; +select user,select_priv,plugin,authentication_string from mysql.user where user like 'u_'; + +# but they still can be dropped +drop user u1@h, u2@h, u3@h, u4@h, u5@h, u6@h, u7@h, u8@h; diff --git a/mysql-test/main/grant_4332.result b/mysql-test/main/grant_4332.result index b62ca1a20cc..af6b23088f5 100644 --- a/mysql-test/main/grant_4332.result +++ b/mysql-test/main/grant_4332.result @@ -1,5 +1,5 @@ -set GLOBAL sql_mode=""; -set LOCAL sql_mode=""; +set global sql_mode=""; +set local sql_mode=""; alter table mysql.user modify User char(16) binary not null default ''; alter table mysql.db modify User char(16) binary not null default ''; alter table mysql.tables_priv modify User char(16) binary not null default ''; @@ -32,4 +32,4 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def user() 253 141 14 N 1 39 8 user() root@localhost -set GLOBAL sql_mode=default; +set global sql_mode=default; diff --git a/mysql-test/main/grant_4332.test b/mysql-test/main/grant_4332.test index 41e0b822f98..f723e4afe44 100644 --- a/mysql-test/main/grant_4332.test +++ b/mysql-test/main/grant_4332.test @@ -6,8 +6,9 @@ # --source include/not_embedded.inc -set GLOBAL sql_mode=""; -set LOCAL sql_mode=""; +--source include/switch_to_mysql_user.inc +set global sql_mode=""; +set local sql_mode=""; alter table mysql.user modify User char(16) binary not null default ''; alter table mysql.db modify User char(16) binary not null default ''; @@ -42,4 +43,5 @@ flush privileges; select user(); --disable_metadata -set GLOBAL sql_mode=default; +set global sql_mode=default; +--source include/switch_to_mysql_global_priv.inc diff --git a/mysql-test/main/group_by.result b/mysql-test/main/group_by.result index 6f1887290c0..f28068cc29a 100644 --- a/mysql-test/main/group_by.result +++ b/mysql-test/main/group_by.result @@ -536,17 +536,17 @@ a b select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL; a b 1 3 +1 1 3 1 2 2 -1 1 explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary; Using filesort -1 SIMPLE t2 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 ALL a NULL NULL NULL 4 Using temporary; Using filesort +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) explain select t1.a,t2.b from t1,t2 where t1.a=t2.a group by t1.a,t2.b ORDER BY NULL; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using temporary -1 SIMPLE t2 ALL a NULL NULL NULL 4 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 ALL a NULL NULL NULL 4 Using temporary +1 SIMPLE t1 ALL NULL NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) drop table t1,t2; create table t1 (a int, b int); insert into t1 values (1, 4),(10, 40),(1, 4),(10, 43),(1, 4),(10, 41),(1, 4),(10, 43),(1, 4); @@ -1330,6 +1330,7 @@ INSERT INTO t1 SELECT a + 64,b FROM t1; INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT a FROM t1 WHERE a < 2; id select_type table type possible_keys key key_len ref rows Extra @@ -2749,6 +2750,7 @@ create table t2 (c int, col1 int, key(c)); insert into t2 select t1.a, 100000 from t1; analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date explain select @@ -2832,6 +2834,16 @@ select distinct 1 from t1 group by a,b with rollup limit 1; 1 1 drop table t1; +CREATE TABLE t1 ( pk int, i1 int, v1 varchar(1)); +explain +SELECT 1 FROM t1 +GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +SELECT 1 FROM t1 +GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ; +1 +drop table t1; # # MDEV-16170 # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP diff --git a/mysql-test/main/group_by.test b/mysql-test/main/group_by.test index 5574a6654cf..c8b28828369 100644 --- a/mysql-test/main/group_by.test +++ b/mysql-test/main/group_by.test @@ -1948,6 +1948,19 @@ insert into t1 values(-126,7),(1,1),(0,0),(-1,1),(351,65534); select distinct 1 from t1 group by a,b with rollup limit 1; drop table t1; +# +# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free +# or Invalid write in JOIN::make_aggr_tables_info +# + +CREATE TABLE t1 ( pk int, i1 int, v1 varchar(1)); +explain +SELECT 1 FROM t1 +GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ; +SELECT 1 FROM t1 +GROUP BY REPEAT((BINARY pk), v1), AES_DECRYPT((@A := i1), 20852) WITH ROLLUP HAVING LOAD_FILE('a') ; +drop table t1; + --echo # --echo # MDEV-16170 --echo # Server crashes in Item_null_result::type_handler on SELECT with ROLLUP diff --git a/mysql-test/main/group_by_innodb.result b/mysql-test/main/group_by_innodb.result index 034866b63d5..f935d4da45b 100644 --- a/mysql-test/main/group_by_innodb.result +++ b/mysql-test/main/group_by_innodb.result @@ -151,6 +151,7 @@ KEY idx3 (a, b) INSERT INTO t1 (a, b) SELECT t01.a, t02.a FROM t0 t01, t0 t02; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT DISTINCT a, MAX(b) FROM t1 WHERE a >= 0 GROUP BY a,a; id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/main/group_min_max.result b/mysql-test/main/group_min_max.result index b3b660c4170..a8e0762a823 100644 --- a/mysql-test/main/group_min_max.result +++ b/mysql-test/main/group_min_max.result @@ -40,6 +40,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c); create index idx_t1_2 on t1 (a1,a2,b); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date drop table if exists t2; create table t2 ( @@ -68,6 +69,7 @@ create index idx_t2_1 on t2 (a1,a2,b,c); create index idx_t2_2 on t2 (a1,a2,b); analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date drop table if exists t3; create table t3 ( @@ -130,6 +132,7 @@ create index idx_t3_1 on t3 (a1,a2,b,c); create index idx_t3_2 on t3 (a1,a2,b); analyze table t3; Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date explain select a1, min(a2) from t1 group by a1; id select_type table type possible_keys key key_len ref rows Extra @@ -684,10 +687,10 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL idx_t1_1 147 NULL 9 Using where; Using index for group-by explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by +1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by explain select a1,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') group by a1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by +1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by explain select a1,a2,b, max(c) from t2 where (b = 'b') group by a1,a2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range NULL idx_t2_1 146 NULL 10 Using where; Using index for group-by @@ -804,10 +807,10 @@ b h212 e212 c h312 e312 explain select a1,a2,b,min(c) from t2 where (a2 = 'a') and b is NULL group by a1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 163 NULL 5 Using where; Using index for group-by +1 SIMPLE t2 range NULL idx_t2_1 163 NULL 6 Using where; Using index for group-by explain select a1,a2,b,max(c) from t2 where (a2 = 'a') and b is NULL group by a1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 range NULL idx_t2_1 146 NULL 5 Using where; Using index for group-by +1 SIMPLE t2 range NULL idx_t2_1 146 NULL 6 Using where; Using index for group-by explain select a1,a2,b,min(c) from t2 where b is NULL group by a1,a2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range NULL idx_t2_1 163 NULL 10 Using where; Using index for group-by @@ -1662,7 +1665,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain select a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx_t2_1 163 NULL # Using where; Using index +1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by @@ -1713,7 +1716,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 range NULL idx_t1_1 147 NULL 17 Using where; Using index for group-by explain extended select distinct a1,a2,b,c from t1 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 50.78 Using where; Using index +1 SIMPLE t1 index NULL idx_t1_1 163 NULL 128 0.39 Using where; Using index Warnings: Note 1003 select distinct `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where `test`.`t1`.`b` = 'a' and `test`.`t1`.`c` = 'i121' and `test`.`t1`.`a2` >= 'b' explain select distinct a1,a2,b from t1 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); @@ -1730,7 +1733,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain extended select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121'); id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 50.61 Using where; Using index +1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 0.28 Using where; Using index Warnings: Note 1003 select distinct `test`.`t2`.`a1` AS `a1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where `test`.`t2`.`b` = 'a' and `test`.`t2`.`c` = 'i121' and `test`.`t2`.`a2` >= 'b' explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c'); @@ -1876,7 +1879,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range NULL idx_t2_1 146 NULL # Using where; Using index for group-by explain select distinct a1,a2,b,c from t2 where (a2 >= 'b') and (b = 'a') and (c = 'i121') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 index NULL idx_t2_1 163 NULL # Using where; Using index +1 SIMPLE t2 range NULL idx_t2_1 163 NULL # Using where; Using index for group-by explain select distinct a1,a2,b from t2 where (a1 > 'a') and (a2 > 'a') and (b = 'c') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 range idx_t2_0,idx_t2_1,idx_t2_2 idx_t2_1 146 NULL # Using where; Using index for group-by @@ -2075,19 +2078,19 @@ id select_type table type possible_keys key key_len ref rows Extra explain extended select a1,a2,min(b),max(b) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index +1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,min(`test`.`t1`.`b`) AS `min(b)`,max(`test`.`t1`.`b`) AS `max(b)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2` explain extended select a1,a2,b,min(c),max(c) from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort +1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 39.58 Using where; Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,min(`test`.`t1`.`c`) AS `min(c)`,max(`test`.`t1`.`c`) AS `max(c)` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain extended select a1,a2,b,c from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (d > 'xy2') group by a1,a2,b,c; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 50.78 Using where; Using temporary; Using filesort +1 SIMPLE t1 ALL idx_t1_0,idx_t1_1,idx_t1_2 NULL NULL NULL 128 39.58 Using where; Using temporary; Using filesort Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`d` > 'xy2' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b`,`test`.`t1`.`c` explain select a1,a2,b,max(c),min(c) from t2 where (a2 = 'a') and (b = 'b') or (b < 'b') group by a1; @@ -2095,7 +2098,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t2 index NULL idx_t2_1 163 NULL 164 Using where; Using index explain extended select a1,a2,b from t1 where (a1 = 'b' or a1 = 'd' or a1 = 'a' or a1 = 'c') and (a2 > 'a') and (c > 'a111') group by a1,a2,b; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 85.53 Using where; Using index +1 SIMPLE t1 range idx_t1_0,idx_t1_1,idx_t1_2 idx_t1_1 130 NULL 76 100.00 Using where; Using index Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t1`.`b` AS `b` from `test`.`t1` where (`test`.`t1`.`a1` = 'b' or `test`.`t1`.`a1` = 'd' or `test`.`t1`.`a1` = 'a' or `test`.`t1`.`a1` = 'c') and `test`.`t1`.`a2` > 'a' and `test`.`t1`.`c` > 'a111' group by `test`.`t1`.`a1`,`test`.`t1`.`a2`,`test`.`t1`.`b` explain select a1,a2,min(b),c from t2 where (a2 = 'a') and (c = 'a111') group by a1; @@ -2464,7 +2467,7 @@ FLUSH STATUS; INSERT INTO t3 SELECT a,MAX(b) FROM t1 GROUP BY a; SHOW STATUS LIKE 'handler_read__e%'; Variable_name Value -Handler_read_key 8 +Handler_read_key 13 Handler_read_next 0 Handler_read_retry 0 DELETE FROM t3; @@ -2634,7 +2637,7 @@ a b 3 13 explain extended select sql_buffer_result a, max(b)+1 from t1 where a = 0 group by a; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE t1 ref a,index a 5 const 15 100.00 Using index; Using temporary +1 SIMPLE t1 ref a,index a 5 const 15 20.00 Using index; Using temporary Warnings: Note 1003 select sql_buffer_result `test`.`t1`.`a` AS `a`,max(`test`.`t1`.`b`) + 1 AS `max(b)+1` from `test`.`t1` where `test`.`t1`.`a` = 0 group by `test`.`t1`.`a` drop table t1; @@ -2719,6 +2722,7 @@ CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL, KEY (b)); INSERT INTO t1 VALUES(1,1),(2,1); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SELECT 1 AS c, b FROM t1 WHERE b IN (1,2) GROUP BY c, b; c b @@ -3609,6 +3613,7 @@ CREATE TABLE t (a INT, b INT, KEY(a,b)); INSERT INTO t VALUES (1,1), (2,2), (3,3), (4,4), (1,0), (3,2), (4,5); ANALYZE TABLE t; Table Op Msg_type Msg_text +test.t analyze status Engine-independent statistics collected test.t analyze status OK SELECT a, SUM(DISTINCT a), MIN(b) FROM t GROUP BY a; a SUM(DISTINCT a) MIN(b) @@ -3733,6 +3738,34 @@ id MIN(a) MAX(a) 4 2001-01-04 2001-01-04 DROP TABLE t1; # +# MDEV-17039: Query plan changes when we use GROUP BY optimization with optimizer_use_condition_selectivity=4 +# and use_stat_tables= PREFERABLY +# +CREATE TABLE t1 (a INT, b INT,c INT DEFAULT 0, INDEX (a,b)); +INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5), +(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @save_use_stat_tables= @@use_stat_tables; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables=PREFERABLY; +explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 8 100.00 +1 PRIMARY t1_outer ref a a 5 .max(b) 2 100.00 Using index +2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by +Warnings: +Note 1003 /* select#1 */ select `test`.`t1_outer`.`a` AS `a` from (/* select#2 */ select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = ``.`max(b)` +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set @@use_stat_tables=@save_use_stat_tables; +explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 PRIMARY ALL distinct_key NULL NULL NULL 8 100.00 +1 PRIMARY t1_outer ref a a 5 .max(b) 2 100.00 Using index +2 MATERIALIZED t1 range NULL a 5 NULL 8 100.00 Using index for group-by +Warnings: +Note 1003 /* select#1 */ select `test`.`t1_outer`.`a` AS `a` from (/* select#2 */ select max(`test`.`t1`.`b`) from `test`.`t1` group by `test`.`t1`.`a`) join `test`.`t1` `t1_outer` where `test`.`t1_outer`.`a` = ``.`max(b)` +drop table t1; +# # End of 10.0 tests # # diff --git a/mysql-test/main/group_min_max.test b/mysql-test/main/group_min_max.test index adad9073235..e8245dd2898 100644 --- a/mysql-test/main/group_min_max.test +++ b/mysql-test/main/group_min_max.test @@ -1519,6 +1519,23 @@ ALTER TABLE t1 ADD KEY(id,a); SELECT id,MIN(a),MAX(a) FROM t1 WHERE a>=DATE'2001-01-04' GROUP BY id; DROP TABLE t1; +--echo # +--echo # MDEV-17039: Query plan changes when we use GROUP BY optimization with optimizer_use_condition_selectivity=4 +--echo # and use_stat_tables= PREFERABLY +--echo # + +CREATE TABLE t1 (a INT, b INT,c INT DEFAULT 0, INDEX (a,b)); +INSERT INTO t1 (a, b) VALUES (1,1), (1,2), (1,3), (1,4), (1,5), +(2,2), (2,3), (2,1), (3,1), (4,1), (4,2), (4,3), (4,4), (4,5), (4,6); +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @save_use_stat_tables= @@use_stat_tables; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables=PREFERABLY; +explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a); +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +set @@use_stat_tables=@save_use_stat_tables; +explain extended SELECT a FROM t1 AS t1_outer WHERE a IN (SELECT max(b) FROM t1 GROUP BY a); +drop table t1; --echo # --echo # End of 10.0 tests diff --git a/mysql-test/main/group_min_max_innodb.result b/mysql-test/main/group_min_max_innodb.result index 311032bc453..02262d5649a 100644 --- a/mysql-test/main/group_min_max_innodb.result +++ b/mysql-test/main/group_min_max_innodb.result @@ -41,6 +41,7 @@ create index idx12672_1 on t4 (a1,a2,b,c); create index idx12672_2 on t4 (a1,a2,b); analyze table t4; Table Op Msg_type Msg_text +test.t4 analyze status Engine-independent statistics collected test.t4 analyze status OK select distinct a1 from t4 where pk_col not in (1,2,3,4); a1 diff --git a/mysql-test/main/handlersocket.result b/mysql-test/main/handlersocket.result index 1b3fc573548..8ef9b289cd0 100644 --- a/mysql-test/main/handlersocket.result +++ b/mysql-test/main/handlersocket.result @@ -5,7 +5,7 @@ plugin_version 1.0 plugin_status ACTIVE plugin_type DAEMON plugin_library handlersocket.so -plugin_library_version 1.13 +plugin_library_version 1.14 plugin_author higuchi dot akira at dena dot jp plugin_description Direct access into InnoDB plugin_license BSD diff --git a/mysql-test/main/having.result b/mysql-test/main/having.result index f37cc48772e..a220068bc38 100644 --- a/mysql-test/main/having.result +++ b/mysql-test/main/having.result @@ -835,6 +835,7 @@ INSERT INTO t1 VALUES(10, 10), (11, 11), (12, 12), (12, 13),(14, 15), (15, 16), (16, 17), (17, 17); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SELECT t, next_seq_value() r FROM t1 FORCE INDEX(t) GROUP BY t HAVING r = 1 ORDER BY t1.u; diff --git a/mysql-test/main/huge_frm-6224.result b/mysql-test/main/huge_frm-6224.result index 3772317c04d..bbb650bc5b4 100644 --- a/mysql-test/main/huge_frm-6224.result +++ b/mysql-test/main/huge_frm-6224.result @@ -1 +1,6 @@ +set global max_allowed_packet=1024*1024*10; +connect con1,localhost,root; ERROR HY000: The definition for table `t1` is too big +connection default; +disconnect con1; +set global max_allowed_packet=default; diff --git a/mysql-test/main/huge_frm-6224.test b/mysql-test/main/huge_frm-6224.test index 418722a7b51..322abd01738 100644 --- a/mysql-test/main/huge_frm-6224.test +++ b/mysql-test/main/huge_frm-6224.test @@ -4,17 +4,24 @@ # verify that huge frms are rejected during creation, not on opening # --source include/have_partition.inc +set global max_allowed_packet=1024*1024*10; +connect con1,localhost,root; -let $n=5646; +let $n=8164; let $a=create table t1 (a int) engine=myisam partition by hash(a) partitions $n (; dec $n; while ($n) { - let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n,; + let $a=$a partition p01234567890123456789012345678901234567890123456789012345678$n COMMENT 'partition p01234567890123456789012345678901234567890123456789012345678$n',; dec $n; } --disable_query_log --error ER_TABLE_DEFINITION_TOO_BIG eval $a partition foo); +--enable_query_log + +connection default; +disconnect con1; +set global max_allowed_packet=default; diff --git a/mysql-test/main/in_subq_cond_pushdown.result b/mysql-test/main/in_subq_cond_pushdown.result index c9319a5fb86..06248895bd3 100644 --- a/mysql-test/main/in_subq_cond_pushdown.result +++ b/mysql-test/main/in_subq_cond_pushdown.result @@ -3855,3 +3855,35 @@ ORDER BY t4.d a b c x x NULL DROP TABLE t1,t2,t3,t4; +# +# MDEV-17360: IN subquery predicate with outer reference in the left part +# that refers to a field of a mergeable derived table +# +CREATE TABLE t1 (id1 int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1814),(0),(NULL),(1); +CREATE TABLE t2 (id2 int) ENGINE=MYISAM; +SELECT 1 AS r FROM t2,t1,(SELECT * FROM t1) dt1 +WHERE NOT EXISTS (SELECT id2 FROM t2 +WHERE dt1.id1 IN (SELECT t2.id2 FROM t2 +HAVING t2.id2 >= 1)); +r +DROP TABLE t1,t2; +# +# MDEV-17027: IN subquery predicate with outer reference in the left part +# conjuncted with equality predicate +# +CREATE TABLE t1 (pk int, i1 int, v1 varchar(1)); +INSERT INTO t1 VALUES (3,2,'x'), (1,1,'y'), (4,2,'z'); +CREATE TABLE t2 (pk int, i1 int, v1 varchar(1)); +INSERT INTO t2 VALUES (5,2,'x'), (7,1,'x'); +CREATE TABLE t3 (pk int, i1 int, v1 varchar(1)); +INSERT INTO t3 VALUES (8,2,'x'), (7,1,'z'); +SELECT t3.i1 FROM t3 +WHERE EXISTS ( SELECT t2.v1 FROM t1,t2 +WHERE t1.v1 = t2.v1 AND +t3.i1 IN (SELECT t.i1 FROM t1 as t +GROUP BY i1 HAVING t.i1 < 3)); +i1 +2 +1 +DROP TABLE t1,t2,t3; diff --git a/mysql-test/main/in_subq_cond_pushdown.test b/mysql-test/main/in_subq_cond_pushdown.test index 3c673fb128b..2482fd91103 100644 --- a/mysql-test/main/in_subq_cond_pushdown.test +++ b/mysql-test/main/in_subq_cond_pushdown.test @@ -821,3 +821,42 @@ WHERE (t1.a) IN ); DROP TABLE t1,t2,t3,t4; + +--echo # +--echo # MDEV-17360: IN subquery predicate with outer reference in the left part +--echo # that refers to a field of a mergeable derived table +--echo # + +CREATE TABLE t1 (id1 int) ENGINE=MYISAM; +INSERT INTO t1 VALUES (1814),(0),(NULL),(1); + +CREATE TABLE t2 (id2 int) ENGINE=MYISAM; + +SELECT 1 AS r FROM t2,t1,(SELECT * FROM t1) dt1 + WHERE NOT EXISTS (SELECT id2 FROM t2 + WHERE dt1.id1 IN (SELECT t2.id2 FROM t2 + HAVING t2.id2 >= 1)); + +DROP TABLE t1,t2; + +--echo # +--echo # MDEV-17027: IN subquery predicate with outer reference in the left part +--echo # conjuncted with equality predicate +--echo # + +CREATE TABLE t1 (pk int, i1 int, v1 varchar(1)); +INSERT INTO t1 VALUES (3,2,'x'), (1,1,'y'), (4,2,'z'); + +CREATE TABLE t2 (pk int, i1 int, v1 varchar(1)); +INSERT INTO t2 VALUES (5,2,'x'), (7,1,'x'); + +CREATE TABLE t3 (pk int, i1 int, v1 varchar(1)); +INSERT INTO t3 VALUES (8,2,'x'), (7,1,'z'); + +SELECT t3.i1 FROM t3 + WHERE EXISTS ( SELECT t2.v1 FROM t1,t2 + WHERE t1.v1 = t2.v1 AND + t3.i1 IN (SELECT t.i1 FROM t1 as t + GROUP BY i1 HAVING t.i1 < 3)); + +DROP TABLE t1,t2,t3; diff --git a/mysql-test/main/index_merge_innodb.result b/mysql-test/main/index_merge_innodb.result index 6a3ea839535..3ba21b5fb85 100644 --- a/mysql-test/main/index_merge_innodb.result +++ b/mysql-test/main/index_merge_innodb.result @@ -106,6 +106,7 @@ insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b) select key1a, key1b, key2a, key2b, key3a, key3b from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK select count(*) from t1; count(*) @@ -313,6 +314,7 @@ alter table t1 add index i3(key3); update t1 set key2=key1,key3=key1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); id select_type table type possible_keys key key_len ref rows Extra @@ -699,8 +701,8 @@ SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY ALL NULL NULL NULL NULL 6145 -2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL 6145 Using sort_union(idx,PRIMARY); Using where +1 PRIMARY ALL NULL NULL NULL NULL # +2 DERIVED t1 index_merge PRIMARY,idx idx,PRIMARY 5,4 NULL # Using sort_union(idx,PRIMARY); Using where SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) WHERE a BETWEEN 2 AND 7 OR pk=1000000) AS t; diff --git a/mysql-test/main/index_merge_innodb.test b/mysql-test/main/index_merge_innodb.test index 53ce3114b49..4b75ddaa0f2 100644 --- a/mysql-test/main/index_merge_innodb.test +++ b/mysql-test/main/index_merge_innodb.test @@ -72,6 +72,7 @@ set optimizer_switch='derived_merge=off,derived_with_keys=off'; # We have to use FORCE INDEX here as Innodb gives inconsistent estimates # which causes different query plans. +--replace_column 9 # EXPLAIN SELECT COUNT(*) FROM (SELECT * FROM t1 FORCE INDEX(primary,idx) diff --git a/mysql-test/main/index_merge_myisam.result b/mysql-test/main/index_merge_myisam.result index 992e1d831b5..0438d0e564c 100644 --- a/mysql-test/main/index_merge_myisam.result +++ b/mysql-test/main/index_merge_myisam.result @@ -18,6 +18,7 @@ alter table t0 add key8 int not null, add index i8(key8); update t0 set key2=key1,key3=key1,key4=key1,key5=key1,key6=key1,key7=key1,key8=1024-key1; analyze table t0; Table Op Msg_type Msg_text +test.t0 analyze status Engine-independent statistics collected test.t0 analyze status OK explain select * from t0 where key1 < 3 or key1 > 1020; id select_type table type possible_keys key key_len ref rows Extra @@ -944,6 +945,7 @@ insert into t1 (key1a, key1b, key2a, key2b, key3a, key3b) select key1a, key1b, key2a, key2b, key3a, key3b from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK select count(*) from t1; count(*) @@ -1151,6 +1153,7 @@ alter table t1 add index i3(key3); update t1 set key2=key1,key3=key1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (key3 > 30 and key3<35) or (key2 >32 and key2 < 40); id select_type table type possible_keys key key_len ref rows Extra @@ -1715,3 +1718,54 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL PRIMARY,c1,i,c2 NULL NULL NULL 69 Using where DROP TABLE t1; set optimizer_switch= @optimizer_switch_save; +# +# MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union +# +create table t0 +( +key1 int not null, +INDEX i1(key1) +); +insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); +set @d=8; +insert into t0 select key1+ @d from t0; +set @d=@d*2; +insert into t0 select key1+ @d from t0; +set @d=@d*2; +insert into t0 select key1+ @d from t0; +set @d=@d*2; +insert into t0 select key1+ @d from t0; +set @d=@d*2; +insert into t0 select key1+ @d from t0; +set @d=@d*2; +insert into t0 select key1+ @d from t0; +set @d=@d*2; +insert into t0 select key1+ @d from t0; +set @d=@d*2; +alter table t0 add key2 int not null, add index i2(key2); +alter table t0 add key3 int not null, add index i3(key3); +alter table t0 add key8 int not null, add index i8(key8); +update t0 set key2=key1,key3=key1,key8=1024-key1; +analyze table t0; +Table Op Msg_type Msg_text +test.t0 analyze status Engine-independent statistics collected +test.t0 analyze status OK +set @optimizer_switch_save=@@optimizer_switch; +set optimizer_switch='derived_merge=off,derived_with_keys=off'; +explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t0 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; +key1 key2 key3 key8 +3 3 3 1021 +set optimizer_use_condition_selectivity=2; +explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 2 Using where +2 DERIVED t0 index_merge i1,i2,i8 i1,i2 4,4 NULL 2 Using union(i1,i2); Using where +select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; +key1 key2 key3 key8 +3 3 3 1021 +set @@optimizer_switch= @optimizer_switch_save; +drop table t0; diff --git a/mysql-test/main/index_merge_myisam.test b/mysql-test/main/index_merge_myisam.test index d265007431e..75beb9bd883 100644 --- a/mysql-test/main/index_merge_myisam.test +++ b/mysql-test/main/index_merge_myisam.test @@ -243,3 +243,38 @@ DROP TABLE t1; set optimizer_switch= @optimizer_switch_save; +--echo # +--echo # MDEV-16695: Estimate for rows of derived tables is very high when we are using index_merge union +--echo # + +create table t0 +( + key1 int not null, + INDEX i1(key1) +); + +insert into t0 values (1),(2),(3),(4),(5),(6),(7),(8); +let $1=7; +set @d=8; +while ($1) +{ + eval insert into t0 select key1+ @d from t0; + eval set @d=@d*2; + dec $1; +} +alter table t0 add key2 int not null, add index i2(key2); +alter table t0 add key3 int not null, add index i3(key3); +alter table t0 add key8 int not null, add index i8(key8); + +update t0 set key2=key1,key3=key1,key8=1024-key1; +analyze table t0; + +set @optimizer_switch_save=@@optimizer_switch; +set optimizer_switch='derived_merge=off,derived_with_keys=off'; +explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; +select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; +set optimizer_use_condition_selectivity=2; +explain select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; +select * from (select * from t0 where key1 = 3 or key2 =3) as Z where Z.key8 > 5; +set @@optimizer_switch= @optimizer_switch_save; +drop table t0; diff --git a/mysql-test/main/information_schema.result b/mysql-test/main/information_schema.result index b6e331a0382..b76d9f64a9f 100644 --- a/mysql-test/main/information_schema.result +++ b/mysql-test/main/information_schema.result @@ -96,6 +96,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -563,6 +564,7 @@ create view v2 (c) as select a from t1 WITH LOCAL CHECK OPTION; create view v3 (c) as select a from t1 WITH CASCADED CHECK OPTION; select * from information_schema.views; TABLE_CATALOG TABLE_SCHEMA TABLE_NAME VIEW_DEFINITION CHECK_OPTION IS_UPDATABLE DEFINER SECURITY_TYPE CHARACTER_SET_CLIENT COLLATION_CONNECTION ALGORITHM +def mysql user select `mysql`.`global_priv`.`Host` AS `Host`,`mysql`.`global_priv`.`User` AS `User`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`mysql`.`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,'N' AS `password_expired`,elt(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`mysql`.`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `mysql`.`global_priv` NONE YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def test v1 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def test v2 select `test`.`t1`.`a` AS `c` from `test`.`t1` LOCAL YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED def test v3 select `test`.`t1`.`a` AS `c` from `test`.`t1` CASCADED YES root@localhost DEFINER latin1 latin1_swedish_ci UNDEFINED @@ -593,6 +595,7 @@ information_schema.tables; s1 10 11 +NULL drop table t1; SHOW CREATE TABLE INFORMATION_SCHEMA.character_sets; Table Create Table @@ -664,7 +667,7 @@ proc body longblob proc definer char(141) proc created timestamp proc modified timestamp -proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') +proc sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') proc comment text proc character_set_client char(32) proc collation_connection char(32) @@ -824,7 +827,7 @@ NULL select table_type from information_schema.tables where table_schema="mysql" and table_name="user"; table_type -BASE TABLE +VIEW show open tables where `table` like "user"; Database Table In_use Name_locked mysql user 0 0 @@ -874,6 +877,14 @@ information_schema SYSTEM_VARIABLES ENUM_VALUE_LIST information_schema TRIGGERS ACTION_CONDITION information_schema TRIGGERS ACTION_STATEMENT information_schema VIEWS VIEW_DEFINITION +mysql global_priv Priv +mysql user Password +mysql user ssl_cipher +mysql user x509_issuer +mysql user x509_subject +mysql user plugin +mysql user authentication_string +mysql user default_role select table_name, column_name, data_type from information_schema.columns where data_type = 'datetime' and table_name not like 'innodb_%' order by binary table_name, ordinal_position; @@ -1253,7 +1264,7 @@ CREATE VIEW v1 AS SELECT 1 FROM t1 WHERE f3 = (SELECT func2 ()); SELECT func1(); func1() -1 +2 DROP TABLE t1; DROP VIEW v1; DROP FUNCTION func1; @@ -1404,6 +1415,7 @@ create table t2 (f1 int, f2 int); create view v2 as select f1+1 as a, f2 as b from t2; select table_name, is_updatable from information_schema.views order by table_name; table_name is_updatable +user YES v1 NO v2 YES delete from v1; @@ -1957,8 +1969,9 @@ lock table t1 read; connect con1, localhost, root,,; connection con1; flush tables; +flush tables t1; connection default; -select * from information_schema.views; +select * from information_schema.views where table_schema='test'; TABLE_CATALOG def TABLE_SCHEMA test TABLE_NAME v1 diff --git a/mysql-test/main/information_schema.test b/mysql-test/main/information_schema.test index 1f72d0b6129..95b6f253058 100644 --- a/mysql-test/main/information_schema.test +++ b/mysql-test/main/information_schema.test @@ -8,6 +8,10 @@ # on the presence of the log tables (which are CSV-based). --source include/have_csv.inc +# Without aria_used_for_temp_tables some I_S tables will be MyISAM, +# while the test expects them to be Aria +-- source include/have_aria_used_for_temp_tables.inc + -- source include/have_innodb.inc # Save the initial number of concurrent sessions @@ -1618,15 +1622,16 @@ alter table t1 change b c int; lock table t1 read; connect(con1, localhost, root,,); connection con1; -send flush tables; +flush tables; +send flush tables t1; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" and - info = "flush tables"; + where state = "Waiting for table metadata lock" and + info = "flush tables t1"; --source include/wait_condition.inc --vertical_results -select * from information_schema.views; +select * from information_schema.views where table_schema='test'; --horizontal_results unlock tables; diff --git a/mysql-test/main/information_schema_all_engines.result b/mysql-test/main/information_schema_all_engines.result index 0ce9f15f753..2916858b5a6 100644 --- a/mysql-test/main/information_schema_all_engines.result +++ b/mysql-test/main/information_schema_all_engines.result @@ -460,4 +460,4 @@ Wildcard: inf_rmation_schema SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA; table_schema count(*) information_schema 65 -mysql 30 +mysql 31 diff --git a/mysql-test/main/init_file_set_password-7656.result b/mysql-test/main/init_file_set_password-7656.result index e5b3fc75706..fba65b036fd 100644 --- a/mysql-test/main/init_file_set_password-7656.result +++ b/mysql-test/main/init_file_set_password-7656.result @@ -1,8 +1,8 @@ create user foo@localhost; select user,host,password from mysql.user where user='foo'; -user host password +User Host Password foo localhost -select user,host,password from mysql.user where user='foo'; -user host password -foo localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +select user,host,password,plugin,authentication_string from mysql.user where user='foo'; +User Host Password plugin authentication_string +foo localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 drop user foo@localhost; diff --git a/mysql-test/main/init_file_set_password-7656.test b/mysql-test/main/init_file_set_password-7656.test index ecee3924355..c695d01b675 100644 --- a/mysql-test/main/init_file_set_password-7656.test +++ b/mysql-test/main/init_file_set_password-7656.test @@ -21,6 +21,6 @@ EOF --exec echo "restart:--init-file=$MYSQLTEST_VARDIR/init.file " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect --source include/wait_until_connected_again.inc -select user,host,password from mysql.user where user='foo'; +select user,host,password,plugin,authentication_string from mysql.user where user='foo'; drop user foo@localhost; diff --git a/mysql-test/main/innodb_ext_key.result b/mysql-test/main/innodb_ext_key.result index c55e8d138f8..db08d1148b8 100644 --- a/mysql-test/main/innodb_ext_key.result +++ b/mysql-test/main/innodb_ext_key.result @@ -872,7 +872,9 @@ alter table t3 add primary key (pk1, pk2); alter table t3 add key (col1, col2); analyze table t1,t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK set optimizer_switch='extended_keys=off'; explain @@ -1089,6 +1091,7 @@ from t0 A, t0 B, t0 C; drop table t0,t1; # +# # MDEV-10360: Extended keys: index properties depend on index order # create table t0 (a int); @@ -1171,7 +1174,7 @@ EXPLAIN "key_length": "3070", "used_key_parts": ["f2", "pk1"], "rows": 1, - "filtered": 100, + "filtered": 50, "index_condition": "t1.pk1 <= 5 and t1.pk2 <= 5 and t1.f2 = 'abc'", "attached_condition": "t1.f1 <= '3'" } @@ -1201,7 +1204,7 @@ EXPLAIN "key_length": "3011", "used_key_parts": ["pk1", "f2", "pk2"], "rows": 1, - "filtered": 100, + "filtered": 50, "index_condition": "t1.f2 <= 5 and t1.pk2 <= 5 and t1.pk1 = 'abc'", "attached_condition": "t1.f1 <= '3'" } diff --git a/mysql-test/main/innodb_ext_key.test b/mysql-test/main/innodb_ext_key.test index a721943e8bc..4104ac5f787 100644 --- a/mysql-test/main/innodb_ext_key.test +++ b/mysql-test/main/innodb_ext_key.test @@ -725,6 +725,7 @@ if ($rows < 2) drop table t0,t1; +--echo # --echo # --echo # MDEV-10360: Extended keys: index properties depend on index order --echo # diff --git a/mysql-test/main/innodb_icp.result b/mysql-test/main/innodb_icp.result index 8a58a769ed9..00ca6b144ad 100644 --- a/mysql-test/main/innodb_icp.result +++ b/mysql-test/main/innodb_icp.result @@ -679,8 +679,8 @@ EXPLAIN SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0 HAVING t1.c != 5 ORDER BY t1.c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort -1 SIMPLE t2 ref a a 515 test.t1.a 1 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using temporary; Using filesort +1 SIMPLE t2 ALL a NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0 HAVING t1.c != 5 ORDER BY t1.c; b c @@ -690,8 +690,8 @@ EXPLAIN SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0 HAVING t1.c != 5 ORDER BY t1.c; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using filesort -1 SIMPLE t2 ref a a 515 test.t1.a 1 Using where +1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 2 Using where; Using temporary; Using filesort +1 SIMPLE t2 ALL a NULL NULL NULL 6 Using where; Using join buffer (flat, BNL join) SELECT t1.b, t1.c FROM t1, t2 WHERE t1.a = t2.a AND t1.b != 0 HAVING t1.c != 5 ORDER BY t1.c; b c @@ -851,7 +851,7 @@ DROP TABLE t1; create table t1 (a int,b char(5),primary key (a), key (b(1))); insert ignore into t1 values ('a','b'); Warnings: -Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`a` at row 1 select 1 from t1 where a and b >= 'aa'; 1 drop table t1; diff --git a/mysql-test/main/innodb_mrr_cpk.result b/mysql-test/main/innodb_mrr_cpk.result index 28d7dd51df8..a2e43d7d127 100644 --- a/mysql-test/main/innodb_mrr_cpk.result +++ b/mysql-test/main/innodb_mrr_cpk.result @@ -226,7 +226,7 @@ set join_cache_level=3; explain SELECT 1 FROM (SELECT url, id FROM t2 LIMIT 1 OFFSET 20) derived RIGHT JOIN t1 ON t1.id = derived.id; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL # -1 PRIMARY hash_ALL key0 #hash#key0 25 test.t1.id # Using join buffer (flat, BNLH join) +1 PRIMARY ref key0 key0 25 test.t1.id # 2 DERIVED t2 ALL NULL NULL NULL NULL # set join_cache_level= @tmp_mdev5037; drop table t0,t1,t2; diff --git a/mysql-test/main/innodb_mysql_sync.result b/mysql-test/main/innodb_mysql_sync.result index a8a264d6580..3f284edde86 100644 --- a/mysql-test/main/innodb_mysql_sync.result +++ b/mysql-test/main/innodb_mysql_sync.result @@ -489,7 +489,9 @@ DROP TABLE t1; SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded'; #Setup a table with FULLTEXT index. connection default; -CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1)) ENGINE= INNODB; +CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1), FULLTEXT(fld1)) ENGINE= INNODB; +Warnings: +Note 1831 Duplicate index `fld1_2`. This is deprecated and will be disallowed in a future release INSERT INTO t1 VALUES("String1"); #OPTIMIZE TABLE operation. OPTIMIZE TABLE t1; diff --git a/mysql-test/main/innodb_mysql_sync.test b/mysql-test/main/innodb_mysql_sync.test index 66935f811d7..4026080c4b4 100644 --- a/mysql-test/main/innodb_mysql_sync.test +++ b/mysql-test/main/innodb_mysql_sync.test @@ -650,7 +650,7 @@ SET DEBUG_SYNC= 'alter_table_copy_after_lock_upgrade SIGNAL upgraded'; --echo #Setup a table with FULLTEXT index. --connection default -CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1)) ENGINE= INNODB; +CREATE TABLE t1(fld1 CHAR(10), FULLTEXT(fld1), FULLTEXT(fld1)) ENGINE= INNODB; INSERT INTO t1 VALUES("String1"); --echo #OPTIMIZE TABLE operation. diff --git a/mysql-test/main/insert.result b/mysql-test/main/insert.result index 736aa917cae..4aea81262d2 100644 --- a/mysql-test/main/insert.result +++ b/mysql-test/main/insert.result @@ -92,14 +92,14 @@ create table t1(number int auto_increment primary key, original_value varchar(50 set @value= "aa"; insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1366 Incorrect double value: 'aa' for column 'f_double' at row 1 -Warning 1366 Incorrect double value: 'aa' for column 'f_float' at row 1 -Warning 1366 Incorrect double value: 'aa' for column 'f_double_7_2' at row 1 -Warning 1366 Incorrect double value: 'aa' for column 'f_float_4_3' at row 1 -Warning 1366 Incorrect double value: 'aa' for column 'f_double_u' at row 1 -Warning 1366 Incorrect double value: 'aa' for column 'f_float_u' at row 1 -Warning 1366 Incorrect double value: 'aa' for column 'f_double_15_1_u' at row 1 -Warning 1366 Incorrect double value: 'aa' for column 'f_float_3_1_u' at row 1 +Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_double` at row 1 +Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_float` at row 1 +Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_double_7_2` at row 1 +Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_float_4_3` at row 1 +Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_double_u` at row 1 +Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_float_u` at row 1 +Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_double_15_1_u` at row 1 +Warning 1366 Incorrect double value: 'aa' for column `test`.`t1`.`f_float_3_1_u` at row 1 select * from t1 where number =last_insert_id(); number 1 original_value aa @@ -136,14 +136,14 @@ f_float_3_1_u 1.0 set @value= "aa1"; insert ignore into t1 values(null,@value,@value,@value,@value,@value,@value,@value,@value,@value); Warnings: -Warning 1366 Incorrect double value: 'aa1' for column 'f_double' at row 1 -Warning 1366 Incorrect double value: 'aa1' for column 'f_float' at row 1 -Warning 1366 Incorrect double value: 'aa1' for column 'f_double_7_2' at row 1 -Warning 1366 Incorrect double value: 'aa1' for column 'f_float_4_3' at row 1 -Warning 1366 Incorrect double value: 'aa1' for column 'f_double_u' at row 1 -Warning 1366 Incorrect double value: 'aa1' for column 'f_float_u' at row 1 -Warning 1366 Incorrect double value: 'aa1' for column 'f_double_15_1_u' at row 1 -Warning 1366 Incorrect double value: 'aa1' for column 'f_float_3_1_u' at row 1 +Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_double` at row 1 +Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_float` at row 1 +Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_double_7_2` at row 1 +Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_float_4_3` at row 1 +Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_double_u` at row 1 +Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_float_u` at row 1 +Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_double_15_1_u` at row 1 +Warning 1366 Incorrect double value: 'aa1' for column `test`.`t1`.`f_float_3_1_u` at row 1 select * from t1 where number =last_insert_id(); number 3 original_value aa1 diff --git a/mysql-test/main/invisible_field.result b/mysql-test/main/invisible_field.result index 8090258c081..36e62645ef2 100644 --- a/mysql-test/main/invisible_field.result +++ b/mysql-test/main/invisible_field.result @@ -404,8 +404,8 @@ b int(11) YES NULL c int(11) YES NULL explain select * from t1,t2 where t1.b = t2.c and t1.c = t2.b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t2 ALL NULL NULL NULL NULL 10 -1 SIMPLE t1 ALL b,c NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t1 ALL b,c NULL NULL NULL 10 +1 SIMPLE t2 ALL NULL NULL NULL NULL 10 Using where; Using join buffer (flat, BNL join) select * from t1,t2 where t1.b = t2.c and t1.c = t2.b; a a b c 1 1 1 1 diff --git a/mysql-test/main/invisible_field_debug.result b/mysql-test/main/invisible_field_debug.result index b3c84d18333..0ea8ab12de8 100644 --- a/mysql-test/main/invisible_field_debug.result +++ b/mysql-test/main/invisible_field_debug.result @@ -17,6 +17,8 @@ a invisible 1 9 insert into t1(a, invisible) values(99,99); ERROR 42S22: Unknown column 'invisible' in 'field list' +select default(invisible) from t1; +ERROR 42S22: Unknown column 'invisible' in 'field list' insert into t1(invisible) values(99); ERROR 42S22: Unknown column 'invisible' in 'field list' insert into t_tmp select a, invisible from t1; diff --git a/mysql-test/main/invisible_field_debug.test b/mysql-test/main/invisible_field_debug.test index c1d6899d16e..86252512386 100644 --- a/mysql-test/main/invisible_field_debug.test +++ b/mysql-test/main/invisible_field_debug.test @@ -13,6 +13,8 @@ select a , invisible from t1; --error ER_BAD_FIELD_ERROR insert into t1(a, invisible) values(99,99); --error ER_BAD_FIELD_ERROR +select default(invisible) from t1; +--error ER_BAD_FIELD_ERROR insert into t1(invisible) values(99); insert into t_tmp select a, invisible from t1; --error ER_WRONG_VALUE_COUNT_ON_ROW diff --git a/mysql-test/main/join.result b/mysql-test/main/join.result index bd015ae351c..7918cb173e9 100644 --- a/mysql-test/main/join.result +++ b/mysql-test/main/join.result @@ -260,8 +260,8 @@ PRIMARY KEY (id) INSERT INTO t2 VALUES (1,'s1'),(2,'s2'),(3,'s3'),(4,'s4'),(5,'s5'); select t1.*, t2.* from t1, t2 where t2.id=t1.t2_id limit 2; t1_id t2_id type cost_unit min_value max_value t3_id item_id id name -22 1 Percent Cost 100 -1 6 291 1 s1 -23 1 Percent Cost 100 -1 21 291 1 s1 +12 5 Percent Cost -1 0 -1 -1 5 s5 +14 4 Percent Cost -1 0 -1 -1 4 s4 drop table t1,t2; CREATE TABLE t1 ( siteid varchar(25) NOT NULL default '', @@ -755,10 +755,10 @@ ERROR 42S22: Unknown column 't1.b' in 'on clause' select statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT, columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT -from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user'; +from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='global_priv'; TABLE_NAME COLUMN_NAME TABLE_CATALOG TABLE_SCHEMA NON_UNIQUE INDEX_SCHEMA INDEX_NAME SEQ_IN_INDEX COLLATION SUB_PART PACKED NULLABLE INDEX_TYPE COMMENT TABLE_CATALOG TABLE_SCHEMA COLUMN_DEFAULT IS_NULLABLE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE CHARACTER_SET_NAME COLLATION_NAME COLUMN_TYPE COLUMN_KEY EXTRA COLUMN_COMMENT -user Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql '' NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI -user User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql '' NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI +global_priv Host def mysql 0 mysql PRIMARY 1 A NULL NULL BTREE def mysql '' NO char 60 180 NULL NULL utf8 utf8_bin char(60) PRI +global_priv User def mysql 0 mysql PRIMARY 2 A NULL NULL BTREE def mysql '' NO char 80 240 NULL NULL utf8 utf8_bin char(80) PRI Warnings: Warning 1286 Unknown storage engine 'InnoDB' Warning 1286 Unknown storage engine 'InnoDB' @@ -1522,11 +1522,13 @@ ERROR 42S22: Unknown column 'f' in 'from clause' DROP TABLE t; CREATE TABLE t (f INT); CALL p; -ERROR 42S22: Unknown column 'f' in 'from clause' +f DROP TABLE t; CREATE TABLE t (i INT); CALL p; -ERROR 42S22: Unknown column 'f' in 'from clause' +ERROR 42S22: Unknown column 't1.f' in 'field list' +CALL p; +ERROR 42S22: Unknown column 't1.f' in 'field list' DROP PROCEDURE p; DROP TABLE t; CREATE TABLE t1 (a INT, b INT); diff --git a/mysql-test/main/join.test b/mysql-test/main/join.test index 8a088de91cc..a6cf2dcc217 100644 --- a/mysql-test/main/join.test +++ b/mysql-test/main/join.test @@ -555,7 +555,7 @@ select * from v1a join v1b on t1.b = t2.b; select statistics.TABLE_NAME, statistics.COLUMN_NAME, statistics.TABLE_CATALOG, statistics.TABLE_SCHEMA, statistics.NON_UNIQUE, statistics.INDEX_SCHEMA, statistics.INDEX_NAME, statistics.SEQ_IN_INDEX, statistics.COLLATION, statistics.SUB_PART, statistics.PACKED, statistics.NULLABLE, statistics.INDEX_TYPE, statistics.COMMENT, columns.TABLE_CATALOG, columns.TABLE_SCHEMA, columns.COLUMN_DEFAULT, columns.IS_NULLABLE, columns.DATA_TYPE, columns.CHARACTER_MAXIMUM_LENGTH, columns.CHARACTER_OCTET_LENGTH, columns.NUMERIC_PRECISION, columns.NUMERIC_SCALE, columns.CHARACTER_SET_NAME, columns.COLLATION_NAME, columns.COLUMN_TYPE, columns.COLUMN_KEY, columns.EXTRA, columns.COLUMN_COMMENT - from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='user'; + from information_schema.statistics join information_schema.columns using(table_name,column_name) where table_name='global_priv'; drop table t1; drop table t2; @@ -1185,12 +1185,13 @@ CREATE TABLE t (f INT); # # The following shouldn't fail as the table is now matching the using # ---error ER_BAD_FIELD_ERROR CALL p; DROP TABLE t; CREATE TABLE t (i INT); --error ER_BAD_FIELD_ERROR CALL p; +--error ER_BAD_FIELD_ERROR +CALL p; DROP PROCEDURE p; DROP TABLE t; diff --git a/mysql-test/main/join_cache.result b/mysql-test/main/join_cache.result index fde6e0fec6b..dcada9b60e2 100644 --- a/mysql-test/main/join_cache.result +++ b/mysql-test/main/join_cache.result @@ -79,9 +79,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where +1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join) 1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -157,9 +157,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where +1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join) +1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (incremental, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -236,8 +236,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) 1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -314,8 +314,8 @@ CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (incremental, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -402,7 +402,7 @@ ON City.Country=Country.Code AND City.Population > 5000000 WHERE Country.Name LIKE 'C%' AND Country.Population > 10000000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE City hash_range City_Population #hash#$hj:City_Population 3:4 world.Country.Code 25 Using where; Rowid-ordered scan; Using join buffer (flat, BNLH join) +1 SIMPLE City range City_Population City_Population 4 NULL 25 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) SELECT Country.Name, Country.Population, City.Name, City.Population FROM Country LEFT JOIN City ON City.Country=Country.Code AND City.Population > 5000000 @@ -497,9 +497,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where 1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (flat, BNL join) +1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (flat, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -575,9 +575,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where 1 SIMPLE CountryLanguage ALL NULL NULL NULL NULL 984 Using where; Using join buffer (flat, BNL join) -1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where; Using join buffer (incremental, BNL join) +1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where; Using join buffer (incremental, BNL join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -653,9 +653,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE Country hash_ALL NULL #hash#$hj 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -731,9 +731,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE Country ALL NULL NULL NULL NULL 239 Using where -1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.Country.Code 984 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL NULL #hash#$hj 3 world.Country.Code 4079 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE City ALL NULL NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage hash_ALL NULL #hash#$hj 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE Country hash_ALL NULL #hash#$hj 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -848,9 +848,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.CountryLanguage.Country 239 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL Country #hash#Country 3 world.CountryLanguage.Country 4079 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1048,9 +1048,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.CountryLanguage.Country 239 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL Country #hash#Country 3 world.CountryLanguage.Country 4079 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1278,7 +1278,7 @@ WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1307,9 +1307,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1318,41 +1318,41 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; Name Name Language -La Matanza Argentina Spanish Lomas de Zamora Argentina Spanish +La Matanza Argentina Spanish Lauro de Freitas Brazil Portuguese Los Angeles Chile Spanish Las Palmas de Gran Canaria Spain Spanish -L´Hospitalet de Llobregat Spain Spanish Lleida (Lérida) Spain Spanish +L´Hospitalet de Llobregat Spain Spanish Liupanshui China Chinese -Lianyungang China Chinese Liangcheng China Chinese +Lianyungang China Chinese Lengshuijiang China Chinese Lázaro Cárdenas Mexico Spanish Lagos de Moreno Mexico Spanish Las Margaritas Mexico Spanish Lashio (Lasho) Myanmar Burmese Lalitapur Nepal Nepali -Ludwigshafen am Rhein Germany German Leverkusen Germany German +Ludwigshafen am Rhein Germany German Luchou Taiwan Min Lungtan Taiwan Min Lower Hutt New Zealand English Los Teques Venezuela Spanish Leninsk-Kuznetski Russian Federation Russian -Los Angeles United States English Long Beach United States English Lexington-Fayette United States English Louisville United States English Little Rock United States English +Los Angeles United States English EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -1475,7 +1475,7 @@ WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1504,9 +1504,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1515,41 +1515,41 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; Name Name Language -La Matanza Argentina Spanish Lomas de Zamora Argentina Spanish +La Matanza Argentina Spanish Lauro de Freitas Brazil Portuguese Los Angeles Chile Spanish Las Palmas de Gran Canaria Spain Spanish -L´Hospitalet de Llobregat Spain Spanish Lleida (Lérida) Spain Spanish +L´Hospitalet de Llobregat Spain Spanish Liupanshui China Chinese -Lianyungang China Chinese Liangcheng China Chinese Lengshuijiang China Chinese -Lázaro Cárdenas Mexico Spanish -Lagos de Moreno Mexico Spanish +Lianyungang China Chinese Las Margaritas Mexico Spanish +Lagos de Moreno Mexico Spanish +Lázaro Cárdenas Mexico Spanish Lashio (Lasho) Myanmar Burmese Lalitapur Nepal Nepali -Ludwigshafen am Rhein Germany German Leverkusen Germany German +Ludwigshafen am Rhein Germany German Luchou Taiwan Min Lungtan Taiwan Min Lower Hutt New Zealand English Los Teques Venezuela Spanish Leninsk-Kuznetski Russian Federation Russian -Los Angeles United States English -Long Beach United States English -Lexington-Fayette United States English -Louisville United States English Little Rock United States English +Louisville United States English +Lexington-Fayette United States English +Long Beach United States English +Los Angeles United States English EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -1672,7 +1672,7 @@ WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1701,9 +1701,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1716,37 +1716,37 @@ La Matanza Argentina Spanish Lomas de Zamora Argentina Spanish Lauro de Freitas Brazil Portuguese Los Angeles Chile Spanish +Lleida (Lérida) Spain Spanish Las Palmas de Gran Canaria Spain Spanish L´Hospitalet de Llobregat Spain Spanish -Lleida (Lérida) Spain Spanish -Liupanshui China Chinese Lianyungang China Chinese Liangcheng China Chinese Lengshuijiang China Chinese -Lázaro Cárdenas Mexico Spanish +Liupanshui China Chinese Lagos de Moreno Mexico Spanish Las Margaritas Mexico Spanish +Lázaro Cárdenas Mexico Spanish Lashio (Lasho) Myanmar Burmese Lalitapur Nepal Nepali -Ludwigshafen am Rhein Germany German Leverkusen Germany German +Ludwigshafen am Rhein Germany German Luchou Taiwan Min Lungtan Taiwan Min Lower Hutt New Zealand English Los Teques Venezuela Spanish Leninsk-Kuznetski Russian Federation Russian -Los Angeles United States English -Long Beach United States English Lexington-Fayette United States English Louisville United States English +Los Angeles United States English Little Rock United States English +Long Beach United States English EXPLAIN SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -1869,7 +1869,7 @@ WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -1898,9 +1898,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -1913,28 +1913,28 @@ La Matanza Argentina Spanish Lomas de Zamora Argentina Spanish Lauro de Freitas Brazil Portuguese Los Angeles Chile Spanish +Lleida (Lérida) Spain Spanish Las Palmas de Gran Canaria Spain Spanish L´Hospitalet de Llobregat Spain Spanish -Lleida (Lérida) Spain Spanish -Liupanshui China Chinese Lianyungang China Chinese Liangcheng China Chinese Lengshuijiang China Chinese -Lázaro Cárdenas Mexico Spanish +Liupanshui China Chinese Lagos de Moreno Mexico Spanish +Lázaro Cárdenas Mexico Spanish Las Margaritas Mexico Spanish Lashio (Lasho) Myanmar Burmese Lalitapur Nepal Nepali -Ludwigshafen am Rhein Germany German Leverkusen Germany German +Ludwigshafen am Rhein Germany German Luchou Taiwan Min Lungtan Taiwan Min Lower Hutt New Zealand English Los Teques Venezuela Spanish Leninsk-Kuznetski Russian Federation Russian +Lexington-Fayette United States English Los Angeles United States English Long Beach United States English -Lexington-Fayette United States English Louisville United States English Little Rock United States English EXPLAIN @@ -1943,7 +1943,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2099,9 +2099,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.CountryLanguage.Country 239 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL Country #hash#Country 3 world.CountryLanguage.Country 4079 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2203,9 +2203,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.CountryLanguage.Country 239 Using where; Using join buffer (flat, BNLH join) -1 SIMPLE City hash_ALL Country #hash#Country 3 world.CountryLanguage.Country 4079 Using where; Using join buffer (incremental, BNLH join) +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (incremental, BNLH join) SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2278,7 +2278,7 @@ WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2307,9 +2307,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2352,7 +2352,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2382,7 +2382,7 @@ WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2411,9 +2411,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2456,7 +2456,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan +1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2486,7 +2486,7 @@ WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2515,9 +2515,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2534,12 +2534,12 @@ Las Palmas de Gran Canaria Spain Spanish L´Hospitalet de Llobregat Spain Spanish Lleida (Lérida) Spain Spanish Liupanshui China Chinese -Lianyungang China Chinese Liangcheng China Chinese +Lianyungang China Chinese Lengshuijiang China Chinese Lázaro Cárdenas Mexico Spanish -Lagos de Moreno Mexico Spanish Las Margaritas Mexico Spanish +Lagos de Moreno Mexico Spanish Lashio (Lasho) Myanmar Burmese Lalitapur Nepal Nepali Ludwigshafen am Rhein Germany German @@ -2549,9 +2549,9 @@ Lungtan Taiwan Min Lower Hutt New Zealand English Los Teques Venezuela Spanish Leninsk-Kuznetski Russian Federation Russian +Lexington-Fayette United States English Los Angeles United States English Long Beach United States English -Lexington-Fayette United States English Louisville United States English Little Rock United States English EXPLAIN @@ -2560,7 +2560,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -2590,7 +2590,7 @@ WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 SIMPLE City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name FROM City,Country WHERE City.Country=Country.Code AND Country.Name LIKE 'L%' AND City.Population > 100000; @@ -2619,9 +2619,9 @@ City.Name LIKE 'L%' AND Country.Population > 3000000 AND CountryLanguage.Percentage > 50 AND LENGTH(Language) < LENGTH(City.Name) - 2; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE CountryLanguage ALL PRIMARY,Percentage NULL NULL NULL 984 Using where -1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.CountryLanguage.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan -1 SIMPLE City ref Country Country 3 world.CountryLanguage.Country 18 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where +1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan SELECT City.Name, Country.Name, CountryLanguage.Language FROM City,Country,CountryLanguage WHERE City.Country=Country.Code AND @@ -2664,7 +2664,7 @@ WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AN City.Population > 100000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range PRIMARY,Name Name 52 NULL 10 Using index condition; Rowid-ordered scan -1 PRIMARY City ref Population,Country Country 3 world.Country.Code 18 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan +1 PRIMARY City ref Population,Country Country 3 world.Country.Code 17 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan SELECT Name FROM City WHERE City.Country IN (SELECT Code FROM Country WHERE Country.Name LIKE 'L%') AND City.Population > 100000; @@ -3044,7 +3044,7 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t3 ref t3_metaid,t3_formatid,t3_metaidformatid t3_metaidformatid 4 test.t1.metaid 1 Using index condition; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t4 eq_ref PRIMARY,t4_formatclassid,t4_formats_idx PRIMARY 4 test.t3.formatid 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t5 eq_ref PRIMARY,t5_formattypeid PRIMARY 4 test.t4.formatclassid 1 Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t9 index PRIMARY,t9_subgenreid,t9_metaid PRIMARY 8 NULL 2 Using where; Using index; Using join buffer (incremental, BNL join) +1 SIMPLE t9 ref PRIMARY,t9_subgenreid,t9_metaid t9_metaid 4 test.t1.metaid 2 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t10 eq_ref PRIMARY,t10_genreid PRIMARY 4 test.t9.subgenreid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t10.genreid 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan SELECT t1.uniquekey, t1.xml AS affiliateXml, @@ -3665,8 +3665,8 @@ where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where 1 SIMPLE t2 ref idx idx 5 test.t1.b 1 -1 SIMPLE t3 ref idx idx 5 test.t1.d 1 1 SIMPLE t4 ref idx idx 5 test.t1.c 1 +1 SIMPLE t3 ref idx idx 5 test.t1.d 1 select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4 where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c; a b c d e f g @@ -3678,8 +3678,8 @@ where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 7 Using where 1 SIMPLE t2 ref idx idx 5 test.t1.b 1 Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan -1 SIMPLE t3 ref idx idx 5 test.t1.d 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t4 ref idx idx 5 test.t1.c 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t3 ref idx idx 5 test.t1.d 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan select t1.a, t1.b, t1.c, t1.d, t2.e, t3.f, t4.g from t1,t2,t3,t4 where t2.b=t1.b and t3.d=t1.d and t4.c=t1.c; a b c d e f g @@ -6033,12 +6033,12 @@ drop table t1; SET join_cache_level = 3; # The following should have # - table order PROFILING,user, -# - table user accessed with hash_ALL: +# - table db accessed with hash_ALL: explain -SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR; +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.db WHERE Select_priv = PAGE_FAULTS_MINOR; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL Using where -1 SIMPLE user hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 4 Using where; Using join buffer (flat, BNLH join) +1 SIMPLE db hash_ALL NULL #hash#$hj 1 information_schema.PROFILING.PAGE_FAULTS_MINOR 2 Using where; Using join buffer (flat, BNLH join) set join_cache_level=default; create table t1 (c1 date not null, key (c1)) engine=innodb; insert t1 values ('2017-12-27'); diff --git a/mysql-test/main/join_cache.test b/mysql-test/main/join_cache.test index df89fc30dee..046dcfcf3cb 100644 --- a/mysql-test/main/join_cache.test +++ b/mysql-test/main/join_cache.test @@ -3970,9 +3970,9 @@ drop table t1; SET join_cache_level = 3; --echo # The following should have --echo # - table order PROFILING,user, ---echo # - table user accessed with hash_ALL: +--echo # - table db accessed with hash_ALL: explain -SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user WHERE password_expired = PAGE_FAULTS_MINOR; +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.db WHERE Select_priv = PAGE_FAULTS_MINOR; set join_cache_level=default; diff --git a/mysql-test/main/join_nested_jcl6.result b/mysql-test/main/join_nested_jcl6.result index de5ebfbe989..6b1901d8642 100644 --- a/mysql-test/main/join_nested_jcl6.result +++ b/mysql-test/main/join_nested_jcl6.result @@ -2055,7 +2055,7 @@ ON (t5.b=t8.b); id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t5 ALL NULL NULL NULL NULL 2 1 SIMPLE t6 ALL NULL NULL NULL NULL 1 Using join buffer (flat, BNL join) -1 SIMPLE t7 ref b_i b_i 5 const 0 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan +1 SIMPLE t7 ref b_i b_i 5 const 1 Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan 1 SIMPLE t8 ALL b_i NULL NULL NULL 1 Using where; Using join buffer (incremental, BNL join) SELECT t5.a,t5.b,t6.a,t6.b,t7.a,t7.b,t8.a,t8.b FROM t5 LEFT JOIN diff --git a/mysql-test/main/join_outer.result b/mysql-test/main/join_outer.result index 9245111369f..bda5d266f98 100644 --- a/mysql-test/main/join_outer.result +++ b/mysql-test/main/join_outer.result @@ -1790,8 +1790,11 @@ insert into t3 values (11, 100), (33, 301), (44, 402), (11, 102), (11, 101); insert into t3 values (22, 100), (53, 301), (64, 402), (22, 102), (22, 101); analyze table t1,t2,t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK flush status; select sum(t3.b) from t1 left join t3 on t3.a=t1.a and t1.a is not null; @@ -1800,7 +1803,7 @@ sum(t3.b) show status like "handler_read%"; Variable_name Value Handler_read_first 0 -Handler_read_key 4 +Handler_read_key 10 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 @@ -1815,7 +1818,7 @@ sum(t3.b) show status like "handler_read%"; Variable_name Value Handler_read_first 0 -Handler_read_key 4 +Handler_read_key 6 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 @@ -2511,4 +2514,72 @@ ORDER BY tb1.i1; v2 DROP TABLE t1,t2; # end of 5.5 tests +# +# MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 values (0),(1); +create table t3 (a int, b int, key(a)); +insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C; +# Uses range for table t3: +explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 +1 SIMPLE t3 range a a 5 NULL 5 Using where +# This must use range for table t3, too: +explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 +1 SIMPLE t3 range a a 5 NULL 5 Using where +# +# .. part 2: make sure condition selectivity can use the condition too. +# +alter table t3 drop key a; +set @tmp1=@@optimizer_use_condition_selectivity; +set @tmp2=@@use_stat_tables; +set @tmp3=@@histogram_size; +set use_stat_tables=preferably; +set optimizer_use_condition_selectivity=4; +set histogram_size=100; +analyze table t3 persistent for all; +Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +# t3.filtered is less than 100%: +explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 0.99 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5) where 1 +# t3.filtered must less than 100%, too: +explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 +1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 0.99 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t3` join `test`.`t2`) on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5) where 1 +drop table t1,t2,t3; +set optimizer_use_condition_selectivity= @tmp1; +set use_stat_tables= @tmp2; +set histogram_size= @tmp3; +# Another test +CREATE TABLE t1 (i1 int) ; +CREATE TABLE t2 (pk int NOT NULL PRIMARY KEY) ; +CREATE TABLE t3 (pk int NOT NULL, i1 int, PRIMARY KEY (pk)) ; +INSERT INTO t3 VALUES (2, NULL); +CREATE TABLE t4 (pk int NOT NULL, i1 int, PRIMARY KEY (pk), KEY i1 (i1)) ; +CREATE VIEW v4 AS SELECT * FROM t4; +SELECT 1 +FROM t3 RIGHT JOIN t1 ON t3.i1 = t1.i1 +LEFT JOIN v4 +RIGHT JOIN t2 ON v4.i1 = t2.pk ON t1.i1 = t2.pk +WHERE t3.pk IN (2); +1 +drop view v4; +drop table t1,t2,t3,t4; SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/join_outer.test b/mysql-test/main/join_outer.test index 6d20c089bd9..82127397bee 100644 --- a/mysql-test/main/join_outer.test +++ b/mysql-test/main/join_outer.test @@ -2042,4 +2042,64 @@ DROP TABLE t1,t2; --echo # end of 5.5 tests +--echo # +--echo # MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins +--echo # +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t2(a int); +insert into t2 values (0),(1); + +create table t3 (a int, b int, key(a)); +insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C; + +--echo # Uses range for table t3: +explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5; + +--echo # This must use range for table t3, too: +explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; + +--echo # +--echo # .. part 2: make sure condition selectivity can use the condition too. +--echo # +alter table t3 drop key a; +set @tmp1=@@optimizer_use_condition_selectivity; +set @tmp2=@@use_stat_tables; +set @tmp3=@@histogram_size; +set use_stat_tables=preferably; +set optimizer_use_condition_selectivity=4; +set histogram_size=100; + +analyze table t3 persistent for all; + +--echo # t3.filtered is less than 100%: +explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5; + +--echo # t3.filtered must less than 100%, too: +explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; + +drop table t1,t2,t3; +set optimizer_use_condition_selectivity= @tmp1; +set use_stat_tables= @tmp2; +set histogram_size= @tmp3; + +--echo # Another test +CREATE TABLE t1 (i1 int) ; +CREATE TABLE t2 (pk int NOT NULL PRIMARY KEY) ; +CREATE TABLE t3 (pk int NOT NULL, i1 int, PRIMARY KEY (pk)) ; +INSERT INTO t3 VALUES (2, NULL); + +CREATE TABLE t4 (pk int NOT NULL, i1 int, PRIMARY KEY (pk), KEY i1 (i1)) ; +CREATE VIEW v4 AS SELECT * FROM t4; + +SELECT 1 +FROM t3 RIGHT JOIN t1 ON t3.i1 = t1.i1 + LEFT JOIN v4 + RIGHT JOIN t2 ON v4.i1 = t2.pk ON t1.i1 = t2.pk +WHERE t3.pk IN (2); + +drop view v4; +drop table t1,t2,t3,t4; + SET optimizer_switch=@save_optimizer_switch; diff --git a/mysql-test/main/join_outer_innodb.result b/mysql-test/main/join_outer_innodb.result index 6f3fb09329d..9ab8bde1236 100644 --- a/mysql-test/main/join_outer_innodb.result +++ b/mysql-test/main/join_outer_innodb.result @@ -440,18 +440,18 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index 1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index 1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 -1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where 1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where 1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index +1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index 1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index -1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where +1 SIMPLE l3 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where 1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index 1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where -1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) explain select * from v1; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 ALL a4,a6,a5,a7 NULL NULL NULL 3 Using where @@ -462,18 +462,18 @@ id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t6 eq_ref PRIMARY PRIMARY 4 test.t1.a3 1 Using where; Using index 1 SIMPLE t8 eq_ref PRIMARY PRIMARY 1 test.t1.a4 1 Using index 1 SIMPLE t7 eq_ref PRIMARY PRIMARY 1 test.t1.a7 1 -1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 1 SIMPLE t11 eq_ref PRIMARY PRIMARY 4 test.t1.a5 1 1 SIMPLE t12 eq_ref PRIMARY PRIMARY 4 test.t11.k3 1 Using where 1 SIMPLE l2 eq_ref PRIMARY PRIMARY 4 test.t11.k4 1 Using where 1 SIMPLE t13 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index +1 SIMPLE t9 ref PRIMARY PRIMARY 1 test.t1.a4 1 1 SIMPLE l4 eq_ref PRIMARY PRIMARY 4 test.t13.m2 1 Using where; Using index 1 SIMPLE m2 ref PRIMARY,m3 PRIMARY 4 test.t1.a1 1 Using where; Using index -1 SIMPLE l3 eq_ref PRIMARY PRIMARY 4 test.m2.m2 1 Using where +1 SIMPLE l3 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (incremental, BNL join) 1 SIMPLE t14 eq_ref PRIMARY PRIMARY 2 test.t1.a8 1 Using where 1 SIMPLE t15 eq_ref PRIMARY PRIMARY 2 test.t1.a9 1 Using where; Using index 1 SIMPLE t16 ref PRIMARY PRIMARY 2 test.t15.o1 1 Using where -1 SIMPLE t10 ALL PRIMARY NULL NULL NULL 3 Using where; Using join buffer (flat, BNL join) drop view v1; drop table t1,t2,t3,t4,t5,t6,t7,t8,t9,t10,t11,t12,t13,t14,t15,t16; # diff --git a/mysql-test/main/join_outer_jcl6.result b/mysql-test/main/join_outer_jcl6.result index cb582b1399f..01e7ec9d42f 100644 --- a/mysql-test/main/join_outer_jcl6.result +++ b/mysql-test/main/join_outer_jcl6.result @@ -1801,8 +1801,11 @@ insert into t3 values (11, 100), (33, 301), (44, 402), (11, 102), (11, 101); insert into t3 values (22, 100), (53, 301), (64, 402), (22, 102), (22, 101); analyze table t1,t2,t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK flush status; select sum(t3.b) from t1 left join t3 on t3.a=t1.a and t1.a is not null; @@ -1811,7 +1814,7 @@ sum(t3.b) show status like "handler_read%"; Variable_name Value Handler_read_first 0 -Handler_read_key 4 +Handler_read_key 10 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 @@ -1826,7 +1829,7 @@ sum(t3.b) show status like "handler_read%"; Variable_name Value Handler_read_first 0 -Handler_read_key 4 +Handler_read_key 6 Handler_read_last 0 Handler_read_next 5 Handler_read_prev 0 @@ -2522,6 +2525,74 @@ ORDER BY tb1.i1; v2 DROP TABLE t1,t2; # end of 5.5 tests +# +# MDEV-17518: Range optimization doesn't use ON expressions from nested outer joins +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 values (0),(1); +create table t3 (a int, b int, key(a)); +insert into t3 select A.a + B.a* 10 + C.a * 100, 12345 from t1 A, t1 B, t1 C; +# Uses range for table t3: +explain select * from t1 left join t3 on t1.a=t3.b and t3.a<5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 +1 SIMPLE t3 range a a 5 NULL 5 Using where; Rowid-ordered scan; Using join buffer (flat, BNL join) +# This must use range for table t3, too: +explain select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 Using join buffer (flat, BNL join) +1 SIMPLE t3 range a a 5 NULL 5 Using where; Rowid-ordered scan; Using join buffer (incremental, BNL join) +# +# .. part 2: make sure condition selectivity can use the condition too. +# +alter table t3 drop key a; +set @tmp1=@@optimizer_use_condition_selectivity; +set @tmp2=@@use_stat_tables; +set @tmp3=@@histogram_size; +set use_stat_tables=preferably; +set optimizer_use_condition_selectivity=4; +set histogram_size=100; +analyze table t3 persistent for all; +Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected +test.t3 analyze status OK +# t3.filtered is less than 100%: +explain extended select * from t1 left join t3 on t1.a=t3.b and t3.a<5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t3 hash_ALL NULL #hash#$hj 5 test.t1.a 1000 0.99 Using where; Using join buffer (flat, BNLH join) +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t1` left join `test`.`t3` on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5 and `test`.`t1`.`a` is not null) where 1 +# t3.filtered must less than 100%, too: +explain extended select * from t1 left join (t3 join t2) on t1.a=t3.b and t3.a<5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 +1 SIMPLE t2 ALL NULL NULL NULL NULL 2 100.00 Using where +1 SIMPLE t3 ALL NULL NULL NULL NULL 1000 0.99 Using where +Warnings: +Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b`,`test`.`t2`.`a` AS `a` from `test`.`t1` left join (`test`.`t3` join `test`.`t2`) on(`test`.`t3`.`b` = `test`.`t1`.`a` and `test`.`t3`.`a` < 5 and `test`.`t1`.`a` is not null) where 1 +drop table t1,t2,t3; +set optimizer_use_condition_selectivity= @tmp1; +set use_stat_tables= @tmp2; +set histogram_size= @tmp3; +# Another test +CREATE TABLE t1 (i1 int) ; +CREATE TABLE t2 (pk int NOT NULL PRIMARY KEY) ; +CREATE TABLE t3 (pk int NOT NULL, i1 int, PRIMARY KEY (pk)) ; +INSERT INTO t3 VALUES (2, NULL); +CREATE TABLE t4 (pk int NOT NULL, i1 int, PRIMARY KEY (pk), KEY i1 (i1)) ; +CREATE VIEW v4 AS SELECT * FROM t4; +SELECT 1 +FROM t3 RIGHT JOIN t1 ON t3.i1 = t1.i1 +LEFT JOIN v4 +RIGHT JOIN t2 ON v4.i1 = t2.pk ON t1.i1 = t2.pk +WHERE t3.pk IN (2); +1 +drop view v4; +drop table t1,t2,t3,t4; SET optimizer_switch=@save_optimizer_switch; set join_cache_level=default; show variables like 'join_cache_level'; diff --git a/mysql-test/main/kill.result b/mysql-test/main/kill.result index dc1cb9252da..4775d111b79 100644 --- a/mysql-test/main/kill.result +++ b/mysql-test/main/kill.result @@ -324,7 +324,7 @@ connection blocker; lock tables t1 read; connection ddl; # Let us mark locked table t1 as old -flush tables; +flush tables t1; connection dml; select * from t1; connection default; diff --git a/mysql-test/main/kill.test b/mysql-test/main/kill.test index b6000ffced1..059d8d40b11 100644 --- a/mysql-test/main/kill.test +++ b/mysql-test/main/kill.test @@ -538,18 +538,18 @@ connection blocker; lock tables t1 read; connection ddl; --echo # Let us mark locked table t1 as old ---send flush tables +--send flush tables t1 connection dml; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" and - info = "flush tables"; + where state = "Waiting for table metadata lock" and + info = "flush tables t1"; --source include/wait_condition.inc --send select * from t1 connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" and + where state = "Waiting for table metadata lock" and info = "select * from t1"; --source include/wait_condition.inc --replace_result $ID2 ID2 diff --git a/mysql-test/main/limit_rows_examined.result b/mysql-test/main/limit_rows_examined.result index 8458e063d97..71b99d066ff 100644 --- a/mysql-test/main/limit_rows_examined.result +++ b/mysql-test/main/limit_rows_examined.result @@ -49,10 +49,11 @@ explain select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index -1 SIMPLE t2i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6; c1 c2 bb bb +cc cc Warnings: Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete set @@join_cache_level=6; @@ -69,10 +70,11 @@ explain select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1i index PRIMARY PRIMARY 2 NULL 4 Using index -1 SIMPLE t2i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index; Using join buffer (flat, BNL join) +1 SIMPLE t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index select * from t1i, t2i where c1 = c2 LIMIT ROWS EXAMINED 6; c1 c2 bb bb +cc cc Warnings: Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete Mix LIMIT ROWS EXAMINED with LIMIT @@ -254,12 +256,13 @@ where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 6; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index -1 PRIMARY t2i index PRIMARY PRIMARY 2 NULL 4 Using where; Using index; Using join buffer (flat, BNL join) +1 PRIMARY t2i eq_ref PRIMARY PRIMARY 2 test.t1i.c1 1 Using index select * from t1i where c1 IN (select * from t2i where c2 > ' ') LIMIT ROWS EXAMINED 6; c1 bb +cc Warnings: Warning 1931 Query execution was interrupted. The query examined at least 7 rows, which exceeds LIMIT ROWS EXAMINED (6). The query result may be incomplete Subqueries with IN-TO-EXISTS @@ -836,7 +839,7 @@ WHERE c = (SELECT MAX(b) FROM t2) LIMIT ROWS EXAMINED 3; (SELECT MAX(c) FROM t1, t2) Warnings: -Warning 1931 Query execution was interrupted. The query examined at least 10 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete +Warning 1931 Query execution was interrupted. The query examined at least 12 rows, which exceeds LIMIT ROWS EXAMINED (3). The query result may be incomplete drop table t1, t2; MDEV-178: LIMIT ROWS EXAMINED: Assertion `0' failed in net_end_statement(THD*) on the diff --git a/mysql-test/main/loaddata.result b/mysql-test/main/loaddata.result index 98b8f2de4a5..4c5cee0aa25 100644 --- a/mysql-test/main/loaddata.result +++ b/mysql-test/main/loaddata.result @@ -45,10 +45,10 @@ load data infile '../../std_data/loaddata3.dat' into table t1 fields terminated Warnings: Note 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 2 -Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 +Warning 1366 Incorrect integer value: 'error ' for column `test`.`t1`.`a` at row 3 Warning 1262 Row 3 was truncated; it contained more data than there were input columns Note 1265 Data truncated for column 'a' at row 4 -Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 5 +Warning 1366 Incorrect integer value: 'wrong end ' for column `test`.`t1`.`a` at row 5 Warning 1262 Row 5 was truncated; it contained more data than there were input columns select * from t1; a b @@ -64,7 +64,7 @@ Note 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 2 Note 1265 Data truncated for column 'a' at row 3 Warning 1366 Incorrect integer value: ' -' for column 'a' at row 4 +' for column `test`.`t1`.`a` at row 4 Warning 1261 Row 4 doesn't contain data for all columns select * from t1; a b diff --git a/mysql-test/main/lock.result b/mysql-test/main/lock.result index 0805fd45864..6edb86bfa3f 100644 --- a/mysql-test/main/lock.result +++ b/mysql-test/main/lock.result @@ -136,7 +136,7 @@ select * from t1; ERROR HY000: Table 't1' was not locked with LOCK TABLES unlock tables; create or replace view v_bug5719 as select * from t1; -lock tables v_bug5719 write; +lock tables v_bug5719 read; select * from v_bug5719; a @@ -303,7 +303,7 @@ create table t2 (j int); # # Try to perform DDL on table which is locked through view. create view v1 as select * from t2; -lock tables t1 write, v1 write; +lock tables t1 write, v1 read; flush table t2; ERROR HY000: Table 't2' was locked with a READ lock and can't be updated drop table t2; @@ -457,6 +457,7 @@ connection default; LOCK TABLE t1 WRITE; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date connection con2; LOCK TABLE t2 WRITE; @@ -499,7 +500,7 @@ connect con1,localhost,root,,test; LOCK TABLE t2 WRITE; SET lock_wait_timeout= 1; FLUSH TABLES; -ERROR HY000: Lock wait timeout exceeded; try restarting transaction +FLUSH TABLES t2; UNLOCK TABLES; disconnect con1; connection default; diff --git a/mysql-test/main/lock.test b/mysql-test/main/lock.test index 92ab8294273..8a59f4082b1 100644 --- a/mysql-test/main/lock.test +++ b/mysql-test/main/lock.test @@ -192,7 +192,7 @@ drop view v_bug5719; select * from t1; unlock tables; create or replace view v_bug5719 as select * from t1; -lock tables v_bug5719 write; +lock tables v_bug5719 read; select * from v_bug5719; --echo --echo Allowed to use an underlying table under LOCK TABLES @@ -368,7 +368,7 @@ create table t2 (j int); --echo # --echo # Try to perform DDL on table which is locked through view. create view v1 as select * from t2; -lock tables t1 write, v1 write; +lock tables t1 write, v1 read; --error ER_TABLE_NOT_LOCKED_FOR_WRITE flush table t2; --error ER_TABLE_NOT_LOCKED_FOR_WRITE @@ -609,8 +609,8 @@ LOCK TABLE t1 READ; --connect (con1,localhost,root,,test) LOCK TABLE t2 WRITE; SET lock_wait_timeout= 1; ---error ER_LOCK_WAIT_TIMEOUT FLUSH TABLES; +FLUSH TABLES t2; # Cleanup UNLOCK TABLES; diff --git a/mysql-test/main/lock_multi.result b/mysql-test/main/lock_multi.result index cadd182f4e3..30cd63e60ed 100644 --- a/mysql-test/main/lock_multi.result +++ b/mysql-test/main/lock_multi.result @@ -118,17 +118,17 @@ LOCK TABLES columns_priv WRITE, db WRITE, user WRITE; FLUSH TABLES; connection reader; USE mysql; -SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; +SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1; connection locker; -OPTIMIZE TABLES columns_priv, db, user; +OPTIMIZE TABLES columns_priv, db, global_priv; Table Op Msg_type Msg_text mysql.columns_priv optimize status OK mysql.db optimize status OK -mysql.user optimize status OK +mysql.global_priv optimize status OK UNLOCK TABLES; connection reader; -Select_priv -N +host +localhost USE test; connection locker; use test; @@ -218,6 +218,7 @@ connection con2; unlock tables; connection con3; a +connection con4; connection default; disconnect con5; disconnect con4; @@ -247,6 +248,7 @@ flush table t2; connection default; unlock tables; connection con1; +connection con2; # # LOCK TABLES .. WRITE # @@ -299,7 +301,7 @@ connection default; alter table t1 add column j int; connect insert,localhost,root,,test,,; connection insert; -insert into t1 values (1,2);; +insert into t1 values (1,2); connection default; unlock tables; connection flush; @@ -394,15 +396,17 @@ DROP VIEW IF EXISTS v1; # # Test 1: LOCK TABLES v1 WRITE, t1 READ; # -# Thanks to the fact that we no longer allow DDL on tables -# which are locked for write implicitly, the exact scenario -# in which assert was failing is no longer repeatable. CREATE TABLE t1 ( f1 integer ); CREATE VIEW v1 AS SELECT f1 FROM t1 ; +# Connection 2 +connect con2,localhost,root; LOCK TABLES v1 WRITE, t1 READ; FLUSH TABLE t1; -ERROR HY000: Table 't1' was locked with a READ lock and can't be updated -UNLOCK TABLES; +disconnect con2; +# Connection 1 +connection default; +LOCK TABLES t1 WRITE; +FLUSH TABLE t1; DROP TABLE t1; DROP VIEW v1; # @@ -529,8 +533,9 @@ connect con3, localhost, root; connection default; LOCK TABLE t1 READ; connection con3; -# Sending: FLUSH TABLES; +# Sending: +FLUSH TABLES t1; connection con2; SELECT * FROM t1; ERROR HY000: Lock wait timeout exceeded; try restarting transaction diff --git a/mysql-test/main/lock_multi.test b/mysql-test/main/lock_multi.test index 013784e7c3b..5cc7219b01d 100644 --- a/mysql-test/main/lock_multi.test +++ b/mysql-test/main/lock_multi.test @@ -191,18 +191,18 @@ connection reader; USE mysql; # Note: This must be a multi-table select, otherwise the deadlock will not occur send -SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1; +SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1; # connection locker; # Sleep a bit till the select of connection reader is in work and hangs let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist WHERE state = "Waiting for table metadata lock" AND info = - "SELECT user.Select_priv FROM user, db WHERE user.user = db.user LIMIT 1"; + "SELECT global_priv.host FROM global_priv, db WHERE global_priv.user = db.user LIMIT 1"; --source include/wait_condition.inc # Make test case independent from earlier grants. --replace_result "Table is already up to date" "OK" -OPTIMIZE TABLES columns_priv, db, user; +OPTIMIZE TABLES columns_priv, db, global_priv; UNLOCK TABLES; # connection reader; @@ -229,7 +229,7 @@ connection writer; # Sleep a bit till the flush of connection locker is in work and hangs let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "FLUSH TABLES WITH READ LOCK"; --source include/wait_condition.inc # This must not block. @@ -261,7 +261,7 @@ connection writer; # Sleep a bit till the flush of connection locker is in work and hangs let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "FLUSH TABLES WITH READ LOCK"; --source include/wait_condition.inc --error ER_TABLE_NOT_LOCKED @@ -298,10 +298,10 @@ DROP DATABASE mysqltest_1; # When fixed: Reject dropping db because of the read lock. connection con1; # Wait a bit so that the session con2 is in state -# "Waiting for global read lock" +# "Waiting for backup lock" let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" + where state = "Waiting for backup lock" and info = "DROP DATABASE mysqltest_1"; --source include/wait_condition.inc --error ER_CANT_UPDATE_WITH_READLOCK @@ -377,7 +377,7 @@ send flush tables with read lock; connection con5; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc --echo # global read lock is taken @@ -386,14 +386,19 @@ send select * from t2 for update; connection con5; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "select * from t2 for update"; --source include/wait_condition.inc --echo # waiting for release of read lock connection con4; --echo # would hang and later cause a deadlock -flush tables t2; +--send flush tables t2 connection con1; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "flush tables t2"; +--source include/wait_condition.inc --echo # clean up unlock tables; connection con2; @@ -401,6 +406,8 @@ connection con2; unlock tables; connection con3; --reap +connection con4; +--reap connection default; disconnect con5; disconnect con4; @@ -432,16 +439,23 @@ send update t2 set a = 1; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "update t2 set a = 1"; --source include/wait_condition.inc --echo # statement is waiting for release of read lock connection con2; -flush table t2; +--send flush table t2 connection default; +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where state = "Waiting for table metadata lock" and + info = "flush table t2"; +--source include/wait_condition.inc unlock tables; connection con1; --reap +connection con2; +--reap --echo # --echo # LOCK TABLES .. WRITE @@ -454,7 +468,7 @@ send lock tables t2 write; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "lock tables t2 write"; --source include/wait_condition.inc --echo # statement is waiting for release of read lock @@ -542,7 +556,7 @@ connection flush; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc alter table t1 add column j int; @@ -550,14 +564,14 @@ connect (insert,localhost,root,,test,,); connection insert; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "flush tables with read lock"; --source include/wait_condition.inc ---send insert into t1 values (1,2); +--send insert into t1 values (1,2) connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for table metadata lock" and info = "insert into t1 values (1,2)"; --source include/wait_condition.inc unlock tables; @@ -565,7 +579,7 @@ connection flush; --reap let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock" and + where state = "Waiting for backup lock" and info = "insert into t1 values (1,2)"; --source include/wait_condition.inc select * from t1; @@ -598,12 +612,12 @@ connection flush; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock"; + where state = "Waiting for backup lock"; --source include/wait_condition.inc flush tables; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock"; + where state = "Waiting for backup lock"; --source include/wait_condition.inc unlock tables; connection flush; @@ -664,12 +678,12 @@ connection flush; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock"; + where state = "Waiting for backup lock"; --source include/wait_condition.inc flush tables; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock"; + where state = "Waiting for backup lock"; --source include/wait_condition.inc drop table t1; connection flush; @@ -734,17 +748,21 @@ DROP VIEW IF EXISTS v1; --echo # --echo # Test 1: LOCK TABLES v1 WRITE, t1 READ; --echo # ---echo # Thanks to the fact that we no longer allow DDL on tables ---echo # which are locked for write implicitly, the exact scenario ---echo # in which assert was failing is no longer repeatable. CREATE TABLE t1 ( f1 integer ); CREATE VIEW v1 AS SELECT f1 FROM t1 ; +--echo # Connection 2 +connect (con2,localhost,root); LOCK TABLES v1 WRITE, t1 READ; ---error ER_TABLE_NOT_LOCKED_FOR_WRITE FLUSH TABLE t1; -UNLOCK TABLES; +disconnect con2; +--source include/wait_until_disconnected.inc + +--echo # Connection 1 +connection default; +LOCK TABLES t1 WRITE; +FLUSH TABLE t1; # Assertion happened here # Cleanup DROP TABLE t1; @@ -927,13 +945,19 @@ connection default; LOCK TABLE t1 READ; connection con3; + +# first test that flush tables doesn't block +FLUSH TABLES; + +# Check the FLUSH TABLES t1 waits until table lock is released + --echo # Sending: ---send FLUSH TABLES +--send FLUSH TABLES t1 connection con2; let $wait_condition= SELECT COUNT(*) = 1 FROM information_schema.processlist - WHERE state = "Waiting for table flush" AND info = "FLUSH TABLES"; + WHERE state = "Waiting for table metadata lock" AND info = "FLUSH TABLES t1"; --source include/wait_condition.inc --error ER_LOCK_WAIT_TIMEOUT SELECT * FROM t1; diff --git a/mysql-test/main/lock_sync.result b/mysql-test/main/lock_sync.result index 93182399958..bbdc1d43ba5 100644 --- a/mysql-test/main/lock_sync.result +++ b/mysql-test/main/lock_sync.result @@ -782,7 +782,7 @@ SET DEBUG_SYNC= 'now WAIT_FOR opened'; SET DEBUG_SYNC= 'now SIGNAL dropped'; SET DEBUG_SYNC= 'now WAIT_FOR opened'; # Sending: -FLUSH TABLES; +FLUSH TABLES t1; connection default; # Waiting for FLUSH TABLES to be blocked. SET DEBUG_SYNC= 'now SIGNAL dropped'; diff --git a/mysql-test/main/lock_sync.test b/mysql-test/main/lock_sync.test index af8435f7fbb..1a8cd7bdbd3 100644 --- a/mysql-test/main/lock_sync.test +++ b/mysql-test/main/lock_sync.test @@ -974,12 +974,12 @@ SET DEBUG_SYNC= 'now WAIT_FOR opened'; SET DEBUG_SYNC= 'now SIGNAL dropped'; SET DEBUG_SYNC= 'now WAIT_FOR opened'; --echo # Sending: ---send FLUSH TABLES +--send FLUSH TABLES t1 connection default; --echo # Waiting for FLUSH TABLES to be blocked. let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES'; + WHERE state= 'Waiting for table metadata lock' AND info= 'FLUSH TABLES t1'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL dropped'; diff --git a/mysql-test/main/log_tables_upgrade.result b/mysql-test/main/log_tables_upgrade.result index df6ea72f3ca..8d7b08a11bd 100644 --- a/mysql-test/main/log_tables_upgrade.result +++ b/mysql-test/main/log_tables_upgrade.result @@ -19,6 +19,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -42,9 +43,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables diff --git a/mysql-test/main/lowercase_fs_off.result b/mysql-test/main/lowercase_fs_off.result index 91bd2924096..6ff8c1b7f93 100644 --- a/mysql-test/main/lowercase_fs_off.result +++ b/mysql-test/main/lowercase_fs_off.result @@ -83,6 +83,75 @@ CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET new.a= 1; RENAME TABLE t1 TO T1; ALTER TABLE T1 RENAME t1; DROP TABLE t1; +create database TEST; +create procedure TEST.pr() begin end; +create procedure test.pr() begin end; +Phase 1/7: Checking and upgrading mysql database +Processing databases +mysql +mysql.column_stats OK +mysql.columns_priv OK +mysql.db OK +mysql.event OK +mysql.func OK +mysql.global_priv OK +mysql.gtid_slave_pos OK +mysql.help_category OK +mysql.help_keyword OK +mysql.help_relation OK +mysql.help_topic OK +mysql.index_stats OK +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.plugin OK +mysql.proc OK +mysql.procs_priv OK +mysql.proxies_priv OK +mysql.roles_mapping OK +mysql.servers OK +mysql.table_stats OK +mysql.tables_priv OK +mysql.time_zone OK +mysql.time_zone_leap_second OK +mysql.time_zone_name OK +mysql.time_zone_transition OK +mysql.time_zone_transition_type OK +mysql.transaction_registry +Error : Unknown storage engine 'InnoDB' +error : Corrupt + +Repairing tables +mysql.innodb_index_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.innodb_table_stats +Error : Unknown storage engine 'InnoDB' +error : Corrupt +mysql.transaction_registry +Error : Unknown storage engine 'InnoDB' +error : Corrupt +Phase 2/7: Installing used storage engines... Skipped +Phase 3/7: Fixing views +mysql.user OK +Phase 4/7: Running 'mysql_fix_privilege_tables' +Phase 5/7: Fixing table and database names +Phase 6/7: Checking and upgrading tables +Processing databases +TEST +information_schema +mtr +mtr.global_suppressions OK +mtr.test_suppressions OK +performance_schema +test +Phase 7/7: Running 'FLUSH PRIVILEGES' +OK +drop procedure test.pr; +drop database TEST; create table t1 (a int); create trigger t1_bi before insert on t1 for each row set new.a= 1; show triggers like '%T1%'; diff --git a/mysql-test/main/lowercase_fs_off.test b/mysql-test/main/lowercase_fs_off.test index b8a9795db9a..7c5811f9cc3 100644 --- a/mysql-test/main/lowercase_fs_off.test +++ b/mysql-test/main/lowercase_fs_off.test @@ -105,6 +105,18 @@ RENAME TABLE t1 TO T1; ALTER TABLE T1 RENAME t1; DROP TABLE t1; +# +# MDEV-13912 mysql_upgrade: case (in)sensitivity for stored procedures +# +create database TEST; +create procedure TEST.pr() begin end; +create procedure test.pr() begin end; +--exec $MYSQL_UPGRADE --force 2>&1 +drop procedure test.pr; +drop database TEST; + +# End of 5.5 tests + # # MDEV-9014 SHOW TRIGGERS not case sensitive # @@ -113,4 +125,7 @@ create trigger t1_bi before insert on t1 for each row set new.a= 1; show triggers like '%T1%'; drop table t1; +let $datadir= `select @@datadir`; +remove_file $datadir/mysql_upgrade_info; + set GLOBAL sql_mode=default; diff --git a/mysql-test/main/lowercase_table.result b/mysql-test/main/lowercase_table.result index ac7d3e6bf7b..823ffa7696f 100644 --- a/mysql-test/main/lowercase_table.result +++ b/mysql-test/main/lowercase_table.result @@ -127,3 +127,7 @@ Database (mysql_TE%) mysql_test drop database mysql_TEST; End of 10.0 tests +create database db1; +create table t1 (a int); +drop database db1; +drop table t1; diff --git a/mysql-test/main/lowercase_table.test b/mysql-test/main/lowercase_table.test index c339105aae4..e0dcb6c36dd 100644 --- a/mysql-test/main/lowercase_table.test +++ b/mysql-test/main/lowercase_table.test @@ -118,3 +118,15 @@ show databases like "mysql_TE%"; drop database mysql_TEST; --echo End of 10.0 tests + +# +# MDEV-17148 DROP DATABASE throw "Directory not empty" after changed lower_case_table_names. +# + +let $datadir=`select @@datadir`; +create database db1; +create table t1 (a int); +copy_file $datadir/test/t1.frm $datadir/db1/T1.frm; +drop database db1; +drop table t1; + diff --git a/mysql-test/main/max_password_errors.result b/mysql-test/main/max_password_errors.result new file mode 100644 index 00000000000..020761b4f2e --- /dev/null +++ b/mysql-test/main/max_password_errors.result @@ -0,0 +1,45 @@ +set @old_max_password_errors=@@max_password_errors; +set global max_password_errors=2; +create user u identified by 'good_pass'; +connect(localhost,u,bas_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, bas_pass; +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, bad_pass; +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +connect(localhost,u,good_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, good_pass; +ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES' +connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, bad_pass; +ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES' +FLUSH PRIVILEGES; +connect con1, localhost, u, good_pass; +disconnect con1; +connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, bad_pass; +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +connect con1, localhost, u, good_pass; +disconnect con1; +connect(localhost,u,bad_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, u, bad_pass; +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +connect con1, localhost, u, good_pass; +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +ERROR 28000: Access denied for user 'u'@'localhost' (using password: YES) +ERROR HY000: User is blocked because of too many credential errors; unblock with 'FLUSH PRIVILEGES' +disconnect con1; +connection default; +FLUSH PRIVILEGES; +connect(localhost,root,bas_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, root, bas_pass; +ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES) +connect(localhost,root,bad_pass,test,MASTER_PORT,MASTER_SOCKET); +connect con1, localhost, root, bad_pass; +ERROR 28000: Access denied for user 'root'@'localhost' (using password: YES) +connect con1, localhost, u, good_pass; +disconnect con1; +connection default; +DROP USER u; +FLUSH PRIVILEGES; +set global max_password_errors=@old_max_password_errors; diff --git a/mysql-test/main/max_password_errors.test b/mysql-test/main/max_password_errors.test new file mode 100644 index 00000000000..1debca0258d --- /dev/null +++ b/mysql-test/main/max_password_errors.test @@ -0,0 +1,64 @@ +--source include/not_embedded.inc +set @old_max_password_errors=@@max_password_errors; +set global max_password_errors=2; +create user u identified by 'good_pass'; + +# Test that user is blocked after 'max_password_errors' bad passwords +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect(con1, localhost, u, bas_pass); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect (con1, localhost, u, bad_pass); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_USER_IS_BLOCKED; +connect(con1, localhost, u, good_pass); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_USER_IS_BLOCKED; +connect(con1, localhost, u, bad_pass); + + +# Test that FLUSH PRIVILEGES clears the error +FLUSH PRIVILEGES; +connect (con1, localhost, u, good_pass); +disconnect con1; + +# Test that good login clears the error +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect (con1, localhost, u, bad_pass); +connect (con1, localhost, u, good_pass); +disconnect con1; +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect (con1, localhost, u, bad_pass); +connect (con1, localhost, u, good_pass); + +# Test the behavior of change_user +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +change_user u,bad_pass; +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +change_user u,bad_pass; +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_USER_IS_BLOCKED; +change_user u,good_pass; +disconnect con1; + +connection default; +FLUSH PRIVILEGES; + +#Test that root@localhost is not blocked, with password errors +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect(con1, localhost, root, bas_pass); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +error ER_ACCESS_DENIED_ERROR; +connect (con1, localhost, root, bad_pass); +connect (con1, localhost, u, good_pass); +disconnect con1; +connection default; +DROP USER u; +FLUSH PRIVILEGES; +set global max_password_errors=@old_max_password_errors; \ No newline at end of file diff --git a/mysql-test/main/mdev-504.result b/mysql-test/main/mdev-504.result index 9b8b6795e0f..e34e57be6ed 100644 --- a/mysql-test/main/mdev-504.result +++ b/mysql-test/main/mdev-504.result @@ -1,3 +1,4 @@ +set @save_use_stat_tables=@@global.use_stat_tables; SET GLOBAL net_write_timeout = 900; CREATE TABLE A ( pk INTEGER AUTO_INCREMENT PRIMARY KEY, @@ -20,5 +21,5 @@ connection default; DROP TABLE A; DROP PROCEDURE p_analyze; DROP FUNCTION rnd3; -SET GLOBAL use_stat_tables = DEFAULT; +SET GLOBAL use_stat_tables = @save_use_stat_tables; SET GLOBAL net_write_timeout = DEFAULT; diff --git a/mysql-test/main/mdev-504.test b/mysql-test/main/mdev-504.test index 551c21c37d0..277b5a038a0 100644 --- a/mysql-test/main/mdev-504.test +++ b/mysql-test/main/mdev-504.test @@ -1,6 +1,8 @@ --source include/not_valgrind.inc --source include/no_protocol.inc +set @save_use_stat_tables=@@global.use_stat_tables; + SET GLOBAL net_write_timeout = 900; CREATE TABLE A ( @@ -76,5 +78,5 @@ while ($trial) DROP TABLE A; DROP PROCEDURE p_analyze; DROP FUNCTION rnd3; -SET GLOBAL use_stat_tables = DEFAULT; +SET GLOBAL use_stat_tables = @save_use_stat_tables; SET GLOBAL net_write_timeout = DEFAULT; diff --git a/mysql-test/main/mdev13607.result b/mysql-test/main/mdev13607.result index 08848bc645b..4d8f252478c 100644 --- a/mysql-test/main/mdev13607.result +++ b/mysql-test/main/mdev13607.result @@ -14,8 +14,11 @@ CREATE TABLE t3 (id INT) ENGINE=InnoDB; INSERT INTO t3 VALUES (1),(2); ANALYZE TABLE t1, t2, t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK explain SELECT * FROM (SELECT p1.* FROM t1 p1 NATURAL JOIN t2 r1 NATURAL JOIN t3 d1 NATURAL JOIN t1 p2 NATURAL JOIN t2 r2 NATURAL JOIN t3 d2 NATURAL JOIN t1 p3 NATURAL JOIN t2 r3 NATURAL JOIN t3 d3 NATURAL JOIN t1 p4 NATURAL JOIN t2 r4 NATURAL JOIN t3 d4 NATURAL JOIN t1 p5 NATURAL JOIN t2 r5 NATURAL JOIN t3 d5 NATURAL JOIN t1 p6 NATURAL JOIN t2 r6 NATURAL JOIN t3 d6 NATURAL JOIN t1 p7 NATURAL JOIN t2 r7 NATURAL JOIN t3 d7 NATURAL JOIN t1 p8 NATURAL JOIN t2 r8 NATURAL JOIN t3 d8 NATURAL JOIN t1 p9 ) gp_1 diff --git a/mysql-test/main/mdl.result b/mysql-test/main/mdl.result index d93bfd5c729..883f35674c0 100644 --- a/mysql-test/main/mdl.result +++ b/mysql-test/main/mdl.result @@ -6,17 +6,85 @@ # failed in MDL_context::upgrade_shared_lock # CREATE TABLE t1(a INT) ENGINE=InnoDB; +CREATE TABLE t3(a INT) ENGINE=myisam; LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME -MDL_INTENTION_EXCLUSIVE Global read lock +MDL_BACKUP_TRANS_DML Backup lock MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 UNLOCK TABLES; LOCK TABLES t1 AS t2 READ, t1 WRITE CONCURRENT; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME -MDL_INTENTION_EXCLUSIVE Global read lock +MDL_BACKUP_TRANS_DML Backup lock MDL_SHARED_WRITE Table metadata lock test t1 MDL_SHARED_READ_ONLY Table metadata lock test t1 UNLOCK TABLES; -DROP TABLE t1; +LOCK TABLES t1 WRITE CONCURRENT, t3 WRITE; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_SHARED_WRITE Table metadata lock test t1 +MDL_SHARED_NO_READ_WRITE Table metadata lock test t3 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +UNLOCK TABLES; +LOCK TABLES t3 WRITE, t1 WRITE CONCURRENT; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_BACKUP_DML Backup lock +MDL_SHARED_WRITE Table metadata lock test t1 +MDL_SHARED_NO_READ_WRITE Table metadata lock test t3 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +UNLOCK TABLES; +LOCK TABLES t1 WRITE, mysql.user WRITE; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_SHARED_NO_READ_WRITE Table metadata lock mysql user +MDL_SHARED_NO_READ_WRITE Table metadata lock test t1 +MDL_INTENTION_EXCLUSIVE Schema metadata lock mysql +MDL_SHARED_NO_READ_WRITE Table metadata lock mysql global_priv +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +UNLOCK TABLES; +LOCK TABLES mysql.general_log WRITE; +ERROR HY000: You can't use locks with log tables +LOCK TABLES t1 WRITE,information_schema.tables READ; +UNLOCK TABLES; +DROP TABLE t1,t3; +# +# Check MDL locks taken for different kind of tables by open +# +CREATE TABLE t1(a INT) ENGINE=InnoDB; +CREATE TABLE t3(a INT) ENGINE=myisam; +connect locker,localhost,root,,; +connection default; +FLUSH TABLES WITH READ LOCK; +connection locker; +insert into t1 values (1); +connection default; +connection default; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_FTWRL2 Backup lock +MDL_SHARED_WRITE Table metadata lock test t1 +unlock tables; +connection locker; +unlock tables; +connection default; +FLUSH TABLES WITH READ LOCK; +connection locker; +insert into t3 values (2); +connection default; +connection default; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_FTWRL2 Backup lock +MDL_SHARED_WRITE Table metadata lock test t3 +unlock tables; +connection locker; +unlock tables; +connection default; +disconnect locker; +DROP TABLE t1,t3; diff --git a/mysql-test/main/mdl.test b/mysql-test/main/mdl.test index b90c74a8f7f..23a862f5212 100644 --- a/mysql-test/main/mdl.test +++ b/mysql-test/main/mdl.test @@ -10,10 +10,72 @@ --echo # CREATE TABLE t1(a INT) ENGINE=InnoDB; +CREATE TABLE t3(a INT) ENGINE=myisam; LOCK TABLES t1 WRITE CONCURRENT, t1 AS t2 READ; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; UNLOCK TABLES; LOCK TABLES t1 AS t2 READ, t1 WRITE CONCURRENT; SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; UNLOCK TABLES; -DROP TABLE t1; +LOCK TABLES t1 WRITE CONCURRENT, t3 WRITE; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +UNLOCK TABLES; +LOCK TABLES t3 WRITE, t1 WRITE CONCURRENT; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +UNLOCK TABLES; +LOCK TABLES t1 WRITE, mysql.user WRITE; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +UNLOCK TABLES; +--error ER_CANT_LOCK_LOG_TABLE +LOCK TABLES mysql.general_log WRITE; +# The following may work in embedded server +--error 0,ER_DBACCESS_DENIED_ERROR +LOCK TABLES t1 WRITE,information_schema.tables READ; +UNLOCK TABLES; +DROP TABLE t1,t3; + +--echo # +--echo # Check MDL locks taken for different kind of tables by open +--echo # + +CREATE TABLE t1(a INT) ENGINE=InnoDB; +CREATE TABLE t3(a INT) ENGINE=myisam; +connect (locker,localhost,root,,); +connection default; + +FLUSH TABLES WITH READ LOCK; +connection locker; +--send insert into t1 values (1) +connection default; +# Wait till above update gets blocked on a user lock. +let $wait_condition= + select count(*) > 0 from information_schema.processlist + where state = "Waiting for backup lock"; +--source include/wait_condition.inc +connection default; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +unlock tables; +connection locker; +--reap +unlock tables; +connection default; + +FLUSH TABLES WITH READ LOCK; +connection locker; +--send insert into t3 values (2) +connection default; +# Wait till above update gets blocked on a user lock. +let $wait_condition= + select count(*) > 0 from information_schema.processlist + where state = "Waiting for backup lock"; +--source include/wait_condition.inc +connection default; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +unlock tables; +connection locker; +--reap +unlock tables; +connection default; + +disconnect locker; +DROP TABLE t1,t3; diff --git a/mysql-test/main/mdl_sync.result b/mysql-test/main/mdl_sync.result index 3880fc5ef91..5203fdddb2d 100644 --- a/mysql-test/main/mdl_sync.result +++ b/mysql-test/main/mdl_sync.result @@ -2146,10 +2146,11 @@ flush tables t1, t2 with read lock; connection con1; # Wait till FLUSH TABLES WITH READ LOCK stops. set debug_sync='now WAIT_FOR parked'; +flush tables; # Start a statement which will flush all tables and thus # invalidate table t1 open by FLUSH TABLES WITH READ LOCK. # Sending: -flush tables; +flush tables t1; connection default; # Wait till the above FLUSH TABLES blocks. # Resume FLUSH TABLES WITH READ LOCK, so it tries to open t2 @@ -2513,6 +2514,12 @@ connection con2; SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; # Check that FLUSH must wait to get the GRL # and let DROP PROCEDURE continue +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_DDL Backup lock +MDL_EXCLUSIVE Stored procedure metadata lock test p1 +MDL_INTENTION_EXCLUSIVE Schema metadata lock test +MDL_SHARED_WRITE Table metadata lock mysql proc SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; FLUSH TABLES WITH READ LOCK; connection default; @@ -2527,6 +2534,43 @@ connection con2; UNLOCK TABLES; connection default; SET DEBUG_SYNC= 'RESET'; +# +# UPDATE should wait for FTWRL with non transactional table second +# +create table t1 (a int) engine=myisam; +create table t2 (a int) engine=innodb; +insert into t1 values (1); +insert into t2 values (1); +SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2'; +update t1,t2 set t1.a=2,t2.a=3; +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; +SET DEBUG_SYNC= 'now SIGNAL grlwait'; +SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; +FLUSH TABLES WITH READ LOCK; +connection default; +# Reaping UPDATE +connection con2; +UNLOCK TABLES; +connection default; +SET DEBUG_SYNC= 'RESET'; +SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2'; +update t2,t1 set t1.a=2,t2.a=3; +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; +SET DEBUG_SYNC= 'now SIGNAL grlwait'; +SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; +FLUSH TABLES WITH READ LOCK; +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; +LOCK_MODE LOCK_TYPE TABLE_SCHEMA TABLE_NAME +MDL_BACKUP_FTWRL2 Backup lock +unlock tables; +connection default; +# Reaping UPDATE +SET DEBUG_SYNC= 'RESET'; +drop table t1,t2; disconnect con2; # # Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null' @@ -2534,7 +2578,6 @@ disconnect con2; # # Supress warnings written to the log file call mtr.add_suppression("Wait on a lock was aborted due to a pending exclusive lock"); -DROP TABLE IF EXISTS t1, t2; connect con1,localhost,root; connect con2,localhost,root; connect con3,localhost,root; @@ -3055,7 +3098,7 @@ disconnect con3; # CREATE TABLE t1(a INT) ENGINE=InnoDB; SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go'; -SELECT * FROM t1; +INSERT INTO t1 values (1); connect con1,localhost,root,,; SET debug_sync='now WAIT_FOR ready'; SET lock_wait_timeout=1; @@ -3063,7 +3106,21 @@ FLUSH TABLES WITH READ LOCK; ERROR HY000: Lock wait timeout exceeded; try restarting transaction SET debug_sync='now SIGNAL go'; connection default; +# After MDEV-5536, SELECT will not block FLUSH TABLES +SET debug_sync='RESET'; +SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go'; +SELECT * FROM t1; +connection con1; +SET debug_sync='now WAIT_FOR ready'; +SET lock_wait_timeout=1; +FLUSH TABLES WITH READ LOCK; +SET debug_sync='now SIGNAL go'; +connection default; a +1 +connection con1; +unlock tables; +connection default; SET debug_sync='RESET'; DROP TABLE t1; disconnect con1; diff --git a/mysql-test/main/mdl_sync.test b/mysql-test/main/mdl_sync.test index fbecd6bf547..2a1e488ab44 100644 --- a/mysql-test/main/mdl_sync.test +++ b/mysql-test/main/mdl_sync.test @@ -2,6 +2,7 @@ # We need the Debug Sync Facility. # --source include/have_debug_sync.inc +--source include/have_metadata_lock_info.inc # We need InnoDB tables for some of the tests. --source include/have_innodb.inc @@ -2690,17 +2691,20 @@ connection con1; --echo # Wait till FLUSH TABLES WITH READ LOCK stops. set debug_sync='now WAIT_FOR parked'; +# Simple flush tables should not block +flush tables; + --echo # Start a statement which will flush all tables and thus --echo # invalidate table t1 open by FLUSH TABLES WITH READ LOCK. --echo # Sending: -send flush tables; +send flush tables t1; connection default; --echo # Wait till the above FLUSH TABLES blocks. let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for table flush" and - info = "flush tables"; + where state = "Waiting for table metadata lock" and + info = "flush tables t1"; --source include/wait_condition.inc --echo # Resume FLUSH TABLES WITH READ LOCK, so it tries to open t2 @@ -3245,6 +3249,7 @@ connection con2; SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; --echo # Check that FLUSH must wait to get the GRL --echo # and let DROP PROCEDURE continue +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; --send FLUSH TABLES WITH READ LOCK @@ -3261,12 +3266,63 @@ connection con2; --echo # Reaping FTWRL. --reap UNLOCK TABLES; +connection default; +SET DEBUG_SYNC= 'RESET'; + +--echo # +--echo # UPDATE should wait for FTWRL with non transactional table second +--echo # + +create table t1 (a int) engine=myisam; +create table t2 (a int) engine=innodb; +insert into t1 values (1); +insert into t2 values (1); + +SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2'; +--send update t1,t2 set t1.a=2,t2.a=3 + +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; +SET DEBUG_SYNC= 'now SIGNAL grlwait'; +SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; +FLUSH TABLES WITH READ LOCK; + +connection default; +--echo # Reaping UPDATE +--reap + +connection con2; +UNLOCK TABLES; connection default; SET DEBUG_SYNC= 'RESET'; -disconnect con2; +# This will cause a wait as we first get lock for innodb table t2 but FTWRL +# will cause lock for t1 to wait +SET DEBUG_SYNC= 'after_open_table_mdl_shared SIGNAL table_opened WAIT_FOR grlwait execute 2'; +--send update t2,t1 set t1.a=2,t2.a=3 + +connection con2; +SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; +SET DEBUG_SYNC= 'now SIGNAL grlwait'; +SET DEBUG_SYNC= 'now WAIT_FOR table_opened'; +SET DEBUG_SYNC= 'mdl_acquire_lock_wait SIGNAL grlwait'; +FLUSH TABLES WITH READ LOCK; + +let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.metadata_lock_info; +--source include/wait_condition.inc +SELECT LOCK_MODE, LOCK_TYPE, TABLE_SCHEMA, TABLE_NAME FROM information_schema.metadata_lock_info; + +unlock tables; + +connection default; +--echo # Reaping UPDATE +--reap +SET DEBUG_SYNC= 'RESET'; +drop table t1,t2; +disconnect con2; --echo # --echo # Bug#50786 Assertion `thd->mdl_context.trans_sentinel() == __null' @@ -3275,9 +3331,6 @@ disconnect con2; --echo # Supress warnings written to the log file call mtr.add_suppression("Wait on a lock was aborted due to a pending exclusive lock"); ---disable_warnings -DROP TABLE IF EXISTS t1, t2; ---enable_warnings connect (con1,localhost,root); connect (con2,localhost,root); @@ -3966,7 +4019,7 @@ connection con2; connection default; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for global read lock' + WHERE state='Waiting for backup lock' AND info='CREATE TABLE db1.t2(a INT)'; --source include/wait_condition.inc UNLOCK TABLES; @@ -3984,7 +4037,7 @@ connection con2; connection default; let $wait_condition=SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state='Waiting for global read lock' + WHERE state='Waiting for backup lock' AND info='ALTER DATABASE db1 DEFAULT CHARACTER SET utf8'; --source include/wait_condition.inc UNLOCK TABLES; @@ -4079,9 +4132,10 @@ disconnect con3; --echo # MDEV-12620 - set lock_wait_timeout = 1;flush tables with read lock; --echo # lock not released after timeout --echo # + CREATE TABLE t1(a INT) ENGINE=InnoDB; SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go'; -send SELECT * FROM t1; +send INSERT INTO t1 values (1); connect (con1,localhost,root,,); SET debug_sync='now WAIT_FOR ready'; @@ -4093,12 +4147,31 @@ SET debug_sync='now SIGNAL go'; connection default; reap; + +--echo # After MDEV-5536, SELECT will not block FLUSH TABLES + +SET debug_sync='RESET'; +SET debug_sync='open_tables_after_open_and_process_table SIGNAL ready WAIT_FOR go'; +send SELECT * FROM t1; + +connection con1; +SET debug_sync='now WAIT_FOR ready'; +# lock_wait_timeout should be 0 in 10.3, so that we don't have to wait at all +SET lock_wait_timeout=1; +FLUSH TABLES WITH READ LOCK; +SET debug_sync='now SIGNAL go'; + +connection default; +reap; +connection con1; +unlock tables; +connection default; + SET debug_sync='RESET'; DROP TABLE t1; disconnect con1; - # Check that all connections opened by test cases in this file are really # gone so execution of other tests won't be affected by their presence. --source include/wait_until_count_sessions.inc diff --git a/mysql-test/main/merge.result b/mysql-test/main/merge.result index 4f6765420ec..4a3ca3d767e 100644 --- a/mysql-test/main/merge.result +++ b/mysql-test/main/merge.result @@ -2117,6 +2117,7 @@ CREATE TABLE t1(a INT, KEY(a)); INSERT INTO t1 VALUES(0),(1),(2),(3),(4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK CREATE TABLE m1(a INT, KEY(a)) ENGINE=MERGE UNION=(t1); SELECT CARDINALITY FROM INFORMATION_SCHEMA.STATISTICS WHERE TABLE_SCHEMA='test' AND TABLE_NAME='m1'; @@ -3818,11 +3819,15 @@ CREATE TABLE tmerge (f1 INT) ENGINE=MERGE UNION=(t1); PREPARE stmt FROM "ANALYZE TABLE tmerge, t1"; EXECUTE stmt; Table Op Msg_type Msg_text +test.tmerge analyze status Engine-independent statistics collected test.tmerge analyze note The storage engine for the table doesn't support analyze +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date EXECUTE stmt; Table Op Msg_type Msg_text +test.tmerge analyze status Engine-independent statistics collected test.tmerge analyze note The storage engine for the table doesn't support analyze +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date DEALLOCATE PREPARE stmt; DROP TABLE t1, tmerge; diff --git a/mysql-test/main/mix2_myisam.result b/mysql-test/main/mix2_myisam.result index 34764466d2a..5acec2616fa 100644 --- a/mysql-test/main/mix2_myisam.result +++ b/mysql-test/main/mix2_myisam.result @@ -211,6 +211,7 @@ create index skr on t1 (a); insert into t1 values (3,""), (4,"testing"); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment diff --git a/mysql-test/main/multi_update.result b/mysql-test/main/multi_update.result index c40de47668a..d2a33619900 100644 --- a/mysql-test/main/multi_update.result +++ b/mysql-test/main/multi_update.result @@ -603,11 +603,11 @@ CREATE TABLE t1 (f1 DATE); INSERT INTO t1 VALUES('2001-01-01'); UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (SELECT f1() FROM t1)) x, t1 SET f1 = 1; Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' CREATE view v1 as SELECT f1() FROM t1; UPDATE IGNORE (SELECT 1 FROM t1 WHERE f1 = (select * from v1)) x, t1 SET f1 = 1; Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' DROP VIEW v1; DROP FUNCTION f1; DROP TABLE t1; @@ -998,8 +998,8 @@ a b c a b c set optimizer_switch='firstmatch=off'; explain update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c< t2.c) order by t2.c, t1.c limit 10; id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort -1 PRIMARY t1 ALL a NULL NULL NULL 10 Using where +1 PRIMARY t2 ALL NULL NULL NULL NULL 10 Using where; Using temporary; Using filesort +1 PRIMARY t1 ref a a 5 test.t2.a 1 1 PRIMARY t3 ALL NULL NULL NULL NULL 10 Using where; Start temporary; End temporary update t1, t2 set t2.c=1 where t1.a=t2.a and t1.b in (select b from t3 where t3.c<=t2.c) order by t2.c, t1.c limit 5; select * from t2; diff --git a/mysql-test/main/myisam.result b/mysql-test/main/myisam.result index bef8790e141..c0e44d71abc 100644 --- a/mysql-test/main/myisam.result +++ b/mysql-test/main/myisam.result @@ -676,6 +676,7 @@ insert into t1 values (0),(1),(2),(3),(4); insert into t1 select NULL from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -696,6 +697,7 @@ insert into t1 values (11); delete from t1 where a=11; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -707,7 +709,7 @@ Table Op Msg_type Msg_text test.t1 check status OK show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment -t1 1 a 1 a A 5 NULL NULL YES BTREE +t1 1 a 1 a A 10 NULL NULL YES BTREE set myisam_stats_method=DEFAULT; show variables like 'myisam_stats_method'; Variable_name Value @@ -716,6 +718,7 @@ insert into t1 values (11); delete from t1 where a=11; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -743,6 +746,7 @@ insert into t1 values ('bce','def1', 'yuu', NULL); insert into t1 values ('bce','def2', NULL, 'quux'); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -753,6 +757,7 @@ t1 1 a 4 d A 4 NULL NULL YES BTREE delete from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -1801,6 +1806,7 @@ create table t1 (a int, key(a)); insert into t1 values (1),(2),(3),(4),(NULL),(NULL),(NULL),(NULL); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show keys from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment diff --git a/mysql-test/main/myisam_explain_non_select_all.result b/mysql-test/main/myisam_explain_non_select_all.result index 8e4db5ed482..d238b0d9901 100644 --- a/mysql-test/main/myisam_explain_non_select_all.result +++ b/mysql-test/main/myisam_explain_non_select_all.result @@ -28,10 +28,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 4 # Status of testing query execution: Variable_name Value @@ -58,6 +60,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 10; @@ -67,14 +70,17 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 4 # Status of testing query execution: Variable_name Value Handler_delete 3 +Handler_read_key 2 Handler_read_rnd_next 4 DROP TABLE t1; @@ -97,6 +103,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 1; @@ -106,14 +113,17 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 4 # Status of testing query execution: Variable_name Value Handler_delete 1 +Handler_read_key 2 Handler_read_rnd_next 4 DROP TABLE t1; @@ -150,10 +160,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 8 # Status of testing query execution: Variable_name Value @@ -196,10 +208,12 @@ Warnings: Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` = 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 8 # Status of testing query execution: Variable_name Value @@ -242,11 +256,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 5 Handler_read_rnd_next 8 # Status of testing query execution: Variable_name Value @@ -290,10 +305,12 @@ Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`b` = `test`.`t1`.`a` and `test`.`t1`.`a` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 8 # Status of testing query execution: Variable_name Value @@ -340,11 +357,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join (`test`.`t2`) join `test`.`t2` where `test`.`t2`.`b` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 3 +Handler_read_key 7 Handler_read_rnd_next 12 # Status of testing query execution: Variable_name Value @@ -388,10 +406,12 @@ Warnings: Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 8 # Status of testing query execution: Variable_name Value @@ -438,11 +458,13 @@ Warnings: Note 1003 /* select#1 */ select `test`.`t11`.`a` AS `a`,1 AS `1` from `test`.`t1` `t11` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 1 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 5 # Status of testing query execution: Variable_name Value @@ -486,10 +508,12 @@ Warnings: Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` `t11` join `test`.`t2` where `test`.`t11`.`a` > 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 8 # Status of testing query execution: Variable_name Value @@ -516,6 +540,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a > 1 LIMIT 1; @@ -525,14 +550,17 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 1 limit 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 2 # Status of testing query execution: Variable_name Value Handler_delete 1 +Handler_read_key 2 Handler_read_rnd_next 2 DROP TABLE t1; @@ -555,6 +583,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE 0; @@ -564,12 +593,15 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 # Status of testing query execution: Variable_name Value +Handler_read_key 2 DROP TABLE t1; #13 @@ -591,6 +623,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE 0; @@ -600,12 +633,15 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where 0 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 # Status of testing query execution: Variable_name Value +Handler_read_key 2 DROP TABLE t1; #14 @@ -627,6 +663,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 5 NULL 1 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 5 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a = 3; @@ -636,16 +673,16 @@ Warnings: Note 1003 select 3 AS `a`,3 AS `b` from `test`.`t1` where 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value -Handler_read_key 1 +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 6 # Status of testing query execution: Variable_name Value Handler_delete 1 -Handler_read_key 1 +Handler_read_key 6 DROP TABLE t1; #15 @@ -667,6 +704,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range a a 5 NULL 1 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 5 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a < 3; @@ -676,14 +714,15 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`a` < 3 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 5 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 6 # Status of testing query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 6 DROP TABLE t1; #16 @@ -704,6 +743,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 1 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a; @@ -713,15 +753,17 @@ Warnings: Note 1003 select NULL AS `a` from `test`.`t1` where 0 order by NULL # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Handler_read_rnd_next 1 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 3 Handler_read_rnd_next 1 # Status of testing query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 4 INSERT INTO t1 VALUES (1), (2), (3); # @@ -740,6 +782,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE t1.a > 0 ORDER BY t1.a; @@ -749,16 +792,17 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 0 order by `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 4 Handler_read_next 3 # Status of testing query execution: Variable_name Value Handler_delete 3 -Handler_read_key 1 +Handler_read_key 4 Handler_read_next 3 DROP TABLE t1; @@ -781,6 +825,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 index NULL PRIMARY 4 NULL 1 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE (@a:= a) ORDER BY a LIMIT 1; @@ -790,15 +835,18 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where @a:=`test`.`t1`.`a` order by `test`.`t1`.`a` limit 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value Handler_read_first 1 +Handler_read_key 3 # Status of testing query execution: Variable_name Value Handler_delete 1 Handler_read_first 1 +Handler_read_key 3 DROP TABLE t1; #18 @@ -821,6 +869,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 10 100.00 Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 7 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 ORDER BY a ASC, b ASC LIMIT 1; @@ -830,10 +879,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b`,`test`.`t1`.`c` AS `c` from `test`.`t1` order by `test`.`t1`.`a`,`test`.`t1`.`b` limit 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 7 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 7 Handler_read_rnd_next 11 Sort_priority_queue_sorts 1 Sort_rows 1 @@ -841,6 +892,7 @@ Sort_scan 1 # Status of testing query execution: Variable_name Value Handler_delete 1 +Handler_read_key 7 Handler_read_rnd 1 Handler_read_rnd_next 11 Sort_rows 10 @@ -874,6 +926,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t3 eq_ref PRIMARY PRIMARY 8 test.t2.b2,test.t1.b1 1 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 13 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1,t2,t3 WHERE a1=a2 AND b2=a3 AND b1=b3; @@ -885,17 +938,18 @@ Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2`,`test`.`t3`.`a3` AS `a3`,`test`.`t3`.`b3` AS `b3` from `test`.`t1` join `test`.`t2` join `test`.`t3` where `test`.`t2`.`a2` = `test`.`t1`.`a1` and `test`.`t3`.`a3` = `test`.`t2`.`b2` and `test`.`t3`.`b3` = `test`.`t1`.`b1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 13 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 6 +Handler_read_key 19 Handler_read_next 3 Handler_read_rnd_next 4 # Status of testing query execution: Variable_name Value Handler_delete 8 -Handler_read_key 6 +Handler_read_key 19 Handler_read_next 3 Handler_read_rnd 5 Handler_read_rnd_next 4 @@ -935,11 +989,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join (`test`.`t2`) where 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 3 +Handler_read_key 7 Handler_read_rnd_next 8 # Status of testing query execution: Variable_name Value @@ -971,6 +1026,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); @@ -981,15 +1037,17 @@ Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1` from `test`.`t1` where <`test`.`t1`.`a1`>((`test`.`t1`.`a1`,(/* select#2 */ select `test`.`t2`.`a2` from `test`.`t2` where `test`.`t2`.`a2` > 2 and (`test`.`t1`.`a1`) = `test`.`t2`.`a2`))) # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 5 +Handler_read_key 9 Handler_read_rnd_next 30 # Status of testing query execution: Variable_name Value Handler_delete 3 +Handler_read_key 4 Handler_read_rnd_next 30 SET @@optimizer_switch= @save_optimizer_switch; @@ -1013,6 +1071,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE a1 IN (SELECT a2 FROM t2 WHERE a2 > 2); @@ -1023,14 +1082,17 @@ Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1` from `test`.`t1` semi join (`test`.`t2`) where `test`.`t2`.`a2` > 2 and `test`.`t1`.`a1` = `test`.`t2`.`a2` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 12 # Status of testing query execution: Variable_name Value Handler_delete 3 +Handler_read_key 4 Handler_read_rnd_next 30 DROP TABLE t1, t2; @@ -1062,10 +1124,12 @@ Warnings: Note 1003 select `test`.`t1`.`i` AS `i`,`test`.`t1`.`j` AS `j` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 3 Handler_read_rnd_next 6 # Status of testing query execution: Variable_name Value @@ -1092,6 +1156,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL 5 NULL Deleting all rows # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; @@ -1101,13 +1166,16 @@ Warnings: Note 1003 select `test`.`t1`.`i` AS `i`,`test`.`t1`.`j` AS `j` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 3 Handler_read_rnd_next 6 # Status of testing query execution: Variable_name Value +Handler_read_key 3 DROP TABLE t1; #24 @@ -1134,6 +1202,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1143,16 +1212,19 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value Handler_read_first 1 +Handler_read_key 8 Handler_read_next 4 # Status of testing query execution: Variable_name Value Handler_delete 5 Handler_read_first 1 +Handler_read_key 8 Handler_read_next 4 DROP TABLE t1, t2; @@ -1176,6 +1248,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; @@ -1185,13 +1258,16 @@ Warnings: Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 4 # Status of testing query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 4 Handler_write 3 @@ -1216,6 +1292,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1; @@ -1225,13 +1302,16 @@ Warnings: Note 1003 select `test`.`t1`.`i` AS `i` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 4 # Status of testing query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 4 Handler_write 3 @@ -1252,8 +1332,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 2 # Status of testing query execution: Variable_name Value +Handler_read_key 2 Handler_write 1 DROP TABLE t1; @@ -1273,8 +1355,10 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 2 # Status of testing query execution: Variable_name Value +Handler_read_key 2 Handler_write 1 DROP TABLE t1; @@ -1299,6 +1383,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; @@ -1308,16 +1393,17 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 5 Handler_read_next 4 # Status of testing query execution: Variable_name Value Handler_delete 5 -Handler_read_key 1 +Handler_read_key 5 Handler_read_next 4 DROP TABLE t1; @@ -1342,6 +1428,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE i > 10 AND i <= 18 ORDER BY i LIMIT 5; @@ -1351,10 +1438,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`i` AS `i` from `test`.`t1` where `test`.`t1`.`i` > 10 and `test`.`t1`.`i` <= 18 order by `test`.`t1`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 Sort_rows 5 @@ -1362,6 +1451,7 @@ Sort_scan 1 # Status of testing query execution: Variable_name Value Handler_delete 5 +Handler_read_key 4 Handler_read_rnd 5 Handler_read_rnd_next 27 Sort_rows 8 @@ -1391,6 +1481,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1400,10 +1491,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 8 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 Sort_rows 1 @@ -1411,6 +1504,7 @@ Sort_scan 1 # Status of testing query execution: Variable_name Value Handler_delete 1 +Handler_read_key 8 Handler_read_rnd 1 Handler_read_rnd_next 27 Sort_rows 1 @@ -1441,6 +1535,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL a 15 NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1450,16 +1545,19 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value Handler_read_first 1 +Handler_read_key 8 Handler_read_next 4 # Status of testing query execution: Variable_name Value Handler_delete 5 Handler_read_first 1 +Handler_read_key 8 Handler_read_next 4 DROP TABLE t1, t2; @@ -1486,6 +1584,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1495,10 +1594,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 8 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 Sort_rows 1 @@ -1506,6 +1607,7 @@ Sort_scan 1 # Status of testing query execution: Variable_name Value Handler_delete 1 +Handler_read_key 8 Handler_read_rnd 1 Handler_read_rnd_next 27 Sort_rows 1 @@ -1536,6 +1638,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 8 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE b = 10 ORDER BY a, c LIMIT 5; @@ -1545,10 +1648,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 8 Handler_read_rnd 1 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 @@ -1557,6 +1662,7 @@ Sort_scan 1 # Status of testing query execution: Variable_name Value Handler_delete 1 +Handler_read_key 8 Handler_read_rnd 1 Handler_read_rnd_next 27 Sort_rows 1 @@ -1587,6 +1693,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index_merge key1,key2 key1,key2 5,5 NULL 7 100.00 Using sort_union(key1,key2); Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE key1 < 13 or key2 < 14 ORDER BY key1; @@ -1596,11 +1703,12 @@ Warnings: Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 2 +Handler_read_key 8 Handler_read_next 7 Handler_read_rnd 4 Sort_range 1 @@ -1608,7 +1716,7 @@ Sort_rows 4 # Status of testing query execution: Variable_name Value Handler_delete 4 -Handler_read_key 2 +Handler_read_key 8 Handler_read_next 7 Handler_read_rnd 8 Sort_range 1 @@ -1638,6 +1746,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 range PRIMARY PRIMARY 4 NULL 5 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 4 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 WHERE i > 10 AND i <= 18 ORDER BY i DESC LIMIT 5; @@ -1647,16 +1756,17 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 5 Handler_read_prev 4 # Status of testing query execution: Variable_name Value Handler_delete 5 -Handler_read_key 1 +Handler_read_key 5 Handler_read_prev 4 DROP TABLE t1, t2; @@ -1683,6 +1793,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 ALL NULL NULL NULL NULL 26 100.00 Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 ORDER BY a, b DESC LIMIT 5; @@ -1692,10 +1803,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 6 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 Sort_rows 5 @@ -1703,6 +1816,7 @@ Sort_scan 1 # Status of testing query execution: Variable_name Value Handler_delete 5 +Handler_read_key 6 Handler_read_rnd 5 Handler_read_rnd_next 27 Sort_rows 26 @@ -1733,6 +1847,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t2 index NULL a 6 NULL 5 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2 ORDER BY a DESC, b DESC LIMIT 5; @@ -1742,15 +1857,18 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 6 Handler_read_last 1 Handler_read_prev 4 # Status of testing query execution: Variable_name Value Handler_delete 5 +Handler_read_key 6 Handler_read_last 1 Handler_read_prev 4 @@ -1787,11 +1905,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 5 Handler_read_next 4 # Status of testing query execution: Variable_name Value @@ -1833,10 +1952,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 Sort_rows 5 @@ -1883,10 +2004,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 8 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 Sort_rows 1 @@ -1934,11 +2057,13 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value Handler_read_first 1 +Handler_read_key 8 Handler_read_next 4 # Status of testing query execution: Variable_name Value @@ -1980,10 +2105,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 8 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 Sort_rows 1 @@ -2030,10 +2157,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c`,`test`.`t2`.`d` AS `d` from `test`.`t2` where `test`.`t2`.`b` = 10 order by `test`.`t2`.`a`,`test`.`t2`.`c` limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 8 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 8 Handler_read_rnd 1 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 @@ -2081,11 +2210,12 @@ Warnings: Note 1003 select `test`.`t2`.`i` AS `i`,`test`.`t2`.`key1` AS `key1`,`test`.`t2`.`key2` AS `key2` from `test`.`t2` where `test`.`t2`.`key1` < 13 or `test`.`t2`.`key2` < 14 order by `test`.`t2`.`key1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 2 +Handler_read_key 8 Handler_read_next 7 Handler_read_rnd 4 Sort_range 1 @@ -2132,11 +2262,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`i` AS `i` from `test`.`t2` where `test`.`t2`.`i` > 10 and `test`.`t2`.`i` <= 18 order by `test`.`t2`.`i` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 5 Handler_read_prev 4 # Status of testing query execution: Variable_name Value @@ -2178,10 +2309,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a`,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 6 Handler_read_rnd_next 27 Sort_priority_queue_sorts 1 Sort_rows 5 @@ -2229,10 +2362,12 @@ Warnings: Note 1003 select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` order by `test`.`t2`.`a` desc,`test`.`t2`.`b` desc limit 5 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 6 Handler_read_last 1 Handler_read_prev 4 # Status of testing query execution: @@ -2277,11 +2412,12 @@ Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 7 Handler_read_next 2 Sort_priority_queue_sorts 1 Sort_range 1 @@ -2312,6 +2448,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range c1_idx c1_idx 2 NULL 2 100.00 Using where; Using filesort # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t1 WHERE c1_idx = 'y' ORDER BY pk DESC LIMIT 2; @@ -2321,11 +2458,12 @@ Warnings: Note 1003 select `test`.`t1`.`pk` AS `pk`,`test`.`t1`.`c1_idx` AS `c1_idx`,`test`.`t1`.`c2` AS `c2` from `test`.`t1` where `test`.`t1`.`c1_idx` = 'y' order by `test`.`t1`.`pk` desc limit 2 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 7 Handler_read_next 2 Sort_priority_queue_sorts 1 Sort_range 1 @@ -2333,7 +2471,7 @@ Sort_rows 2 # Status of testing query execution: Variable_name Value Handler_delete 2 -Handler_read_key 1 +Handler_read_key 7 Handler_read_next 2 Handler_read_rnd 2 Sort_range 1 @@ -2368,11 +2506,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` > 34 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 1 +Handler_read_key 4 Handler_read_next 2 # Status of testing query execution: Variable_name Value @@ -2415,11 +2554,13 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 7 Handler_read_rnd_next 1 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 7 Handler_read_rnd_next 4 # Status of testing query execution: Variable_name Value @@ -2454,11 +2595,13 @@ Warnings: Note 1003 select `test`.`t1`.`c1` AS `c1`,`test`.`t1`.`c2` AS `c2`,`test`.`t1`.`c3` AS `c3`,NULL AS `c1`,NULL AS `c2` from `test`.`t1` where `test`.`t1`.`c3` = 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 7 Handler_read_rnd_next 1 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 7 Handler_read_rnd_next 4 # Status of testing query execution: Variable_name Value @@ -2502,11 +2645,12 @@ Note 1276 Field or reference 'test.t1.f1' of SELECT #2 was resolved in SELECT #1 Note 1003 /* select#1 */ select <`test`.`t1`.`f1`>((/* select#2 */ select max(`test`.`t2`.`f4`) from `test`.`t2` where `test`.`t2`.`f3` = `test`.`t1`.`f1`)) AS `(SELECT MAX(t2.f4) FROM t2 WHERE t2.f3=t1.f1)` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 7 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 2 +Handler_read_key 9 Handler_read_rnd_next 9 # Status of testing query execution: Variable_name Value @@ -2569,10 +2713,12 @@ Warnings: Note 1003 select `test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` > 0 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 6 # Status of testing query execution: Variable_name Value @@ -2611,10 +2757,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t11`.`a` AS `a`,`test`.`t12`.`a` AS `b` from `test`.`t1` join `test`.`t1` `t11` join `test`.`t1` `t12` where `test`.`t11`.`a` = `test`.`t1`.`a` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 9 # Status of testing query execution: Variable_name Value @@ -2645,6 +2793,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 range PRIMARY PRIMARY 4 NULL 3 100.00 Using where # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 3 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM v1 WHERE a < 4; @@ -2654,16 +2803,19 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 4 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value Handler_read_first 1 +Handler_read_key 3 Handler_read_next 3 # Status of testing query execution: Variable_name Value Handler_delete 3 Handler_read_first 1 +Handler_read_key 3 Handler_read_next 3 DROP TABLE t1; @@ -2692,6 +2844,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2, v1 WHERE t2.x = v1.a; @@ -2702,16 +2855,17 @@ Warnings: Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 4 +Handler_read_key 10 Handler_read_rnd_next 5 # Status of testing query execution: Variable_name Value Handler_delete 4 -Handler_read_key 4 +Handler_read_key 10 Handler_read_rnd 4 Handler_read_rnd_next 5 @@ -2741,6 +2895,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 eq_ref PRIMARY PRIMARY 4 test.t2.x 1 100.00 # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 6 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT * FROM t2, v1 WHERE t2.x = v1.a; @@ -2751,16 +2906,17 @@ Warnings: Note 1003 select `test`.`t2`.`x` AS `x`,`test`.`t1`.`a` AS `a`,`test`.`t1`.`b` + 1 AS `c` from `test`.`t2` join `test`.`t1` where `test`.`t1`.`a` = `test`.`t2`.`x` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 6 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 4 +Handler_read_key 10 Handler_read_rnd_next 5 # Status of testing query execution: Variable_name Value Handler_delete 4 -Handler_read_key 4 +Handler_read_key 10 Handler_read_rnd 4 Handler_read_rnd_next 5 @@ -2783,6 +2939,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 INSERT t1 ALL NULL NULL NULL NULL NULL 100.00 NULL # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 2 FLUSH STATUS; FLUSH TABLES; EXPLAIN EXTENDED SELECT NULL; @@ -2796,6 +2953,7 @@ Variable_name Value Variable_name Value # Status of testing query execution: Variable_name Value +Handler_read_key 2 Handler_write 1 DROP TABLE t1; @@ -2821,6 +2979,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 system NULL NULL NULL NULL 0 0.00 Const row not found # Status of EXPLAIN EXTENDED query Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 1 FLUSH STATUS; FLUSH TABLES; @@ -2831,14 +2990,17 @@ Warnings: Note 1003 select NULL AS `a` from `test`.`t1` # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 1 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 2 Handler_read_rnd_next 1 # Status of testing query execution: Variable_name Value +Handler_read_key 4 Handler_read_rnd_next 1 DROP TABLE t1, t2; @@ -2886,11 +3048,12 @@ Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) where 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 3 +Handler_read_key 7 Handler_read_rnd_next 10 Sort_priority_queue_sorts 1 Sort_rows 3 @@ -2941,11 +3104,12 @@ Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join ((/* select#3 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) join `test`.`t2` where 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 3 +Handler_read_key 7 Handler_read_rnd_next 10 Sort_priority_queue_sorts 1 Sort_rows 3 @@ -2997,11 +3161,12 @@ Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t1` semi join ((/* select#4 */ select `test`.`t2`.`b` AS `b` from `test`.`t2` order by `test`.`t2`.`b` limit 2,2) `x`) join `test`.`t2` where 1 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 4 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value -Handler_read_key 3 +Handler_read_key 7 Handler_read_rnd_next 10 Sort_priority_queue_sorts 1 Sort_rows 3 @@ -3069,11 +3234,13 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value Handler_read_first 1 +Handler_read_key 3 Handler_read_next 5 # Status of testing query execution: Variable_name Value @@ -3105,10 +3272,12 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `t1` from `test`.`t1` where `test`.`t1`.`a` > 10 order by `test`.`t1`.`a` + 20 # Status of EXPLAIN EXTENDED "equivalent" SELECT query execution Variable_name Value +Handler_read_key 3 Warnings: Warning 1287 ' INTO FROM...' instead # Status of "equivalent" SELECT query execution: Variable_name Value +Handler_read_key 3 Handler_read_rnd_next 6 Sort_scan 1 # Status of testing query execution: diff --git a/mysql-test/main/myisam_icp.result b/mysql-test/main/myisam_icp.result index 6a70521cd72..2048205528d 100644 --- a/mysql-test/main/myisam_icp.result +++ b/mysql-test/main/myisam_icp.result @@ -849,7 +849,7 @@ DROP TABLE t1; create table t1 (a int,b char(5),primary key (a), key (b(1))); insert ignore into t1 values ('a','b'); Warnings: -Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`a` at row 1 select 1 from t1 where a and b >= 'aa'; 1 drop table t1; diff --git a/mysql-test/main/mysql_install_db_win.result b/mysql-test/main/mysql_install_db_win.result new file mode 100644 index 00000000000..63c922a9184 --- /dev/null +++ b/mysql-test/main/mysql_install_db_win.result @@ -0,0 +1,13 @@ +Running bootstrap +Removing default user +Allowing remote access for user root +Setting root password +Creating my.ini file +Creation of the database was successful +# Kill the server +connect root,localhost,root,foo; +SELECT @@datadir; +@@datadir +DATADIR/ +# Kill the server +connection default; diff --git a/mysql-test/main/mysql_install_db_win.test b/mysql-test/main/mysql_install_db_win.test new file mode 100644 index 00000000000..7bf62903219 --- /dev/null +++ b/mysql-test/main/mysql_install_db_win.test @@ -0,0 +1,24 @@ +--source include/windows.inc + +# Create database in tmp directory using mysql_install_db.exe, +# and start server from this directory. +let $ddir= $MYSQLTEST_VARDIR/tmp/ddir; +exec $MYSQL_INSTALL_DB_EXE --datadir=$ddir --password=foo -R; + +--source include/kill_mysqld.inc +let $restart_parameters=--datadir=$ddir --loose-innodb; +--source include/start_mysqld.inc + +connect root,localhost,root,foo; +# Smoke test - check that we're actually using datadir +# we've created (i.e restart_parameters worked) +--replace_result $ddir DATADIR +SELECT @@datadir; + +# restart in the original datadir again +--source include/kill_mysqld.inc +rmdir $ddir; +let $restart_parameters=; +connection default; +--source include/start_mysqld.inc + diff --git a/mysql-test/main/mysql_upgrade-6984.result b/mysql-test/main/mysql_upgrade-6984.result index a7b5bcb86bf..87f3c1a5359 100644 --- a/mysql-test/main/mysql_upgrade-6984.result +++ b/mysql-test/main/mysql_upgrade-6984.result @@ -1,4 +1,4 @@ -update mysql.user set password=password("foo") where user='root'; +update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo')); Phase 1/7: Checking and upgrading mysql database Processing databases mysql @@ -7,6 +7,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -35,7 +36,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -49,6 +49,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -62,6 +63,6 @@ test Phase 7/7: Running 'FLUSH PRIVILEGES' OK connect con1,localhost,root,foo,,,; -update mysql.user set password='' where user='root'; +update mysql.global_priv set priv=json_remove(priv, '$.plugin', '$.authentication_string'); flush privileges; set global event_scheduler=OFF; diff --git a/mysql-test/main/mysql_upgrade-6984.test b/mysql-test/main/mysql_upgrade-6984.test index 9bbfbeb3f87..a036b7a08a0 100644 --- a/mysql-test/main/mysql_upgrade-6984.test +++ b/mysql-test/main/mysql_upgrade-6984.test @@ -11,13 +11,13 @@ # In this setup MYSQL_UPGRADE cannot continue after issuing FLUSH PRIVILEGES # -update mysql.user set password=password("foo") where user='root'; +update mysql.global_priv set priv=json_set(priv, '$.plugin', 'mysql_native_password', '$.authentication_string', password('foo')); --exec $MYSQL_UPGRADE connect(con1,localhost,root,foo,,,); -update mysql.user set password='' where user='root'; +update mysql.global_priv set priv=json_remove(priv, '$.plugin', '$.authentication_string'); flush privileges; # Load event table set global event_scheduler=OFF; diff --git a/mysql-test/main/mysql_upgrade.result b/mysql-test/main/mysql_upgrade.result index 54146787123..9fcf76d2b1c 100644 --- a/mysql-test/main/mysql_upgrade.result +++ b/mysql-test/main/mysql_upgrade.result @@ -8,6 +8,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -30,9 +31,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -46,7 +47,7 @@ test Phase 7/7: Running 'FLUSH PRIVILEGES' OK Run it again - should say already completed -This installation of MySQL is already upgraded to VERSION, use --force if you still need to run mysql_upgrade +This installation of MariaDB is already upgraded to VERSION, use --force if you still need to run mysql_upgrade Force should run it regardless of whether it has been run before Phase 1/7: Checking and upgrading mysql database Processing databases @@ -56,6 +57,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -78,9 +80,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -104,6 +106,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -126,9 +129,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -157,6 +160,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -179,9 +183,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -211,6 +215,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -233,9 +238,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -268,6 +273,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -290,9 +296,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -310,7 +316,7 @@ Grants for user3@% GRANT USAGE ON *.* TO 'user3'@'%' GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' DROP USER 'user3'@'%'; -End of 5.1 tests +# End of 5.1 tests The --upgrade-system-tables option was used, user tables won't be touched. Phase 1/7: Checking and upgrading mysql database Processing databases @@ -320,6 +326,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -342,7 +349,6 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views... Skipped Phase 4/7: Running 'mysql_fix_privilege_tables' @@ -364,6 +370,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -386,9 +393,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -429,6 +436,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -451,9 +459,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -497,7 +505,7 @@ length(table_name) 79 79 drop table extralongname_extralongname_extralongname_extralongname_ext; -End of 10.0 tests +# End of 10.0 tests set sql_mode=default; # Droping the previously created mysql_upgrade_info file.. create table test.t1(a int) engine=MyISAM; @@ -511,6 +519,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -533,9 +542,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables @@ -560,13 +569,13 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE test.t1; SET GLOBAL enforce_storage_engine=NULL; -End of 10.1 tests -Start of 10.3 tests +# End of 10.1 tests +# End of 10.2 tests # # Ensure that mysql_upgrade correctly sets truncate_versioning_priv # on upgrade from 10.2 # -flush privileges; +drop view mysql.user_bak; CREATE USER 'user3'@'%'; GRANT USAGE ON *.* TO 'user3'@'%'; GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; @@ -580,3 +589,38 @@ GRANT USAGE ON *.* TO 'user3'@'%' GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%' DROP USER 'user3'@'%'; update mysql.db set Delete_history_priv='Y' where db like 'test%'; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +# End of 10.3 tests +drop view mysql.user_bak; +create user 'user3'@'localhost' identified with mysql_native_password as password('a_password'); +show create user user3@localhost; +CREATE USER for user3@localhost +CREATE USER 'user3'@'localhost' IDENTIFIED BY PASSWORD '*5DC1D11F45824A9DD613961F05C1EC1E7A1601AA' +update mysql.user set password=authentication_string, authentication_string='' where user='user3'; +select password,plugin,authentication_string from mysql.user where user='user3'; +password plugin authentication_string +*5DC1D11F45824A9DD613961F05C1EC1E7A1601AA mysql_native_password +flush privileges; +show create user user3@localhost; +CREATE USER for user3@localhost +CREATE USER 'user3'@'localhost' IDENTIFIED BY PASSWORD '*5DC1D11F45824A9DD613961F05C1EC1E7A1601AA' +connect con1,localhost,user3,a_password; +select current_user(); +current_user() +user3@localhost +disconnect con1; +connection default; +# mysql_upgrade --force --silent 2>&1 +show create user user3@localhost; +CREATE USER for user3@localhost +CREATE USER 'user3'@'localhost' IDENTIFIED BY PASSWORD '*5DC1D11F45824A9DD613961F05C1EC1E7A1601AA' +connect con1,localhost,user3,a_password; +select current_user(); +current_user() +user3@localhost +disconnect con1; +connection default; +drop user user3@localhost; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; diff --git a/mysql-test/main/mysql_upgrade.test b/mysql-test/main/mysql_upgrade.test index 0171fe6c7ba..9ed39aa5d32 100644 --- a/mysql-test/main/mysql_upgrade.test +++ b/mysql-test/main/mysql_upgrade.test @@ -106,8 +106,7 @@ SHOW GRANTS FOR 'user3'@'%'; DROP USER 'user3'@'%'; ---echo End of 5.1 tests - +--echo # End of 5.1 tests # # Test the --upgrade-system-tables option @@ -192,7 +191,7 @@ create table extralongname_extralongname_extralongname_extralongname_ext ( select length(table_name) from mysql.innodb_table_stats; drop table extralongname_extralongname_extralongname_extralongname_ext; ---echo End of 10.0 tests +--echo # End of 10.0 tests set sql_mode=default; @@ -218,16 +217,17 @@ DROP TABLE test.t1; --remove_file $MYSQLD_DATADIR/mysql_upgrade_info SET GLOBAL enforce_storage_engine=NULL; ---echo End of 10.1 tests +--echo # End of 10.1 tests ---echo Start of 10.3 tests +--echo # End of 10.2 tests --echo # --echo # Ensure that mysql_upgrade correctly sets truncate_versioning_priv --echo # on upgrade from 10.2 --echo # -flush privileges; +--source include/switch_to_mysql_user.inc +drop view mysql.user_bak; CREATE USER 'user3'@'%'; GRANT USAGE ON *.* TO 'user3'@'%'; GRANT ALL PRIVILEGES ON `roelt`.`test2` TO 'user3'@'%'; @@ -241,3 +241,31 @@ flush privileges; SHOW GRANTS FOR 'user3'@'%'; DROP USER 'user3'@'%'; update mysql.db set Delete_history_priv='Y' where db like 'test%'; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; + +--echo # End of 10.3 tests + +--source include/switch_to_mysql_user.inc +drop view mysql.user_bak; +create user 'user3'@'localhost' identified with mysql_native_password as password('a_password'); +show create user user3@localhost; +update mysql.user set password=authentication_string, authentication_string='' where user='user3'; +select password,plugin,authentication_string from mysql.user where user='user3'; +flush privileges; +show create user user3@localhost; +connect con1,localhost,user3,a_password; +select current_user(); +disconnect con1; +connection default; +--echo # mysql_upgrade --force --silent 2>&1 +--exec $MYSQL_UPGRADE --force --silent 2>&1 +--remove_file $MYSQLD_DATADIR/mysql_upgrade_info +show create user user3@localhost; +connect con1,localhost,user3,a_password; +select current_user(); +disconnect con1; +connection default; +drop user user3@localhost; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; diff --git a/mysql-test/main/mysql_upgrade_no_innodb.result b/mysql-test/main/mysql_upgrade_no_innodb.result index 90e96800bff..35b55bb45e0 100644 --- a/mysql-test/main/mysql_upgrade_no_innodb.result +++ b/mysql-test/main/mysql_upgrade_no_innodb.result @@ -7,6 +7,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -35,7 +36,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats diff --git a/mysql-test/main/mysql_upgrade_noengine.result b/mysql-test/main/mysql_upgrade_noengine.result index 5dfe8aeb289..79ad04e1849 100644 --- a/mysql-test/main/mysql_upgrade_noengine.result +++ b/mysql-test/main/mysql_upgrade_noengine.result @@ -1,3 +1,4 @@ +drop view mysql.user_bak; install soname 'ha_blackhole'; install soname 'ha_archive'; create table t1 (a int) engine=blackhole; @@ -61,6 +62,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv_bak OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -140,6 +142,9 @@ Warnings: Level Warning Code 1286 Message Unknown storage engine 'ARCHIVE' +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; Phase 1/7: Checking and upgrading mysql database Processing databases @@ -149,6 +154,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv_bak OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -228,6 +234,9 @@ Warnings: Level Warning Code 1286 Message Unknown storage engine 'ARCHIVE' +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +drop view mysql.user_bak; alter table mysql.user drop column default_role, drop column max_statement_time; Phase 1/7: Checking and upgrading mysql database Processing databases @@ -237,6 +246,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv_bak OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -303,3 +313,5 @@ table_comment drop table t1, t2; uninstall plugin blackhole; uninstall plugin archive; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; diff --git a/mysql-test/main/mysql_upgrade_noengine.test b/mysql-test/main/mysql_upgrade_noengine.test index 1d65e7ffa1c..e3c3e718591 100644 --- a/mysql-test/main/mysql_upgrade_noengine.test +++ b/mysql-test/main/mysql_upgrade_noengine.test @@ -11,6 +11,9 @@ if (!$HA_ARCHIVE_SO) { skip Need Archive plugin; } +source include/switch_to_mysql_user.inc; +drop view mysql.user_bak; + let $datadir= `select @@datadir`; install soname 'ha_blackhole'; @@ -33,6 +36,11 @@ exec $MYSQL_UPGRADE 2>&1; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +source include/switch_to_mysql_user.inc; +drop view mysql.user_bak; + # pretend it's an upgrade from 10.0 alter table mysql.user drop column default_role, drop column max_statement_time; @@ -47,6 +55,11 @@ exec $MYSQL_UPGRADE 2>&1; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t1'; select table_catalog, table_schema, table_name, table_type, engine, row_format, table_rows, data_length, table_comment from information_schema.tables where table_schema='test' and table_name='t2'; +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; +source include/switch_to_mysql_user.inc; +drop view mysql.user_bak; + alter table mysql.user drop column default_role, drop column max_statement_time; remove_file $datadir/mysql_upgrade_info; @@ -60,3 +73,6 @@ drop table t1, t2; remove_file $datadir/mysql_upgrade_info; uninstall plugin blackhole; uninstall plugin archive; + +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; diff --git a/mysql-test/main/mysql_upgrade_ssl.result b/mysql-test/main/mysql_upgrade_ssl.result index 6c6d0859016..ff911e9f54b 100644 --- a/mysql-test/main/mysql_upgrade_ssl.result +++ b/mysql-test/main/mysql_upgrade_ssl.result @@ -9,6 +9,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -31,9 +32,9 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK Phase 4/7: Running 'mysql_fix_privilege_tables' Phase 5/7: Fixing table and database names Phase 6/7: Checking and upgrading tables diff --git a/mysql-test/main/mysql_upgrade_view.result b/mysql-test/main/mysql_upgrade_view.result index 3d885c569bb..d22298c6ed0 100644 --- a/mysql-test/main/mysql_upgrade_view.result +++ b/mysql-test/main/mysql_upgrade_view.result @@ -71,6 +71,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -99,7 +100,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -113,6 +113,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views +mysql.user OK test.v1 OK test.v1badcheck OK test.v2 OK @@ -210,7 +211,7 @@ v3 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VI show create view v4; View Create View character_set_client collation_connection v4 CREATE ALGORITHM=TEMPTABLE DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v4` AS select `t1`.`a` AS `a` from `t1` latin1 latin1_swedish_ci -MySQL upgrade detected +MariaDB upgrade detected Phase 1/7: Checking and upgrading mysql database Processing databases mysql @@ -220,6 +221,7 @@ mysql.db OK mysql.ev_bk OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -248,7 +250,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -262,6 +263,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views from mysql +mysql.user OK test.v1 OK test.v2 OK test.v3 OK @@ -334,7 +336,7 @@ drop view v1,v2,v3,v4; rename table mysql.event to mysql.ev_bk; flush tables; The --upgrade-system-tables option was used, user tables won't be touched. -MySQL upgrade detected +MariaDB upgrade detected Phase 1/7: Checking and upgrading mysql database Processing databases mysql @@ -344,6 +346,7 @@ mysql.db OK mysql.ev_bk OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -372,7 +375,6 @@ mysql.time_zone_transition_type OK mysql.transaction_registry Error : Unknown storage engine 'InnoDB' error : Corrupt -mysql.user OK Repairing tables mysql.innodb_index_stats @@ -386,6 +388,7 @@ Error : Unknown storage engine 'InnoDB' error : Corrupt Phase 2/7: Installing used storage engines... Skipped Phase 3/7: Fixing views from mysql +mysql.user OK test.v1 OK test.v2 OK test.v3 OK diff --git a/mysql-test/main/mysqlbinlog_row_compressed.result b/mysql-test/main/mysqlbinlog_row_compressed.result index 705683322f8..8cf52f5b826 100644 --- a/mysql-test/main/mysqlbinlog_row_compressed.result +++ b/mysql-test/main/mysqlbinlog_row_compressed.result @@ -61,7 +61,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") # server id 1 end_log_pos 899 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 899 -# server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 967 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -90,7 +90,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) # server id 1 end_log_pos 1214 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1214 -# server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1281 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -119,7 +119,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") # server id 1 end_log_pos 1530 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1530 -# server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1596 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -148,7 +148,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") # server id 1 end_log_pos 1842 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1842 -# server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1909 CRC32 XXX Write_compressed_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -177,7 +177,7 @@ BEGIN #Q> INSERT INTO t2 SELECT * FROM t1 # server id 1 end_log_pos 2134 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2134 -# server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 2225 CRC32 XXX Write_compressed_rows: table id 33 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -239,7 +239,7 @@ BEGIN #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL # server id 1 end_log_pos 2462 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2462 -# server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 2561 CRC32 XXX Update_compressed_rows: table id 33 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -320,7 +320,7 @@ BEGIN #Q> DELETE FROM t1 # server id 1 end_log_pos 2769 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 2769 -# server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 2861 CRC32 XXX Delete_compressed_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -382,7 +382,7 @@ BEGIN #Q> DELETE FROM t2 # server id 1 end_log_pos 3069 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 3069 -# server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 3154 CRC32 XXX Delete_compressed_rows: table id 33 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ diff --git a/mysql-test/main/mysqlbinlog_row_minimal.result b/mysql-test/main/mysqlbinlog_row_minimal.result index a030f202f45..680fd8196a8 100644 --- a/mysql-test/main/mysqlbinlog_row_minimal.result +++ b/mysql-test/main/mysqlbinlog_row_minimal.result @@ -59,7 +59,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (10, 1, 2, 3, 4, 5, 6, 7, "") # server id 1 end_log_pos 946 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 946 -# server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1015 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -88,7 +88,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (11, 1, 2, 3, 4, 5, 6, 7, NULL) # server id 1 end_log_pos 1262 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1262 -# server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1330 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=11 /* INT meta=0 nullable=0 is_null=0 */ @@ -117,7 +117,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (12, 1, 2, 3, NULL, 5, 6, 7, "A") # server id 1 end_log_pos 1579 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1579 -# server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1646 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=12 /* INT meta=0 nullable=0 is_null=0 */ @@ -146,7 +146,7 @@ BEGIN #Q> INSERT INTO t1 VALUES (13, 1, 2, 3, 0, 5, 6, 7, "A") # server id 1 end_log_pos 1892 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 1892 -# server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 1962 CRC32 XXX Write_rows: table id 32 flags: STMT_END_F ### INSERT INTO `test`.`t1` ### SET ### @1=13 /* INT meta=0 nullable=0 is_null=0 */ @@ -175,7 +175,7 @@ BEGIN #Q> INSERT INTO t2 SELECT * FROM t1 # server id 1 end_log_pos 2187 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2187 -# server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 2354 CRC32 XXX Write_rows: table id 33 flags: STMT_END_F ### INSERT INTO `test`.`t2` ### SET ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -237,7 +237,7 @@ BEGIN #Q> UPDATE t2 SET f4=5 WHERE f4>0 or f4 is NULL # server id 1 end_log_pos 2591 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 2591 -# server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 2665 CRC32 XXX Update_rows: table id 33 flags: STMT_END_F ### UPDATE `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -273,7 +273,7 @@ BEGIN #Q> DELETE FROM t1 # server id 1 end_log_pos 2873 CRC32 XXX Table_map: `test`.`t1` mapped to number num # at 2873 -# server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 30 flags: STMT_END_F +# server id 1 end_log_pos 2927 CRC32 XXX Delete_rows: table id 32 flags: STMT_END_F ### DELETE FROM `test`.`t1` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ @@ -303,7 +303,7 @@ BEGIN #Q> DELETE FROM t2 # server id 1 end_log_pos 3135 CRC32 XXX Table_map: `test`.`t2` mapped to number num # at 3135 -# server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 31 flags: STMT_END_F +# server id 1 end_log_pos 3189 CRC32 XXX Delete_rows: table id 33 flags: STMT_END_F ### DELETE FROM `test`.`t2` ### WHERE ### @1=10 /* INT meta=0 nullable=0 is_null=0 */ diff --git a/mysql-test/main/mysqlcheck.result b/mysql-test/main/mysqlcheck.result index 2b4d4cb5647..063560e388e 100644 --- a/mysql-test/main/mysqlcheck.result +++ b/mysql-test/main/mysqlcheck.result @@ -9,6 +9,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -31,7 +32,6 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK mtr.global_suppressions Table is already up to date mtr.test_suppressions Table is already up to date mysql.column_stats OK @@ -39,6 +39,7 @@ mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -67,12 +68,12 @@ mysql.time_zone_transition_type OK mysql.transaction_registry note : Table does not support optimize, doing recreate + analyze instead status : OK -mysql.user OK mysql.column_stats OK mysql.columns_priv OK mysql.db OK mysql.event OK mysql.func OK +mysql.global_priv OK mysql.gtid_slave_pos OK mysql.help_category OK mysql.help_keyword OK @@ -95,12 +96,12 @@ mysql.time_zone_name OK mysql.time_zone_transition OK mysql.time_zone_transition_type OK mysql.transaction_registry OK -mysql.user OK mysql.column_stats Table is already up to date mysql.columns_priv Table is already up to date mysql.db Table is already up to date mysql.event Table is already up to date mysql.func Table is already up to date +mysql.global_priv Table is already up to date mysql.gtid_slave_pos Table is already up to date mysql.help_category Table is already up to date mysql.help_keyword Table is already up to date @@ -129,7 +130,6 @@ mysql.time_zone_transition_type Table is already up to date mysql.transaction_registry note : Table does not support optimize, doing recreate + analyze instead status : OK -mysql.user Table is already up to date create table t1 (a int) engine=myisam; create view v1 as select * from t1; test.t1 OK @@ -429,6 +429,7 @@ mysql.columns_priv Table is already up to date mysql.db Table is already up to date mysql.event Table is already up to date mysql.func Table is already up to date +mysql.global_priv Table is already up to date mysql.gtid_slave_pos Table is already up to date mysql.help_category Table is already up to date mysql.help_keyword Table is already up to date @@ -451,7 +452,6 @@ mysql.time_zone_name Table is already up to date mysql.time_zone_transition Table is already up to date mysql.time_zone_transition_type Table is already up to date mysql.transaction_registry OK -mysql.user Table is already up to date mysqltest1.t1 warning : Table is marked as crashed warning : Size of datafile is: 4 Should be: 0 diff --git a/mysql-test/main/mysqld--help.result b/mysql-test/main/mysqld--help.result index 8032702ffbb..d621c5c8cae 100644 --- a/mysql-test/main/mysqld--help.result +++ b/mysql-test/main/mysqld--help.result @@ -294,6 +294,15 @@ The following specify which files/extra groups are read (specified before remain --group-concat-max-len=# The maximum length of the result of function GROUP_CONCAT() + --gtid-cleanup-batch-size=# + Normally does not need tuning. How many old rows must + accumulate in the mysql.gtid_slave_pos table before a + background job will be run to delete them. Can be + increased to reduce number of commits if using many + different engines with --gtid_pos_auto_engines, or to + reduce CPU overhead if using a huge number of different + gtid_domain_ids. Can be decreased to reduce number of old + rows in the table. --gtid-domain-id=# Used with global transaction ID to identify logically independent replication streams. When events can propagate through multiple parallel paths (for example @@ -537,6 +546,10 @@ The following specify which files/extra groups are read (specified before remain The maximum BLOB length to send to server from mysql_send_long_data API. Deprecated option; use max_allowed_packet instead. + --max-password-errors=# + If there is more than this number of failed connect + attempts due to invalid password, user will be blocked + from further connections until FLUSH_PRIVILEGES. --max-prepared-stmt-count=# Maximum number of prepared statements in the server --max-recursive-iterations[=#] @@ -1209,7 +1222,12 @@ The following specify which files/extra groups are read (specified before remain ERROR_FOR_DIVISION_BY_ZERO, TRADITIONAL, NO_AUTO_CREATE_USER, HIGH_NOT_PRECEDENCE, NO_ENGINE_SUBSTITUTION, PAD_CHAR_TO_FULL_LENGTH, - EMPTY_STRING_IS_NULL, SIMULTANEOUS_ASSIGNMENT + EMPTY_STRING_IS_NULL, SIMULTANEOUS_ASSIGNMENT, + TIME_ROUND_FRACTIONAL + --sql-safe-updates If set to 1, UPDATEs and DELETEs need either a key in the + WHERE clause, or a LIMIT clause, or else they will + aborted. Prevents the common mistake of accidentally + deleting or updating every row in a table. --stack-trace Print a symbolic stack trace on failure (Defaults to on; use --skip-stack-trace to disable.) --standard-compliant-cte @@ -1344,7 +1362,8 @@ The following specify which files/extra groups are read (specified before remain (usually get from GUI tools) --use-stat-tables=name Specifies how to use system statistics tables. One of: - NEVER, COMPLEMENTARY, PREFERABLY + NEVER, COMPLEMENTARY, PREFERABLY, + COMPLEMENTARY_FOR_QUERIES, PREFERABLY_FOR_QUERIES -u, --user=name Run mysqld daemon as user. --userstat Enables statistics gathering for USER_STATISTICS, CLIENT_STATISTICS, INDEX_STATISTICS and TABLE_STATISTICS @@ -1409,7 +1428,7 @@ encrypt-binlog FALSE encrypt-tmp-disk-tables FALSE encrypt-tmp-files FALSE enforce-storage-engine (No default value) -eq-range-index-dive-limit 0 +eq-range-index-dive-limit 10 event-scheduler OFF expensive-subquery-limit 100 expire-logs-days 0 @@ -1429,6 +1448,7 @@ gdb FALSE general-log FALSE getopt-prefix-matching FALSE group-concat-max-len 1048576 +gtid-cleanup-batch-size 64 gtid-domain-id 0 gtid-ignore-duplicates FALSE gtid-pos-auto-engines @@ -1502,6 +1522,7 @@ max-heap-table-size 16777216 max-join-size 18446744073709551615 max-length-for-sort-data 1024 max-long-data-size 16777216 +max-password-errors 18446744073709551615 max-prepared-stmt-count 16382 max-recursive-iterations 18446744073709551615 max-relay-log-size 1073741824 @@ -1542,7 +1563,7 @@ optimizer-prune-level 1 optimizer-search-depth 62 optimizer-selectivity-sampling-limit 100 optimizer-switch index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=off,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on -optimizer-use-condition-selectivity 1 +optimizer-use-condition-selectivity 4 performance-schema FALSE performance-schema-accounts-size -1 performance-schema-consumer-events-stages-current FALSE @@ -1579,7 +1600,7 @@ performance-schema-max-rwlock-instances -1 performance-schema-max-socket-classes 10 performance-schema-max-socket-instances -1 performance-schema-max-stage-classes 160 -performance-schema-max-statement-classes 200 +performance-schema-max-statement-classes 202 performance-schema-max-table-handles -1 performance-schema-max-table-instances -1 performance-schema-max-thread-classes 50 @@ -1668,6 +1689,7 @@ slow-launch-time 2 slow-query-log FALSE 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 stack-trace TRUE standard-compliant-cte TRUE stored-program-cache 256 @@ -1707,7 +1729,7 @@ transaction-isolation REPEATABLE-READ transaction-prealloc-size 4096 transaction-read-only FALSE updatable-views-with-limit YES -use-stat-tables NEVER +use-stat-tables PREFERABLY_FOR_QUERIES userstat FALSE verbose TRUE wait-timeout 28800 diff --git a/mysql-test/main/mysqld_option_err.test b/mysql-test/main/mysqld_option_err.test index 0c38eba7ca9..e9655fd4bfe 100644 --- a/mysql-test/main/mysqld_option_err.test +++ b/mysql-test/main/mysqld_option_err.test @@ -56,4 +56,6 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --error 2 --exec $MYSQLD_BOOTSTRAP_CMD --not-known-option --help --verbose >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 +rmdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; + --echo Done. diff --git a/mysql-test/main/mysqldump-max.result b/mysql-test/main/mysqldump-max.result index b75eb969da6..f936184849f 100644 --- a/mysql-test/main/mysqldump-max.result +++ b/mysql-test/main/mysqldump-max.result @@ -81,7 +81,7 @@ id name /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -178,7 +178,7 @@ INSERT IGNORE INTO `t6` VALUES (1,'first value'),(2,'first value'),(3,'first va /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; diff --git a/mysql-test/main/mysqldump-max.test b/mysql-test/main/mysqldump-max.test index c0596f27e4f..4aadb09de53 100644 --- a/mysql-test/main/mysqldump-max.test +++ b/mysql-test/main/mysqldump-max.test @@ -1,3 +1,5 @@ +--source include/have_utf8mb4.inc + # Embedded server doesn't support external clients --source include/not_embedded.inc --source include/have_innodb.inc diff --git a/mysql-test/main/mysqldump-utf8mb4.result b/mysql-test/main/mysqldump-utf8mb4.result new file mode 100644 index 00000000000..3bafd6da6c9 --- /dev/null +++ b/mysql-test/main/mysqldump-utf8mb4.result @@ -0,0 +1,86 @@ +SET NAMES utf8mb4; +# +# MDEV-8765 mysqldump silently corrupts 4-byte UTF-8 data +# +CREATE TABLE t1 ( +point VARCHAR(10) PRIMARY KEY, +data VARCHAR(10), +comment VARCHAR(64) +) CHARACTER SET utf8mb4; +INSERT INTO t1 VALUES ('01f300', UNHEX('f09f8c80'), 'U+1F300 CYCLONE'); +---- +Testing XML format output +---- + + + + + + + + + + + + 01f300 + 🌀 + U+1F300 CYCLONE + + + + +---- +Testing text format output +---- + +/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; +/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; +/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; +/*!40101 SET NAMES utf8mb4 */; +/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; +/*!40103 SET TIME_ZONE='+00:00' */; +/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; +/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; +/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; +/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */; +DROP TABLE IF EXISTS `t1`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `t1` ( + `point` varchar(10) NOT NULL, + `data` varchar(10) DEFAULT NULL, + `comment` varchar(64) DEFAULT NULL, + PRIMARY KEY (`point`) +); +/*!40101 SET character_set_client = @saved_cs_client */; + +LOCK TABLES `t1` WRITE; +/*!40000 ALTER TABLE `t1` DISABLE KEYS */; +INSERT INTO `t1` VALUES ('01f300','🌀','U+1F300 CYCLONE'); +/*!40000 ALTER TABLE `t1` ENABLE KEYS */; +UNLOCK TABLES; +/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */; + +/*!40101 SET SQL_MODE=@OLD_SQL_MODE */; +/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */; +/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */; +/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */; +/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */; +/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; +/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; + +DROP TABLE t1; +---- +Testing text format dump/restore +---- +CREATE TABLE t1 ( +point VARCHAR(10) PRIMARY KEY, +data VARCHAR(10), +comment VARCHAR(64) +) CHARACTER SET utf8mb4; +INSERT INTO t1 VALUES ('01f300', UNHEX('f09f8c80'), 'U+1F300 CYCLONE'); +DROP TABLE t1; +SELECT * FROM t1; +point data comment +01f300 🌀 U+1F300 CYCLONE +DROP TABLE t1; diff --git a/mysql-test/main/mysqldump-utf8mb4.test b/mysql-test/main/mysqldump-utf8mb4.test new file mode 100644 index 00000000000..f8512c9bd7b --- /dev/null +++ b/mysql-test/main/mysqldump-utf8mb4.test @@ -0,0 +1,49 @@ +--source include/have_utf8mb4.inc +--source include/not_embedded.inc + +SET NAMES utf8mb4; + +--echo # +--echo # MDEV-8765 mysqldump silently corrupts 4-byte UTF-8 data +--echo # + +CREATE TABLE t1 ( + point VARCHAR(10) PRIMARY KEY, + data VARCHAR(10), + comment VARCHAR(64) +) CHARACTER SET utf8mb4; +INSERT INTO t1 VALUES ('01f300', UNHEX('f09f8c80'), 'U+1F300 CYCLONE'); + +--echo ---- +--echo Testing XML format output +--echo ---- + +--exec $MYSQL_DUMP --skip-create-options --skip-comments -X test t1 + + +--echo ---- +--echo Testing text format output +--echo ---- + +--exec $MYSQL_DUMP --skip-create-options --skip-comments test t1 +DROP TABLE t1; + + +--echo ---- +--echo Testing text format dump/restore +--echo ---- + +--let $file = $MYSQLTEST_VARDIR/tmp/mysqldump-utf8mb4.sql + +CREATE TABLE t1 ( + point VARCHAR(10) PRIMARY KEY, + data VARCHAR(10), + comment VARCHAR(64) +) CHARACTER SET utf8mb4; +INSERT INTO t1 VALUES ('01f300', UNHEX('f09f8c80'), 'U+1F300 CYCLONE'); + +--exec $MYSQL_DUMP test t1 > $file +DROP TABLE t1; +--exec $MYSQL test < $file +SELECT * FROM t1; +DROP TABLE t1; diff --git a/mysql-test/main/mysqldump.result b/mysql-test/main/mysqldump.result index cc4d182552b..c40aa271465 100644 --- a/mysql-test/main/mysqldump.result +++ b/mysql-test/main/mysqldump.result @@ -91,7 +91,7 @@ INSERT INTO `t1` VALUES (1.23450,2.3456),(1.23450,2.3456),(1.23450,2.3456),(1.23 /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -202,7 +202,7 @@ INSERT INTO t1 VALUES (_koi8r x'C1C2C3C4C5'), (NULL); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -305,7 +305,7 @@ create table t1(a int); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -364,7 +364,7 @@ set global sql_mode='ANSI_QUOTES'; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -429,7 +429,7 @@ insert into t1 values (1),(2),(3); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='' */; @@ -461,7 +461,7 @@ drop table t1; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -487,7 +487,7 @@ create database mysqldump_test_db character set latin2 collate latin2_bin; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -521,7 +521,7 @@ INSERT INTO t1 VALUES (_latin1 ' /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -639,7 +639,7 @@ INSERT INTO t2 VALUES (4),(5),(6); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -680,7 +680,7 @@ INSERT INTO `t1` VALUES (0x602010000280100005E71A); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -721,7 +721,7 @@ INSERT INTO t1 VALUES (4),(5),(6); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -755,7 +755,7 @@ UNLOCK TABLES; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1124,7 +1124,7 @@ insert into t1 (F_8d3bba7425e7c98c50f52ca1b52d3735) values (1); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1493,7 +1493,7 @@ INSERT INTO t1 VALUES (1),(2),(3); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1543,7 +1543,7 @@ INSERT INTO t2 VALUES (1), (2); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1578,7 +1578,7 @@ CREATE TABLE `t2` ( /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1726,7 +1726,7 @@ insert into t2 (a, b) values (NULL, NULL),(10, NULL),(NULL, "twenty"),(30, "thir /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; @@ -1757,7 +1757,7 @@ UNLOCK TABLES; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1874,7 +1874,7 @@ create table t3(a int); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1923,7 +1923,7 @@ mysqldump: Got error: 1064: "You have an error in your SQL syntax; check the man /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -1993,7 +1993,7 @@ UNLOCK TABLES; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2047,7 +2047,7 @@ create view v2 as select * from t2 where a like 'a%' with check option; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2143,7 +2143,7 @@ create view v1 as select * from t1; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2215,7 +2215,7 @@ create view v2 as select * from t2 where a like 'a%' with check option; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2282,7 +2282,7 @@ INSERT INTO t1 VALUES ('\''); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2328,7 +2328,7 @@ select v3.a from v3, v1 where v1.a=v3.a and v3.b=3 limit 1; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2483,7 +2483,7 @@ update t1 set a = 4 where a=3; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2612,7 +2612,7 @@ DELIMITER ; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2759,7 +2759,7 @@ set sql_mode=''; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2910,7 +2910,7 @@ set global time_zone='Europe/Moscow'; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -2949,7 +2949,7 @@ UNLOCK TABLES; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; /*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */; @@ -3083,7 +3083,7 @@ a b c /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -3214,7 +3214,7 @@ SET SQL_MODE = @old_sql_mode; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -3277,7 +3277,7 @@ insert into t1 values ('',''); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -3312,7 +3312,7 @@ UNLOCK TABLES; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -3485,7 +3485,7 @@ insert into t1 values (0815); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -3769,7 +3769,7 @@ CREATE TABLE t1 (a INT) ENGINE=merge UNION=(t2, t3); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -3961,7 +3961,7 @@ create view db42635.v2 (c) as select * from db42635.t1; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -4107,7 +4107,7 @@ INSERT INTO t1 VALUES (3,4), (4,5); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -4335,12 +4335,12 @@ second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL E show create event ee1; Event sql_mode time_zone Create Event character_set_client collation_connection Database Collation ee1 UTC CREATE DEFINER=`root`@`localhost` EVENT `ee1` ON SCHEDULE AT '2035-12-31 20:01:23' ON COMPLETION NOT PRESERVE ENABLE DO set @a=5 latin1 latin1_swedish_ci latin1_swedish_ci -create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation second ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci -second ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +second ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci second ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database second; create database third; @@ -4348,7 +4348,7 @@ use third; show events; Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation third ee1 root@localhost UTC ONE TIME 2035-12-31 20:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci -third ee2 root@localhost UTC ONE TIME 2018-12-31 21:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci +third ee2 root@localhost UTC ONE TIME 2030-12-31 21:01:22 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci third ee3 root@localhost UTC ONE TIME 2030-12-31 22:01:23 NULL NULL NULL NULL ENABLED 1 latin1 latin1_swedish_ci latin1_swedish_ci drop database third; set time_zone = 'SYSTEM'; @@ -4370,7 +4370,7 @@ insert into t1 values (0815); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -5636,7 +5636,7 @@ INSERT INTO t1 (a) VALUES (1),(2),(3); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */; diff --git a/mysql-test/main/mysqldump.test b/mysql-test/main/mysqldump.test index 1eed0f9cf3f..e2d9cc74d32 100644 --- a/mysql-test/main/mysqldump.test +++ b/mysql-test/main/mysqldump.test @@ -1,3 +1,5 @@ +--source include/have_utf8mb4.inc + call mtr.add_suppression("@003f.frm' \\(errno: 22\\)"); #select * from mysql.user; #checksum table mysql.user; @@ -705,7 +707,7 @@ drop table t1; --echo # Bug#15328 Segmentation fault occurred if my.cnf is invalid for escape sequence --echo # ---exec $MYSQL_MY_PRINT_DEFAULTS --config-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump +--exec $MYSQL_MY_PRINT_DEFAULTS --defaults-file=$MYSQL_TEST_DIR/std_data/bug15328.cnf mysqldump --echo # --echo # Bug#19025 mysqldump doesn't correctly dump "auto_increment = [int]" @@ -1808,7 +1810,7 @@ show create event ee1; ## prove three works (with spaces and tabs on the end) # start with one from the previous restore -create event ee2 on schedule at '2018-12-31 21:01:23' do set @a=5; +create event ee2 on schedule at '2030-12-31 21:01:22' do set @a=5; create event ee3 on schedule at '2030-12-31 22:01:23' do set @a=5; show events; --exec $MYSQL_DUMP --events second > $MYSQLTEST_VARDIR/tmp/bug16853-2.sql diff --git a/mysql-test/main/mysqldump_restore.result b/mysql-test/main/mysqldump_restore.result index 4f9d55096ae..9eac8b253de 100644 --- a/mysql-test/main/mysqldump_restore.result +++ b/mysql-test/main/mysqldump_restore.result @@ -21,10 +21,6 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; # Recreated table: test.t1 # Original table: test.t1_orig include/diff_tables.inc [test.t1, test.t1_orig] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead # Cleanup DROP TABLE test.t1, test.t1_orig; # @@ -50,10 +46,6 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; # Recreated table: test.t1 # Original table: test.t1_orig include/diff_tables.inc [test.t1, test.t1_orig] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead # Cleanup DROP TABLE test.t1, test.t1_orig; # @@ -72,10 +64,6 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; # Recreated table: test.t1 # Original table: test.t1_orig include/diff_tables.inc [test.t1, test.t1_orig] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead # Cleanup DROP TABLE test.t1, test.t1_orig; # @@ -95,10 +83,6 @@ ALTER TABLE test.t2 RENAME to test.t2_orig; # Recreated table: test.t2 # Original table: test.t2_orig include/diff_tables.inc [test.t2, test.t2_orig] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead # Cleanup DROP TABLE test.t2, test.t2_orig; DROP TABLE t1; @@ -117,10 +101,6 @@ ALTER TABLE test.t1 RENAME to test.t1_orig; # Recreated table: test.t1 # Original table: test.t1_orig include/diff_tables.inc [test.t1, test.t1_orig] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead # Cleanup DROP TABLE test.t1, test.t1_orig; # End tests diff --git a/mysql-test/main/not_embedded_server.result b/mysql-test/main/not_embedded_server.result index ba68ca8619b..bc794ce48c8 100644 --- a/mysql-test/main/not_embedded_server.result +++ b/mysql-test/main/not_embedded_server.result @@ -1,4 +1,4 @@ -call mtr.add_suppression("Can't open and lock privilege tables: Table 'user' was not locked with LOCK TABLES"); +call mtr.add_suppression("Can't open and lock privilege tables: Table 'db' was not locked with LOCK TABLES"); SHOW VARIABLES like 'slave_skip_errors'; Variable_name Value slave_skip_errors OFF @@ -16,7 +16,7 @@ DROP TABLE IF EXISTS t1; CREATE TABLE t1 (c1 INT); LOCK TABLES t1 READ; FLUSH PRIVILEGES; -ERROR HY000: Table 'user' was not locked with LOCK TABLES +ERROR HY000: Table 'db' was not locked with LOCK TABLES UNLOCK TABLES; DROP TABLE t1; # diff --git a/mysql-test/main/not_embedded_server.test b/mysql-test/main/not_embedded_server.test index b2cbdba6850..20f75db25d5 100644 --- a/mysql-test/main/not_embedded_server.test +++ b/mysql-test/main/not_embedded_server.test @@ -6,7 +6,7 @@ # End of 4.1 tests -call mtr.add_suppression("Can't open and lock privilege tables: Table 'user' was not locked with LOCK TABLES"); +call mtr.add_suppression("Can't open and lock privilege tables: Table 'db' was not locked with LOCK TABLES"); # # Bug#43835: SHOW VARIABLES does not include 0 for slave_skip_errors diff --git a/mysql-test/main/null.result b/mysql-test/main/null.result index 2fa89a2d001..6601c5e1ed4 100644 --- a/mysql-test/main/null.result +++ b/mysql-test/main/null.result @@ -515,9 +515,9 @@ NULLIF(TIMESTAMP'2001-01-01 00:00:00',1e0), NULLIF(TIMESTAMP'2001-01-01 00:00:00','2001-01-01'), NULLIF(TIMESTAMP'2001-01-01 00:00:00',TIME'00:00:00'); Warnings: -Warning 1292 Incorrect datetime value: '1' -Warning 1292 Incorrect datetime value: '1.0' -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1.0' +Warning 1292 Truncated incorrect datetime value: '1' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -536,9 +536,9 @@ NULLIF(DATE'2001-01-01',1e0), NULLIF(DATE'2001-01-01','2001-01-01'), NULLIF(DATE'2001-01-01',TIME'00:00:00'); Warnings: -Warning 1292 Incorrect datetime value: '1' -Warning 1292 Incorrect datetime value: '1.0' -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1.0' +Warning 1292 Truncated incorrect datetime value: '1' SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -1640,8 +1640,8 @@ CASE WHEN TIMESTAMP'2001-01-01 00:00:00'=1 THEN NULL ELSE TIMESTAMP'2001-01-01 00:00:00' END AS b; Warnings: -Warning 1292 Incorrect datetime value: '1' -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' DROP TABLE t1; # # MDEV-8785 Wrong results for EXPLAIN EXTENDED...WHERE NULLIF(latin1_col, _utf8'a' COLLATE utf8_bin) IS NOT NULL diff --git a/mysql-test/main/null_key.result b/mysql-test/main/null_key.result index 4b4a4b80dee..b152596daca 100644 --- a/mysql-test/main/null_key.result +++ b/mysql-test/main/null_key.result @@ -399,8 +399,11 @@ INSERT INTO t3 SELECT * FROM t4; INSERT INTO t3 VALUES (2), (3); ANALYZE table t1, t2, t3; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status OK SELECT COUNT(*) FROM t3; COUNT(*) diff --git a/mysql-test/main/old-mode.result b/mysql-test/main/old-mode.result index 73ad613048a..e0a3412bbdf 100644 --- a/mysql-test/main/old-mode.result +++ b/mysql-test/main/old-mode.result @@ -180,3 +180,44 @@ a unix_timestamp(a) 2010-10-31 02:25:26 1288481126 drop table t1, t2; set time_zone=DEFAULT; +# +# MDEV-13995 MAX(timestamp) returns a wrong result near DST change +# +SET global mysql56_temporal_format=false; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP(0)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +SELECT a, COALESCE(a), UNIX_TIMESTAMP(a) FROM t1; +a COALESCE(a) UNIX_TIMESTAMP(a) +2010-10-31 02:25:26 2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:25 2010-10-31 02:25:25 1288481125 +SELECT MIN(a), UNIX_TIMESTAMP(MIN(a)) AS a FROM t1; +MIN(a) a +2010-10-31 02:25:26 1288477526 +SELECT MAX(a), UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +MAX(a) a +2010-10-31 02:25:25 1288481125 +SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 WHERE t1.a=t2.a; +a UNIX_TIMESTAMP(t1.a) a UNIX_TIMESTAMP(t2.a) +2010-10-31 02:25:26 1288477526 2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:25 1288481125 2010-10-31 02:25:25 1288481125 +ALTER TABLE t1 MODIFY a TIMESTAMP(1); +SELECT a, COALESCE(a), UNIX_TIMESTAMP(a) FROM t1; +a COALESCE(a) UNIX_TIMESTAMP(a) +2010-10-31 02:25:26.0 2010-10-31 02:25:26.0 1288477526.0 +2010-10-31 02:25:25.0 2010-10-31 02:25:25.0 1288481125.0 +SELECT MIN(a), UNIX_TIMESTAMP(MIN(a)) AS a FROM t1; +MIN(a) a +2010-10-31 02:25:26.0 1288477526.0 +SELECT MAX(a), UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +MAX(a) a +2010-10-31 02:25:25.0 1288481125.0 +SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 WHERE t1.a=t2.a; +a UNIX_TIMESTAMP(t1.a) a UNIX_TIMESTAMP(t2.a) +2010-10-31 02:25:26.0 1288477526.0 2010-10-31 02:25:26.0 1288477526.0 +2010-10-31 02:25:25.0 1288481125.0 2010-10-31 02:25:25.0 1288481125.0 +DROP TABLE t1; +SET time_zone=DEFAULT; +SET global mysql56_temporal_format=true; diff --git a/mysql-test/main/old-mode.test b/mysql-test/main/old-mode.test index d7e8ce8ee55..7ec2092009b 100644 --- a/mysql-test/main/old-mode.test +++ b/mysql-test/main/old-mode.test @@ -119,3 +119,32 @@ insert t2 select a from t1; select a, unix_timestamp(a) from t2; drop table t1, t2; set time_zone=DEFAULT; + + +--echo # +--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change +--echo # + +# This tests: +# Field_timestamp::val_native() +# Field_timestamp_hires::val_native() +# Type_handler_timestamp_common::type_handler_for_native_format() + +SET global mysql56_temporal_format=false; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP(0)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +SELECT a, COALESCE(a), UNIX_TIMESTAMP(a) FROM t1; +SELECT MIN(a), UNIX_TIMESTAMP(MIN(a)) AS a FROM t1; +SELECT MAX(a), UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 WHERE t1.a=t2.a; +ALTER TABLE t1 MODIFY a TIMESTAMP(1); +SELECT a, COALESCE(a), UNIX_TIMESTAMP(a) FROM t1; +SELECT MIN(a), UNIX_TIMESTAMP(MIN(a)) AS a FROM t1; +SELECT MAX(a), UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +SELECT t1.a, UNIX_TIMESTAMP(t1.a), t2.a, UNIX_TIMESTAMP(t2.a) FROM t1 t1, t1 t2 WHERE t1.a=t2.a; +DROP TABLE t1; +SET time_zone=DEFAULT; +SET global mysql56_temporal_format=true; diff --git a/mysql-test/main/openssl_1.result b/mysql-test/main/openssl_1.result index ca8d71895e2..96b1895d57b 100644 --- a/mysql-test/main/openssl_1.result +++ b/mysql-test/main/openssl_1.result @@ -4,52 +4,38 @@ drop table if exists t1; create table t1(f1 int); insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; -grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; -grant select on test.* to ssl_user4@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; -grant select on test.* to ssl_user5@localhost require cipher "AES256-SHA" AND SUBJECT "xxx"; +grant select on test.* to ssl_user3@localhost require SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; +grant select on test.* to ssl_user4@localhost require SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; +grant select on test.* to ssl_user5@localhost require SUBJECT "xxx"; flush privileges; -connect con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA; -connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET); -connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA; -ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO) -connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA; -connect con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA; -connect con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA; +connect con1,localhost,ssl_user1,,,,,SSL; +connect con3,localhost,ssl_user3,,,,,SSL; +connect con4,localhost,ssl_user4,,,,,SSL; connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET); -connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA; +connect con5,localhost,ssl_user5,,,,,SSL; ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO) connection con1; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher AES256-SHA +SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 select * from t1; f1 5 delete from t1; ERROR 42000: DELETE command denied to user 'ssl_user1'@'localhost' for table 't1' -connection con2; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher AES256-SHA -select * from t1; -f1 -5 -delete from t1; -ERROR 42000: DELETE command denied to user 'ssl_user2'@'localhost' for table 't1' connection con3; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher AES256-SHA +SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 select * from t1; f1 5 delete from t1; ERROR 42000: DELETE command denied to user 'ssl_user3'@'localhost' for table 't1' connection con4; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher AES256-SHA +SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +have_ssl +1 select * from t1; f1 5 @@ -57,20 +43,15 @@ delete from t1; ERROR 42000: DELETE command denied to user 'ssl_user4'@'localhost' for table 't1' connection default; disconnect con1; -disconnect con2; disconnect con3; disconnect con4; -drop user ssl_user1@localhost, ssl_user2@localhost, -ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost; +drop user ssl_user1@localhost, ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost; drop table t1; mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxx -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher AES256-SHA have_ssl 1 End of 5.0 tests @@ -94,19 +75,13 @@ SSL_ACCEPTS # SSL_CALLBACK_CACHE_HITS # DROP TABLE thread_status; SET GLOBAL event_scheduler=0; -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher AES128-SHA -SHOW STATUS LIKE 'Ssl_cipher'; -Variable_name Value -Ssl_cipher AES128-SHA -mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxxCREATE TABLE t1(a int); +CREATE TABLE t1(a int); INSERT INTO t1 VALUES (1), (2); /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -140,7 +115,7 @@ UNLOCK TABLES; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -174,7 +149,7 @@ UNLOCK TABLES; /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; @@ -204,19 +179,12 @@ UNLOCK TABLES; /*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */; /*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */; -mysqldump: Got error: 2026: SSL connection error: xxxx +mysqldump: Got error: 2026: "SSL connection error: xxxx DROP TABLE t1; -Variable_name Value -Ssl_cipher AES256-SHA -Variable_name Value -Ssl_cipher AES128-SHA -select 'is still running; no cipher request crashed the server' as result from dual; -result -is still running; no cipher request crashed the server GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; connect con1,localhost,bug42158,,,,,SSL; -SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; have_ssl 1 disconnect con1; diff --git a/mysql-test/main/openssl_1.test b/mysql-test/main/openssl_1.test index a3db700f787..27eeb0198b1 100644 --- a/mysql-test/main/openssl_1.test +++ b/mysql-test/main/openssl_1.test @@ -1,3 +1,6 @@ +# Needed for mysqldump +--source include/have_utf8mb4.inc + # Tests for SSL connections, only run if mysqld is compiled # with support for SSL. @@ -16,58 +19,45 @@ create table t1(f1 int); insert into t1 values (5); grant select on test.* to ssl_user1@localhost require SSL; -grant select on test.* to ssl_user2@localhost require cipher "AES256-SHA"; -grant select on test.* to ssl_user3@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; -grant select on test.* to ssl_user4@localhost require cipher "AES256-SHA" AND SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; -grant select on test.* to ssl_user5@localhost require cipher "AES256-SHA" AND SUBJECT "xxx"; +grant select on test.* to ssl_user3@localhost require SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client"; +grant select on test.* to ssl_user4@localhost require SUBJECT "/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client" ISSUER "/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB"; +grant select on test.* to ssl_user5@localhost require SUBJECT "xxx"; flush privileges; -connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA); +connect (con1,localhost,ssl_user1,,,,,SSL); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +connect (con3,localhost,ssl_user3,,,,,SSL); +connect (con4,localhost,ssl_user4,,,,,SSL); --replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT --error ER_ACCESS_DENIED_ERROR -connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA); -connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA); -connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA); -connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA); ---replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT ---error ER_ACCESS_DENIED_ERROR -connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA); +connect (con5,localhost,ssl_user5,,,,,SSL); connection con1; # Check ssl turned on -SHOW STATUS LIKE 'Ssl_cipher'; -select * from t1; ---error ER_TABLEACCESS_DENIED_ERROR -delete from t1; - -connection con2; -# Check ssl turned on -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; select * from t1; --error ER_TABLEACCESS_DENIED_ERROR delete from t1; connection con3; # Check ssl turned on -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; select * from t1; --error ER_TABLEACCESS_DENIED_ERROR delete from t1; connection con4; # Check ssl turned on -SHOW STATUS LIKE 'Ssl_cipher'; +SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; select * from t1; --error ER_TABLEACCESS_DENIED_ERROR delete from t1; connection default; disconnect con1; -disconnect con2; disconnect con3; disconnect con4; -drop user ssl_user1@localhost, ssl_user2@localhost, -ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost; +drop user ssl_user1@localhost, ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost; drop table t1; @@ -120,14 +110,6 @@ drop table t1; --exec $MYSQL_TEST --ssl-cert= --max-connect-retries=1 < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 --echo -# -# Bug#21611 Slave can't connect when master-ssl-cipher specified -# - Apparently selecting a cipher doesn't work at all -# - Use a cipher that both yaSSL and OpenSSL supports -# ---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql ---exec $MYSQL_TEST --ssl-cipher=AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 - # # Bug#25309 SSL connections without CA certificate broken since MySQL 5.0.23 # @@ -135,7 +117,7 @@ drop table t1; # verification of servers certificate by setting both ca certificate # and ca path to NULL # ---exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1 +--exec $MYSQL --ssl --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem -e "SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'" 2>&1 --echo End of 5.0 tests # @@ -176,25 +158,6 @@ SELECT variable_name, variable_value FROM thread_status; DROP TABLE thread_status; SET GLOBAL event_scheduler=0; -# -# Test to connect using a list of ciphers -# ---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql ---exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER:AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 - - -# Test to connect using a specifi cipher -# ---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit;" > $MYSQLTEST_VARDIR/tmp/test.sql ---exec $MYSQL_TEST --ssl-cipher=AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 - -# Test to connect using an unknown cipher -# ---exec echo "SHOW STATUS LIKE 'Ssl_cipher'; exit" > $MYSQLTEST_VARDIR/tmp/test.sql ---replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ ---error 1 ---exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 - # # Bug#27669 mysqldump: SSL connection error when trying to connect # @@ -211,36 +174,13 @@ INSERT INTO t1 VALUES (1), (2); # With wrong parameters --replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR mysqldump.exe mysqldump ---replace_regex /\"SSL connection error.*/SSL connection error: xxxx/ +--replace_regex /SSL connection error.*/SSL connection error: xxxx/ --error 2 --exec $MYSQL_DUMP --skip-create-options --skip-comments --ssl --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test 2>&1 --echo DROP TABLE t1; --remove_file $MYSQLTEST_VARDIR/tmp/test.sql -# -# Bug#39172 Asking for DH+non-RSA key with server set to use other key caused -# YaSSL to crash the server. -# - -# Common ciphers to openssl and yassl ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES256-SHA ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES128-SHA ---disable_query_log ---disable_result_log - -# Below here caused crashes. ################ ---error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=NOT----EXIST -# These probably exist but the server's keys can't be used to accept these kinds of connections. ---error 1,0 ---exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=AES128-RMD - -# If this gives a result, then the bug is fixed. ---enable_result_log ---enable_query_log -select 'is still running; no cipher request crashed the server' as result from dual; - # # Bug#42158: leak: SSL_get_peer_certificate() doesn't have matching X509_free() # @@ -248,7 +188,7 @@ select 'is still running; no cipher request crashed the server' as result from d GRANT SELECT ON test.* TO bug42158@localhost REQUIRE X509; FLUSH PRIVILEGES; connect(con1,localhost,bug42158,,,,,SSL); -SELECT (VARIABLE_VALUE <> '') AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; +SELECT VARIABLE_VALUE <> '' AS have_ssl FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME='Ssl_cipher'; disconnect con1; connection default; DROP USER bug42158@localhost; diff --git a/mysql-test/main/opt_tvc.result b/mysql-test/main/opt_tvc.result index fdbd932a433..d503dab4d99 100644 --- a/mysql-test/main/opt_tvc.result +++ b/mysql-test/main/opt_tvc.result @@ -51,7 +51,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED ALL NULL NULL NULL NULL 2 100.00 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`1` +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`_col_1` explain extended select * from t1 where a in ( @@ -98,7 +98,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) semi join ((values (1),(5)) `tvc_1`) where `test`.`t1`.`b` = `tvc_1`.`1` +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) semi join ((values (1),(5)) `tvc_1`) where `test`.`t1`.`b` = `tvc_1`.`_col_1` explain extended select * from t1 where a in ( @@ -154,7 +154,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) 4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(4)) `tvc_0` join `test`.`t2`) where `test`.`t2`.`b` = `tvc_0`.`3` +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (3),(4)) `tvc_0` join `test`.`t2`) where `test`.`t2`.`b` = `tvc_0`.`_col_1` explain extended select * from t1 where a in ( @@ -211,7 +211,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED ALL NULL NULL NULL NULL 2 100.00 4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`1` +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`_col_1` explain extended select * from ( select * @@ -270,7 +270,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED ALL NULL NULL NULL NULL 2 100.00 4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 with tvc_0 as (/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` in (1,2))/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`1` +Note 1003 with tvc_0 as (/* select#2 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` in (1,2))/* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`_col_1` explain extended select * from ( select * @@ -321,7 +321,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED ALL NULL NULL NULL NULL 2 100.00 4 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`1` +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`_col_1` explain extended select * from v2; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL distinct_key NULL NULL NULL 2 100.00 @@ -386,7 +386,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED t1 ALL NULL NULL NULL NULL 6 100.00 Using where; Using join buffer (flat, BNL join) 5 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0` join `test`.`t1`) where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` = `tvc_0`.`1` +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1),(2)) `tvc_0` join `test`.`t1`) where `test`.`t1`.`a` = 1 and `test`.`t1`.`a` = `tvc_0`.`_col_1` explain extended select * from t1 where a in ( @@ -507,11 +507,11 @@ a b explain extended select * from t3 where a in (1,4); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL distinct_key NULL NULL NULL 2 100.00 -1 PRIMARY t3 ref idx idx 5 tvc_0.1 3 100.00 +1 PRIMARY t3 ref idx idx 5 tvc_0._col_1 3 100.00 2 MATERIALIZED ALL NULL NULL NULL NULL 2 100.00 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t3` semi join ((values (1),(4)) `tvc_0`) where `test`.`t3`.`a` = `tvc_0`.`1` +Note 1003 /* select#1 */ select `test`.`t3`.`a` AS `a`,`test`.`t3`.`b` AS `b` from `test`.`t3` semi join ((values (1),(4)) `tvc_0`) where `test`.`t3`.`a` = `tvc_0`.`_col_1` # use vectors in IN predeicate set @@in_predicate_conversion_threshold= 4; select * from t1 where (a,b) in ((1,2),(3,4)); @@ -524,7 +524,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED ALL NULL NULL NULL NULL 2 100.00 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1,2),(3,4)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`1` and `test`.`t1`.`b` = `tvc_0`.`2` +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` semi join ((values (1,2),(3,4)) `tvc_0`) where `test`.`t1`.`a` = `tvc_0`.`_col_1` and `test`.`t1`.`b` = `tvc_0`.`_col_2` set @@in_predicate_conversion_threshold= 2; # trasformation works for the one IN predicate and doesn't work for the other set @@in_predicate_conversion_threshold= 5; @@ -543,7 +543,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED ALL NULL NULL NULL NULL 3 100.00 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` semi join ((values (1,3),(8,0),(5,1)) `tvc_0`) where `test`.`t2`.`a` = `tvc_0`.`1` and `test`.`t2`.`c` = `tvc_0`.`3` and (`tvc_0`.`1`,`test`.`t2`.`b`) in (((1,2)),((8,9))) +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` semi join ((values (1,3),(8,0),(5,1)) `tvc_0`) where `test`.`t2`.`a` = `tvc_0`.`_col_1` and `test`.`t2`.`c` = `tvc_0`.`_col_2` and (`tvc_0`.`_col_1`,`test`.`t2`.`b`) in (((1,2)),((8,9))) set @@in_predicate_conversion_threshold= 2; # # mdev-14281: conversion of NOT IN predicate into subquery predicate @@ -571,7 +571,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED ALL NULL NULL NULL NULL 3 100.00 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<`test`.`t1`.`a`,`test`.`t1`.`b`>(((`test`.`t1`.`a`,`test`.`t1`.`b`),(`test`.`t1`.`a`,`test`.`t1`.`b`) in ( (/* select#2 */ select `tvc_0`.`1`,`tvc_0`.`2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`1` and `test`.`t1`.`b` = ``.`2`)))) +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where !<`test`.`t1`.`a`,`test`.`t1`.`b`>(((`test`.`t1`.`a`,`test`.`t1`.`b`),(`test`.`t1`.`a`,`test`.`t1`.`b`) in ( (/* select#2 */ select `tvc_0`.`_col_1`,`tvc_0`.`_col_2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`_col_1` and `test`.`t1`.`b` = ``.`_col_2`)))) explain extended select * from t1 where (a,b) not in (select * from (values (1,2),(8,9), (5,1)) as tvc_0); id select_type table type possible_keys key key_len ref rows filtered Extra @@ -593,7 +593,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED ALL NULL NULL NULL NULL 3 100.00 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` < 7 and !<`test`.`t1`.`a`,`test`.`t1`.`b`>(((`test`.`t1`.`a`,`test`.`t1`.`b`),(`test`.`t1`.`a`,`test`.`t1`.`b`) in ( (/* select#2 */ select `tvc_0`.`1`,`tvc_0`.`2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`1` and `test`.`t1`.`b` = ``.`2`)))) +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` < 7 and !<`test`.`t1`.`a`,`test`.`t1`.`b`>(((`test`.`t1`.`a`,`test`.`t1`.`b`),(`test`.`t1`.`a`,`test`.`t1`.`b`) in ( (/* select#2 */ select `tvc_0`.`_col_1`,`tvc_0`.`_col_2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), (`test`.`t1`.`a` in on distinct_key where `test`.`t1`.`a` = ``.`_col_1` and `test`.`t1`.`b` = ``.`_col_2`)))) select * from t2 where (a,c) not in ((1,2),(8,9), (5,1)); a b c @@ -609,11 +609,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 MATERIALIZED ALL NULL NULL NULL NULL 3 100.00 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<`test`.`t2`.`a`,`test`.`t2`.`c`>(((`test`.`t2`.`a`,`test`.`t2`.`c`),(`test`.`t2`.`a`,`test`.`t2`.`c`) in ( (/* select#2 */ select `tvc_0`.`1`,`tvc_0`.`2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), (`test`.`t2`.`a` in on distinct_key where `test`.`t2`.`a` = ``.`1` and `test`.`t2`.`c` = ``.`2`)))) +Note 1003 /* select#1 */ select `test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b`,`test`.`t2`.`c` AS `c` from `test`.`t2` where !<`test`.`t2`.`a`,`test`.`t2`.`c`>(((`test`.`t2`.`a`,`test`.`t2`.`c`),(`test`.`t2`.`a`,`test`.`t2`.`c`) in ( (/* select#2 */ select `tvc_0`.`_col_1`,`tvc_0`.`_col_2` from (values (1,2),(8,9),(5,1)) `tvc_0` ), (`test`.`t2`.`a` in on distinct_key where `test`.`t2`.`a` = ``.`_col_1` and `test`.`t2`.`c` = ``.`_col_2`)))) drop table t1, t2, t3; set @@in_predicate_conversion_threshold= default; # -# MDEV-14947: conversion of TVC with only NULL values +# MDEV-14947: conversion to TVC with only NULL values # CREATE TABLE t1 (i INT); INSERT INTO t1 VALUES (3), (2), (7); @@ -633,11 +633,11 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY ALL NULL NULL NULL NULL 5 100.00 Using where; FirstMatch(t1); Using join buffer (flat, BNL join) 3 DERIVED NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join ((values (NULL),(NULL),(NULL),(NULL),(NULL)) `tvc_0`) where `test`.`t1`.`i` = `tvc_0`.`NULL` +Note 1003 /* select#1 */ select `test`.`t1`.`i` AS `i` from `test`.`t1` semi join ((values (NULL),(NULL),(NULL),(NULL),(NULL)) `tvc_0`) where `test`.`t1`.`i` = `tvc_0`.`_col_1` SET in_predicate_conversion_threshold= default; DROP TABLE t1; # -# MDEV-14835: conversion of TVC with BIGINT or YEAR values +# MDEV-14835: conversion to TVC with BIGINT or YEAR values # SET @@in_predicate_conversion_threshold= 2; CREATE TABLE t1 (a BIGINT); @@ -654,3 +654,36 @@ y 2011 DROP TABLE t1,t2; SET @@in_predicate_conversion_threshold= default; +# +# MDEV-17222: conversion to TVC with no names for constants +# conversion to TVC with the same constants in the first row +# +SET @@in_predicate_conversion_threshold= 2; +CREATE TABLE t1 (f BINARY(16)) ENGINE=MYISAM; +INSERT INTO t1 VALUES +(x'BAE56AF2B1C2397D99D58E2A06761DDB'), (x'9B9B698BCCB939EE8F1EA56C1A2E5DAA'), +(x'A0A1C4FE39A239BABD3E0D8985E6BEA5'); +SELECT COUNT(*) FROM t1 WHERE f IN +(x'9B9B698BCCB939EE8F1EA56C1A2E5DAA', x'E2362DBAB5EA30B5804917A0A7D881E2', +x'B78B2EEAD13635088D93EA3309E24802', x'BAE56AF2B1C2397D99D58E2A06761DDB'); +COUNT(*) +2 +CREATE TABLE t2 (f1 BINARY(16), f2 BINARY(16)) ENGINE=MYISAM; +INSERT INTO t2 VALUES +(x'55FB3B14D6B83D39859E42533906350D', x'00F3458C47FA39DDBEAD918A13F8342E'), +(x'86052C062AAF368D84247ED0F6346A70', x'BF5C35045C6037C79E11026ABB9A3A4E'); +SELECT COUNT(*) FROM t2 WHERE (f1,f2) IN +((x'9B9B698BCCB939EE8F1EA56C1A2E5DAA', x'E2362DBAB5EA30B5804917A0A7D881E2'), +(x'B78B2EEAD13635088D93EA3309E24802', x'BAE56AF2B1C2397D99D58E2A06761DDB'), +(x'55FB3B14D6B83D39859E42533906350D', x'00F3458C47FA39DDBEAD918A13F8342E'), +(x'1606014E7C4A312F83EDC9D91BBFCACA', x'33F6068E56FD3A1D8326517F0D81CB5A')); +COUNT(*) +1 +CREATE TABLE t3 (f1 int, f2 int) ENGINE=MYISAM; +INSERT INTO t3 VALUES (2,5), (2,3), (1,2), (7,8), (1,1); +SELECT * FROM t3 WHERE (f1,f2) IN ((2, 2), (1, 2), (3, 5), (1, 1)); +f1 f2 +1 2 +1 1 +DROP TABLE t1,t2,t3; +SET @@in_predicate_conversion_threshold= default; diff --git a/mysql-test/main/opt_tvc.test b/mysql-test/main/opt_tvc.test index 2d06a0a0b20..733ee0792fe 100644 --- a/mysql-test/main/opt_tvc.test +++ b/mysql-test/main/opt_tvc.test @@ -320,7 +320,7 @@ drop table t1, t2, t3; set @@in_predicate_conversion_threshold= default; --echo # ---echo # MDEV-14947: conversion of TVC with only NULL values +--echo # MDEV-14947: conversion to TVC with only NULL values --echo # CREATE TABLE t1 (i INT); @@ -342,7 +342,7 @@ SET in_predicate_conversion_threshold= default; DROP TABLE t1; --echo # ---echo # MDEV-14835: conversion of TVC with BIGINT or YEAR values +--echo # MDEV-14835: conversion to TVC with BIGINT or YEAR values --echo # SET @@in_predicate_conversion_threshold= 2; @@ -360,3 +360,39 @@ SELECT * FROM t2 WHERE y IN ('2009','2011'); DROP TABLE t1,t2; SET @@in_predicate_conversion_threshold= default; + +--echo # +--echo # MDEV-17222: conversion to TVC with no names for constants +--echo # conversion to TVC with the same constants in the first row +--echo # + +SET @@in_predicate_conversion_threshold= 2; + +CREATE TABLE t1 (f BINARY(16)) ENGINE=MYISAM; +INSERT INTO t1 VALUES +(x'BAE56AF2B1C2397D99D58E2A06761DDB'), (x'9B9B698BCCB939EE8F1EA56C1A2E5DAA'), +(x'A0A1C4FE39A239BABD3E0D8985E6BEA5'); + +SELECT COUNT(*) FROM t1 WHERE f IN +(x'9B9B698BCCB939EE8F1EA56C1A2E5DAA', x'E2362DBAB5EA30B5804917A0A7D881E2', + x'B78B2EEAD13635088D93EA3309E24802', x'BAE56AF2B1C2397D99D58E2A06761DDB'); + +CREATE TABLE t2 (f1 BINARY(16), f2 BINARY(16)) ENGINE=MYISAM; +INSERT INTO t2 VALUES +(x'55FB3B14D6B83D39859E42533906350D', x'00F3458C47FA39DDBEAD918A13F8342E'), +(x'86052C062AAF368D84247ED0F6346A70', x'BF5C35045C6037C79E11026ABB9A3A4E'); + +SELECT COUNT(*) FROM t2 WHERE (f1,f2) IN +((x'9B9B698BCCB939EE8F1EA56C1A2E5DAA', x'E2362DBAB5EA30B5804917A0A7D881E2'), + (x'B78B2EEAD13635088D93EA3309E24802', x'BAE56AF2B1C2397D99D58E2A06761DDB'), + (x'55FB3B14D6B83D39859E42533906350D', x'00F3458C47FA39DDBEAD918A13F8342E'), + (x'1606014E7C4A312F83EDC9D91BBFCACA', x'33F6068E56FD3A1D8326517F0D81CB5A')); + +CREATE TABLE t3 (f1 int, f2 int) ENGINE=MYISAM; +INSERT INTO t3 VALUES (2,5), (2,3), (1,2), (7,8), (1,1); + +SELECT * FROM t3 WHERE (f1,f2) IN ((2, 2), (1, 2), (3, 5), (1, 1)); + +DROP TABLE t1,t2,t3; + +SET @@in_predicate_conversion_threshold= default; diff --git a/mysql-test/main/order_by.result b/mysql-test/main/order_by.result index e2b05ccec9e..f466e20bb92 100644 --- a/mysql-test/main/order_by.result +++ b/mysql-test/main/order_by.result @@ -3253,3 +3253,40 @@ Warnings: Note 1003 select `test`.`wings`.`id` AS `wing_id`,`test`.`wings`.`department_id` AS `department_id` from `test`.`wings` semi join (`test`.`books`) where `test`.`books`.`library_id` = 8663 and `test`.`books`.`scheduled_for_removal` = 0 and `test`.`wings`.`id` = `test`.`books`.`wings_id` order by `test`.`wings`.`id` set optimizer_switch= @save_optimizer_switch; DROP TABLE books, wings; +# +# MDEV-17761: Odd optimizer choice with ORDER BY LIMIT and condition selectivity +# +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C; +create table t3(a int); +insert into t3 select A.a + 1000 *B.a from t2 A, t1 B; +create table t4 ( +a int, +b int, +c int, +filler1 char(255), +filler2 char(255), +key(a) +); +insert into t4 select a,a,a, a,a from t3; +set @tmp_h=@@histogram_size, @tmp_u=@@use_stat_tables, +@tmp_o=@@optimizer_use_condition_selectivity; +set histogram_size=100; +set use_stat_tables=preferably; +set optimizer_use_condition_selectivity=4; +analyze table t4 persistent for columns(b) indexes (); +Table Op Msg_type Msg_text +test.t4 analyze status Engine-independent statistics collected +test.t4 analyze status Table is already up to date +# rows must be around 1200, not 600: +explain extended +select * from t4 where b < 5000 order by a limit 600; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t4 index NULL a 5 NULL 1188 100.00 Using where +Warnings: +Note 1003 select `test`.`t4`.`a` AS `a`,`test`.`t4`.`b` AS `b`,`test`.`t4`.`c` AS `c`,`test`.`t4`.`filler1` AS `filler1`,`test`.`t4`.`filler2` AS `filler2` from `test`.`t4` where `test`.`t4`.`b` < 5000 order by `test`.`t4`.`a` limit 600 +set histogram_size=@tmp_h, use_stat_tables=@tmp_u, +optimizer_use_condition_selectivity=@tmp_o; +drop table t1,t2,t3,t4; diff --git a/mysql-test/main/order_by.test b/mysql-test/main/order_by.test index b047a31c863..aab3b024371 100644 --- a/mysql-test/main/order_by.test +++ b/mysql-test/main/order_by.test @@ -2187,3 +2187,40 @@ eval explain extended $q; set optimizer_switch= @save_optimizer_switch; DROP TABLE books, wings; + +--echo # +--echo # MDEV-17761: Odd optimizer choice with ORDER BY LIMIT and condition selectivity +--echo # +create table t1(a int); +insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t2(a int); +insert into t2 select A.a + B.a* 10 + C.a * 100 from t1 A, t1 B, t1 C; +create table t3(a int); +insert into t3 select A.a + 1000 *B.a from t2 A, t1 B; + +create table t4 ( + a int, + b int, + c int, + filler1 char(255), + filler2 char(255), + key(a) +); +insert into t4 select a,a,a, a,a from t3; + +set @tmp_h=@@histogram_size, @tmp_u=@@use_stat_tables, + @tmp_o=@@optimizer_use_condition_selectivity; +set histogram_size=100; +set use_stat_tables=preferably; +set optimizer_use_condition_selectivity=4; +analyze table t4 persistent for columns(b) indexes (); + +--echo # rows must be around 1200, not 600: +explain extended +select * from t4 where b < 5000 order by a limit 600; + +set histogram_size=@tmp_h, use_stat_tables=@tmp_u, + optimizer_use_condition_selectivity=@tmp_o; + +drop table t1,t2,t3,t4; + diff --git a/mysql-test/main/order_by_zerolength-4285.result b/mysql-test/main/order_by_zerolength-4285.result index e6902105f20..95b4224f5a2 100644 --- a/mysql-test/main/order_by_zerolength-4285.result +++ b/mysql-test/main/order_by_zerolength-4285.result @@ -25,3 +25,23 @@ Warning 1292 Truncated incorrect CHAR(0) value: '8' Warning 1292 Truncated incorrect CHAR(0) value: '9' Warning 1292 Truncated incorrect CHAR(0) value: '10' drop table t1; +# +# MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion +# +set @save_sql_mode= @@sql_mode; +SET @@sql_mode= ''; +CREATE TABLE t1 (pk INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +explain +SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 index NULL PRIMARY 4 NULL 2 Using index; Using filesort +SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2; +pk +1 +2 +Warnings: +Warning 1292 Truncated incorrect CHAR(0) value: '1' +Warning 1292 Truncated incorrect CHAR(0) value: '2' +set @@sql_mode= @save_sql_mode; +drop table t1; diff --git a/mysql-test/main/order_by_zerolength-4285.test b/mysql-test/main/order_by_zerolength-4285.test index 079ce8da71e..52672aa4595 100644 --- a/mysql-test/main/order_by_zerolength-4285.test +++ b/mysql-test/main/order_by_zerolength-4285.test @@ -13,3 +13,17 @@ select * from t1 order by now(), cast(pk as char(0)); --enable_warnings show warnings; drop table t1; + +--echo # +--echo # MDEV-17020: Assertion `length > 0' failed in ptr_compare upon ORDER BY with bad conversion +--echo # + +set @save_sql_mode= @@sql_mode; +SET @@sql_mode= ''; +CREATE TABLE t1 (pk INT PRIMARY KEY); +INSERT INTO t1 VALUES (1),(2); +explain +SELECT * FROM t1 ORDER BY 'foo', CONVERT(pk, CHAR(0)) LIMIT 2; +SELECT * FROM t1 ORDER BY 'foo', Cast(pk as CHAR(0)) LIMIT 2; +set @@sql_mode= @save_sql_mode; +drop table t1; diff --git a/mysql-test/main/outfile_loaddata.result b/mysql-test/main/outfile_loaddata.result index 0ea692f3ab5..4356f8b113e 100644 --- a/mysql-test/main/outfile_loaddata.result +++ b/mysql-test/main/outfile_loaddata.result @@ -211,7 +211,7 @@ a b c # latin1 charset (INTO OUTFILE warning is expected): SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET latin1 FROM t1; Warnings: -Warning 1366 Incorrect string value: '\xE1\xE2\xF7' for column 'b' at row 1 +Warning 1366 Data truncated for column 'b' at row 1 ################################################## 1 ABC-??? DEF- 2 \N \N @@ -226,7 +226,7 @@ a b c # KOI8-R charset (INTO OUTFILE warning is expected): SELECT * INTO OUTFILE 'MYSQLTEST_VARDIR/tmp/t1.txt' CHARACTER SET koi8r FROM t1; Warnings: -Warning 1366 Incorrect string value: '\xC2\xC3\xC4' for column 'c' at row 1 +Warning 1366 Data truncated for column 'c' at row 1 ################################################## 1 ABC- DEF-??? 2 \N \N diff --git a/mysql-test/main/parser.result b/mysql-test/main/parser.result index 69207f7ca23..34c119a322e 100644 --- a/mysql-test/main/parser.result +++ b/mysql-test/main/parser.result @@ -1684,3 +1684,89 @@ SELECT without VERSIONING FROM t1 SELECT without WITHOUT FROM t1 DROP PROCEDURE p2; DROP PROCEDURE p1; +# +# MDEV-16697: Fix difference between 32bit/windows and 64bit +# systems in allowed select nest level +# +SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +1 +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT +1 +# +# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar +# +CREATE TABLE names (names INT); +SELECT names FROM names AS names; +names +DROP TABLE names; +CREATE TABLE password (password INT); +SELECT password FROM password AS password; +password +DROP TABLE password; +CREATE TABLE role (role INT); +SELECT role FROM role AS role; +role +DROP TABLE role; +BEGIN NOT ATOMIC +DECLARE names VARCHAR(32) DEFAULT '[names]'; +DECLARE password VARCHAR(32) DEFAULT '[password]'; +DECLARE role VARCHAR(32) DEFAULT '[role]'; +names: +LOOP +SELECT names; +LEAVE names; +END LOOP; +password: +LOOP +SELECT password; +LEAVE password; +END LOOP; +role: +LOOP +SELECT role; +LEAVE role; +END LOOP; +END; +$$ +names +[names] +password +[password] +role +[role] +BEGIN NOT ATOMIC +DECLARE names VARCHAR(32); +SET names='[names]'; +END; +$$ +ERROR 42000: Variable 'names' must be quoted with `...`, or renamed +BEGIN NOT ATOMIC +DECLARE password VARCHAR(32); +SET password='[password]'; +END; +$$ +ERROR 42000: Variable 'password' must be quoted with `...`, or renamed +BEGIN NOT ATOMIC +DECLARE role VARCHAR(32); +SET role='[role]'; +END; +$$ +SELECT @@GLOBAL.names; +ERROR HY000: Unknown system variable 'names' +SELECT @@GLOBAL.password; +ERROR HY000: Unknown system variable 'password' +SELECT @@GLOBAL.role; +ERROR HY000: Unknown system variable 'role' +End of 10.3 tests diff --git a/mysql-test/main/parser.test b/mysql-test/main/parser.test index 33316d42b95..3a7c4f6467e 100644 --- a/mysql-test/main/parser.test +++ b/mysql-test/main/parser.test @@ -1446,3 +1446,94 @@ CALL p2('without'); DROP PROCEDURE p2; DROP PROCEDURE p1; + + +--echo # +--echo # MDEV-16697: Fix difference between 32bit/windows and 64bit +--echo # systems in allowed select nest level +--echo # + SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +(SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT (SELECT +1 +))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))); + +--echo # +--echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar +--echo # + +CREATE TABLE names (names INT); +SELECT names FROM names AS names; +DROP TABLE names; + +CREATE TABLE password (password INT); +SELECT password FROM password AS password; +DROP TABLE password; + +CREATE TABLE role (role INT); +SELECT role FROM role AS role; +DROP TABLE role; + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE names VARCHAR(32) DEFAULT '[names]'; + DECLARE password VARCHAR(32) DEFAULT '[password]'; + DECLARE role VARCHAR(32) DEFAULT '[role]'; +names: + LOOP + SELECT names; + LEAVE names; + END LOOP; +password: + LOOP + SELECT password; + LEAVE password; + END LOOP; +role: + LOOP + SELECT role; + LEAVE role; + END LOOP; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +--error ER_SP_BAD_VAR_SHADOW +BEGIN NOT ATOMIC + DECLARE names VARCHAR(32); + SET names='[names]'; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +--error ER_SP_BAD_VAR_SHADOW +BEGIN NOT ATOMIC + DECLARE password VARCHAR(32); + SET password='[password]'; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE role VARCHAR(32); + SET role='[role]'; +END; +$$ +DELIMITER ;$$ + +--error ER_UNKNOWN_SYSTEM_VARIABLE +SELECT @@GLOBAL.names; +--error ER_UNKNOWN_SYSTEM_VARIABLE +SELECT @@GLOBAL.password; +--error ER_UNKNOWN_SYSTEM_VARIABLE +SELECT @@GLOBAL.role; + +--echo End of 10.3 tests diff --git a/mysql-test/main/partition.result b/mysql-test/main/partition.result index fd76da09d78..2108c88588d 100644 --- a/mysql-test/main/partition.result +++ b/mysql-test/main/partition.result @@ -286,6 +286,7 @@ Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_par t1 1 a 1 a A NULL NULL NULL YES BTREE analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show indexes from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -1029,6 +1030,7 @@ PARTITION BY LIST (a) (PARTITION x1 VALUES IN (10), PARTITION x2 VALUES IN (20)); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK drop table t1; create table t1 @@ -1824,6 +1826,7 @@ Table Op Msg_type Msg_text test.t1 check status OK ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze note The storage engine for the table doesn't support analyze drop table t1; drop procedure if exists mysqltest_1; @@ -2060,6 +2063,7 @@ ALTER TABLE t1 ANALYZE PARTITION p1 EXTENDED; 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 'EXTENDED' at line 1 ALTER TABLE t1 ANALYZE PARTITION p1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK ALTER TABLE t1 CHECK PARTITION p1; Table Op Msg_type Msg_text @@ -2649,6 +2653,106 @@ Note 1517 Duplicate partition name p2 DEALLOCATE PREPARE stmt; DROP TABLE t1; # +# MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; +create table t2 ( +part_key int, +a int, +b int +) partition by list(part_key) ( +partition p0 values in (0), +partition p1 values in (1), +partition p2 values in (2), +partition p3 values in (3), +partition p4 values in (4) +); +insert into t2 +select mod(a,5), a/100, mod(a,5) from t1; +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +# +# Tests using stats provided by the storage engine +# +explain extended select * from t2 where part_key=1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` = 1 +explain partitions select * from t2 where part_key=1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 Using where +explain extended select * from t2 where part_key in (1,2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 400 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` in (1,2) +explain partitions select * from t2 where part_key in (1,2); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 Using where +explain extended select * from t2 where b=5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 5 +explain partitions select * from t2 where b=5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 Using where +explain extended select * from t2 partition(p0) where b=1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` PARTITION (`p0`) where `test`.`t2`.`b` = 1 +set @save_histogram_size=@@histogram_size; +set @@histogram_size=100; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=4; +analyze table t2; +Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected +test.t2 analyze status OK +# +# Tests using EITS +# +# filtered should be 100 +explain extended select * from t2 where part_key=1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 200 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` = 1 +explain partitions select * from t2 where part_key=1; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p1 ALL NULL NULL NULL NULL 200 Using where +# filtered should be 100 +explain extended select * from t2 where part_key in (1,2); +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 400 100.00 Using where +Warnings: +Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`part_key` in (1,2) +explain partitions select * from t2 where part_key in (1,2); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p1,p2 ALL NULL NULL NULL NULL 400 Using where +explain extended select * from t2 where b=5; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 1000 19.80 Using where +Warnings: +Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` where `test`.`t2`.`b` = 5 +explain partitions select * from t2 where b=5; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t2 p0,p1,p2,p3,p4 ALL NULL NULL NULL NULL 1000 Using where +explain extended select * from t2 partition(p0) where b=1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t2 ALL NULL NULL NULL NULL 200 19.80 Using where +Warnings: +Note 1003 select `test`.`t2`.`part_key` AS `part_key`,`test`.`t2`.`a` AS `a`,`test`.`t2`.`b` AS `b` from `test`.`t2` PARTITION (`p0`) where `test`.`t2`.`b` = 1 +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set @@histogram_size= @save_histogram_size; +drop table t0,t1,t2; +# # End of 10.0 tests # # diff --git a/mysql-test/main/partition.test b/mysql-test/main/partition.test index 7b7d1457426..42929796f6b 100644 --- a/mysql-test/main/partition.test +++ b/mysql-test/main/partition.test @@ -2900,6 +2900,68 @@ EXECUTE stmt; DEALLOCATE PREPARE stmt; DROP TABLE t1; +--echo # +--echo # MDEV-17032: Estimates are higher for partitions of a table with @@use_stat_tables= PREFERABLY +--echo # + +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); + +create table t1(a int); +insert into t1 select A.a + B.a* 10 + C.a * 100 from t0 A, t0 B, t0 C; + + +create table t2 ( + part_key int, + a int, + b int +) partition by list(part_key) ( + partition p0 values in (0), + partition p1 values in (1), + partition p2 values in (2), + partition p3 values in (3), + partition p4 values in (4) +); +insert into t2 +select mod(a,5), a/100, mod(a,5) from t1; + +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +--echo # +--echo # Tests using stats provided by the storage engine +--echo # +explain extended select * from t2 where part_key=1; +explain partitions select * from t2 where part_key=1; +explain extended select * from t2 where part_key in (1,2); +explain partitions select * from t2 where part_key in (1,2); +explain extended select * from t2 where b=5; +explain partitions select * from t2 where b=5; +explain extended select * from t2 partition(p0) where b=1; + + +set @save_histogram_size=@@histogram_size; +set @@histogram_size=100; +set @@use_stat_tables= PREFERABLY; +set @@optimizer_use_condition_selectivity=4; +analyze table t2; +--echo # +--echo # Tests using EITS +--echo # +--echo # filtered should be 100 +explain extended select * from t2 where part_key=1; +explain partitions select * from t2 where part_key=1; +--echo # filtered should be 100 +explain extended select * from t2 where part_key in (1,2); +explain partitions select * from t2 where part_key in (1,2); +explain extended select * from t2 where b=5; +explain partitions select * from t2 where b=5; +explain extended select * from t2 partition(p0) where b=1; + +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; +set @@histogram_size= @save_histogram_size; +drop table t0,t1,t2; + --echo # --echo # End of 10.0 tests --echo # diff --git a/mysql-test/main/partition_alter.test b/mysql-test/main/partition_alter.test index 62a3e1c0777..91ae67e2f7b 100644 --- a/mysql-test/main/partition_alter.test +++ b/mysql-test/main/partition_alter.test @@ -79,7 +79,6 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ --error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 10)); @@ -96,7 +95,6 @@ partition p1 values less than ('2016-10-18'), partition p2 values less than ('2020-10-19')); insert t1 values (0, '2000-01-02', 0); insert t1 values (1, '2020-01-02', 10); ---replace_regex /#sql-[0-9a-f_]*/#sql-temporary/ --error ER_CONSTRAINT_FAILED alter table t1 add check (b in (0, 1)); alter table t1 add check (b in (0, 10)); diff --git a/mysql-test/main/partition_binlog.result b/mysql-test/main/partition_binlog.result index 21eca8f1c00..3e6100b51d8 100644 --- a/mysql-test/main/partition_binlog.result +++ b/mysql-test/main/partition_binlog.result @@ -27,6 +27,7 @@ Table Op Msg_type Msg_text test.t1 repair error Error in list of partitions to test.t1 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 ALTER TABLE t1 CHECK PARTITION p0; Table Op Msg_type Msg_text diff --git a/mysql-test/main/partition_error.result b/mysql-test/main/partition_error.result index 349e9771367..868eb3b0924 100644 --- a/mysql-test/main/partition_error.result +++ b/mysql-test/main/partition_error.result @@ -1866,3 +1866,12 @@ pUpTo10 p-10sp1 This is a long comment (2050 ascii characters) 50 pUpTo10 part pMax pMaxsp0 This is a long comment (2050 ascii characters) 50 pMax partition comment .80-! pMax pMaxsp1 This is a long comment (2050 ascii characters) 50 pMax partition comment .80-! DROP TABLE t1; +CREATE OR REPLACE TABLE t1 ( +pk INT PRIMARY KEY, +c CHAR(3) NOT NULL, +v CHAR(4) AS (c) VIRTUAL +) WITH SYSTEM VERSIONING PARTITION BY HASH(pk); +INSERT INTO t1 (pk,c) VALUES (1,'foo'),(2,'bar'); +UPDATE t1 SET v = 'qux' WHERE pk = 2; +ERROR HY000: The value specified for generated column 'v' in table 't1' ignored +DROP TABLE t1; diff --git a/mysql-test/main/partition_error.test b/mysql-test/main/partition_error.test index 3ee54605c36..8739c93fe92 100644 --- a/mysql-test/main/partition_error.test +++ b/mysql-test/main/partition_error.test @@ -2074,3 +2074,21 @@ SELECT PARTITION_NAME, SUBPARTITION_NAME, PARTITION_COMMENT FROM INFORMATION_SCH WHERE TABLE_NAME = 't1' AND TABLE_SCHEMA = 'test'; DROP TABLE t1; + +# +# MDEV-16429 +# Assertion `!table || (!table->read_set +# || bitmap_is_set(table->read_set, field_index))' +# fails upon attempt to update virtual column on partitioned versioned table +# +CREATE OR REPLACE TABLE t1 ( + pk INT PRIMARY KEY, + c CHAR(3) NOT NULL, + v CHAR(4) AS (c) VIRTUAL +) WITH SYSTEM VERSIONING PARTITION BY HASH(pk); + +INSERT INTO t1 (pk,c) VALUES (1,'foo'),(2,'bar'); +-- error ER_WARNING_NON_DEFAULT_VALUE_FOR_GENERATED_COLUMN +UPDATE t1 SET v = 'qux' WHERE pk = 2; + +DROP TABLE t1; diff --git a/mysql-test/main/partition_explicit_prune.result b/mysql-test/main/partition_explicit_prune.result index c6b3dd35e08..9c1174c5414 100644 --- a/mysql-test/main/partition_explicit_prune.result +++ b/mysql-test/main/partition_explicit_prune.result @@ -233,6 +233,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 +HANDLER_READ_KEY 6 HANDLER_TMP_WRITE 24 HANDLER_WRITE 2 # Should be 1 commit @@ -315,6 +316,7 @@ a b 1000 `p100-99999`(-subp6) ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SET @save_innodb_stats_on_metadata=@@global.innodb_stats_on_metadata; SET @@global.innodb_stats_on_metadata=ON; @@ -348,6 +350,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 1 +HANDLER_READ_KEY 6 HANDLER_TMP_WRITE 24 # Should be 1 commit # 4 locks (1 ha_partition + 1 ha_innobase) x 2 (lock/unlock) @@ -1058,6 +1061,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 5 +HANDLER_READ_KEY 6 HANDLER_READ_NEXT 5 HANDLER_TMP_WRITE 24 HANDLER_WRITE 10 @@ -1077,6 +1081,7 @@ SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_READ_FIRST 5 +HANDLER_READ_KEY 6 HANDLER_ROLLBACK 1 HANDLER_TMP_WRITE 24 HANDLER_WRITE 1 @@ -1104,6 +1109,7 @@ WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0; VARIABLE_NAME VARIABLE_VALUE HANDLER_COMMIT 1 HANDLER_READ_FIRST 5 +HANDLER_READ_KEY 6 HANDLER_READ_NEXT 5 HANDLER_TMP_WRITE 24 HANDLER_WRITE 10 @@ -1872,3 +1878,22 @@ CREATE TABLE t2 LIKE t1 PARTITION (p0, p2); 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 'PARTITION (p0, p2)' at line 1 DROP TABLE t1; SET @@default_storage_engine = @old_default_storage_engine; +# +# MDEV-14815 - Server crash or AddressSanitizer errors or valgrind warnings in thr_lock / has_old_lock upon FLUSH TABLES +# +CREATE TABLE t1 (i INT) ENGINE=MEMORY PARTITION BY RANGE (i) (PARTITION p0 VALUES LESS THAN (4), PARTITION pm VALUES LESS THAN MAXVALUE); +CREATE TABLE t2 (i INT) ENGINE=MEMORY; +LOCK TABLE t1 WRITE, t2 WRITE; +SELECT * FROM t1 PARTITION (p0); +i +FLUSH TABLES; +SELECT * FROM t1 PARTITION (p0); +i +ALTER TABLE t1 TRUNCATE PARTITION p0; +SELECT * FROM t1 PARTITION (p0); +i +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; +SELECT * FROM t1 PARTITION (p0); +i +UNLOCK TABLES; +DROP TABLE t1, t2; diff --git a/mysql-test/main/partition_explicit_prune.test b/mysql-test/main/partition_explicit_prune.test index 68b829fbcc3..b8b6e480ce9 100644 --- a/mysql-test/main/partition_explicit_prune.test +++ b/mysql-test/main/partition_explicit_prune.test @@ -858,3 +858,22 @@ CREATE TABLE t2 LIKE t1 PARTITION (p0, p2); DROP TABLE t1; SET @@default_storage_engine = @old_default_storage_engine; + + +--echo # +--echo # MDEV-14815 - Server crash or AddressSanitizer errors or valgrind warnings in thr_lock / has_old_lock upon FLUSH TABLES +--echo # +CREATE TABLE t1 (i INT) ENGINE=MEMORY PARTITION BY RANGE (i) (PARTITION p0 VALUES LESS THAN (4), PARTITION pm VALUES LESS THAN MAXVALUE); +CREATE TABLE t2 (i INT) ENGINE=MEMORY; +LOCK TABLE t1 WRITE, t2 WRITE; +SELECT * FROM t1 PARTITION (p0); +FLUSH TABLES; +SELECT * FROM t1 PARTITION (p0); +ALTER TABLE t1 TRUNCATE PARTITION p0; +SELECT * FROM t1 PARTITION (p0); +ALTER TABLE t1 EXCHANGE PARTITION p0 WITH TABLE t2; +SELECT * FROM t1 PARTITION (p0); +UNLOCK TABLES; + +# Cleanup +DROP TABLE t1, t2; diff --git a/mysql-test/main/partition_innodb.result b/mysql-test/main/partition_innodb.result index d27abc07984..e91d3767fcc 100644 --- a/mysql-test/main/partition_innodb.result +++ b/mysql-test/main/partition_innodb.result @@ -26,6 +26,7 @@ INSERT INTO t1 VALUES (0, 'Mod Zero'), (1, 'One'), (2, 'Two'), (3, 'Three'), INSERT INTO t1 SELECT a + 30, b FROM t1 WHERE a >= 0; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT b FROM t1 WHERE b between 'L' and 'N' AND a > -100; id select_type table type possible_keys key key_len ref rows Extra @@ -899,6 +900,35 @@ ERROR HY000: Table definition has changed, please retry transaction disconnect con1; DROP TABLE t1; # +# MDEV-11167: InnoDB: Warning: using a partial-field key prefix +# in search, results in assertion failure or "Can't find record" error +# +set @save_sql_mode = @@sql_mode; +set sql_mode=""; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2; +CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION; +INSERT INTO t1 VALUES (1),(2); +INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4); +Warnings: +Warning 1366 Incorrect integer value: 'three' for column `test`.`t2`.`b` at row 2 +UPDATE v SET a = NULL; +Warnings: +Warning 1292 Truncated incorrect DOUBLE value: 'foo' +DROP view v; +DROP TABLE t1, t2; +SET @save_isp=@@innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= ON; +CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2; +INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66); +CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION; +UPDATE v SET f2 = NULL; +ERROR 44000: CHECK OPTION failed `test`.`v` +SET GLOBAL innodb_stats_persistent= @save_isp; +DROP view v; +DROP TABLE t; +set sql_mode= @save_sql_mode; +# # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE # MYSQL.INNODB_TABLE_STATS # @@ -925,3 +955,37 @@ test_jfg test_jfg11 test_jfg test_jfg12#P#p1000 test_jfg test_jfg12#P#pmax DROP DATABASE test_jfg; +create table t1 (a int) engine=innodb; +create table t2 ( +b int, +c int, +d bit not null default 0, +v bit as (d) virtual, +key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 +1 SIMPLE t2 index NULL b 7 NULL 2 Using where; Using index; Using join buffer (flat, BNL join) +select t1.* from t1 join t2 on (v = a); +a +drop table t1, t2; +# +# End of 10.2 tests +# +# +# MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() +# +CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z)) +WITH SYSTEM VERSIONING +PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT); +INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); +SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; +COUNT(*) +2 +DROP TABLE t1; +# +# End of 10.3 tests +# diff --git a/mysql-test/main/partition_innodb.test b/mysql-test/main/partition_innodb.test index 49430414913..57d644d293d 100644 --- a/mysql-test/main/partition_innodb.test +++ b/mysql-test/main/partition_innodb.test @@ -988,6 +988,38 @@ SELECT b FROM t1 WHERE b = 0; --disconnect con1 DROP TABLE t1; +--echo # +--echo # MDEV-11167: InnoDB: Warning: using a partial-field key prefix +--echo # in search, results in assertion failure or "Can't find record" error +--echo # + +set @save_sql_mode = @@sql_mode; +set sql_mode=""; +CREATE TABLE t1 (a INT) ENGINE=InnoDB; +CREATE TABLE t2 (b INT, c INT, KEY(b)) ENGINE=InnoDB PARTITION BY HASH(c) PARTITIONS 2; +CREATE ALGORITHM = MERGE VIEW v AS SELECT a, b FROM t1 STRAIGHT_JOIN t2 WHERE b = 'foo' WITH CHECK OPTION; + +INSERT INTO t1 VALUES (1),(2); +INSERT IGNORE INTO t2 VALUES (2,2),('three',3),(4,4); +UPDATE v SET a = NULL; + +DROP view v; +DROP TABLE t1, t2; + +SET @save_isp=@@innodb_stats_persistent; +SET GLOBAL innodb_stats_persistent= ON; + +CREATE TABLE t (f1 INT, f2 INT, KEY(f2)) ENGINE=InnoDB PARTITION BY HASH (f1) PARTITIONS 2; +INSERT IGNORE INTO t VALUES (NULL,0),(NULL,0),(0,21),(4,0),(1,8),(5,66); +CREATE ALGORITHM=MERGE VIEW v AS SELECT t1.* FROM t t1 JOIN t t2 WHERE t1.f1 < t2.f2 WITH LOCAL CHECK OPTION; +--error ER_VIEW_CHECK_FAILED +UPDATE v SET f2 = NULL; + +SET GLOBAL innodb_stats_persistent= @save_isp; +DROP view v; +DROP TABLE t; +set sql_mode= @save_sql_mode; + --echo # --echo # Bug#26390658 RENAMING A PARTITIONED TABLE DOES NOT UPDATE --echo # MYSQL.INNODB_TABLE_STATS @@ -1015,3 +1047,38 @@ SELECT database_name, table_name FROM mysql.innodb_table_stats WHERE database_name = 'test_jfg'; DROP DATABASE test_jfg; + +# +# MDEV-17755 Assertion `!table || (!table->read_set || bitmap_is_set(table->read_set, field_index) || (!(ptr >= table->record[0] && ptr < table->record[0] + table->s->reclength)))' failed in Field_bit::val_int upon SELECT with JOIN, partitions, indexed virtual column +# +create table t1 (a int) engine=innodb; +create table t2 ( + b int, + c int, + d bit not null default 0, + v bit as (d) virtual, + key (b,v) +) engine=innodb partition by hash (b); +insert into t1 values (1),(2); +insert into t2 (b,c,d) values (1,1,0),(2,2,0); +explain select t1.* from t1 join t2 on (v = a); +select t1.* from t1 join t2 on (v = a); +drop table t1, t2; + +--echo # +--echo # End of 10.2 tests +--echo # + +--echo # +--echo # MDEV-16241 Assertion `inited==RND' failed in handler::ha_rnd_end() +--echo # +CREATE TABLE t1 (pk INT PRIMARY KEY, x INT, y INT, z INT, KEY (x), KEY (y, z)) +WITH SYSTEM VERSIONING +PARTITION BY SYSTEM_TIME (PARTITION p1 HISTORY, PARTITION pn CURRENT); +INSERT INTO t1 VALUES (1, 7, 8, 9), (2, NULL, NULL, NULL), (3, NULL, NULL, NULL); +SELECT COUNT(*) FROM t1 WHERE x IS NULL AND y IS NULL AND z IS NULL; +DROP TABLE t1; + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/main/partition_pruning.result b/mysql-test/main/partition_pruning.result index 422132dd1c3..00bd24101d6 100644 --- a/mysql-test/main/partition_pruning.result +++ b/mysql-test/main/partition_pruning.result @@ -3484,3 +3484,36 @@ select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) O a b c d 1 a b 1 drop table t1; +# +# MDEV-17493: Partition pruning doesn't work for nested outer joins +# +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int); +insert into t1 select a,a,a from t0; +create table t2 (a int, b int, c int); +insert into t2 select a,a,a from t0; +create table t3 ( +part_id int, +a int +) partition by list (part_id) ( +partition p0 values in (0), +partition p1 values in (1), +partition p2 values in (2), +partition p3 values in (3), +partition p4 values in (4) +); +insert into t3 select mod(a,5), a from t0; +explain partitions +select * from t1 left join t3 on (t1.a=t3.a and t3.part_id=3); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t3 p3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +# The following should have partitions="p3", NOT p0,p1,p2,p3,p4: +explain partitions +select * from t1 left join (t3 join t2) on (t1.a=t3.a and t3.a=t2.b and t3.part_id=3); +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 +1 SIMPLE t3 p3 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +1 SIMPLE t2 NULL ALL NULL NULL NULL NULL 10 Using where; Using join buffer (incremental, BNL join) +drop table t0,t1,t2,t3; diff --git a/mysql-test/main/partition_pruning.test b/mysql-test/main/partition_pruning.test index 9d72e9c0d01..2879b0eae6c 100644 --- a/mysql-test/main/partition_pruning.test +++ b/mysql-test/main/partition_pruning.test @@ -1535,4 +1535,35 @@ select * from t1 where (a = 1 AND b < 'd' AND (c = 'b' OR (c = 'c' AND d = 1)) O (a = 1 AND b >= 'a' AND (c = 'c' OR (c = 'd' AND d = 2)))); drop table t1; +--echo # +--echo # MDEV-17493: Partition pruning doesn't work for nested outer joins +--echo # + +create table t0(a int); +insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9); +create table t1 (a int, b int, c int); +insert into t1 select a,a,a from t0; +create table t2 (a int, b int, c int); +insert into t2 select a,a,a from t0; + +create table t3 ( + part_id int, + a int +) partition by list (part_id) ( + partition p0 values in (0), + partition p1 values in (1), + partition p2 values in (2), + partition p3 values in (3), + partition p4 values in (4) +); +insert into t3 select mod(a,5), a from t0; + +explain partitions +select * from t1 left join t3 on (t1.a=t3.a and t3.part_id=3); + +--echo # The following should have partitions="p3", NOT p0,p1,p2,p3,p4: +explain partitions +select * from t1 left join (t3 join t2) on (t1.a=t3.a and t3.a=t2.b and t3.part_id=3); + +drop table t0,t1,t2,t3; diff --git a/mysql-test/main/perror-win.result b/mysql-test/main/perror-win.result index 139b566757f..0e9d2e48a99 100644 --- a/mysql-test/main/perror-win.result +++ b/mysql-test/main/perror-win.result @@ -1,7 +1,7 @@ -MySQL error code 150: Foreign key constraint is incorrectly formed +MariaDB error code 150: Foreign key constraint is incorrectly formed Win32 error code 150: System trace information was not specified in your CONFIG.SYS file, or tracing is disallowed. OS error code 23: Too many open files in system Win32 error code 23: Data error (cyclic redundancy check). -MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d +MariaDB error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d Win32 error code 1062: The service has not been started. Illegal error code: 30000 diff --git a/mysql-test/main/perror.result b/mysql-test/main/perror.result index 46554442721..ad2106524e5 100644 --- a/mysql-test/main/perror.result +++ b/mysql-test/main/perror.result @@ -1,6 +1,6 @@ Illegal error code: 10000 -MySQL error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d -MySQL error code 1408 (ER_STARTUP): %s: ready for connections. +MariaDB error code 1062 (ER_DUP_ENTRY): Duplicate entry '%-.192s' for key %d +MariaDB error code 1408 (ER_STARTUP): %s: ready for connections. Version: '%s' socket: '%s' port: %d %s -MySQL error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it! -MySQL error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u) +MariaDB error code 1459 (ER_TABLE_NEEDS_UPGRADE): Upgrade required. Please do "REPAIR %s %`s" or dump/reload to fix it! +MariaDB error code 1461 (ER_MAX_PREPARED_STMT_COUNT_REACHED): Can't create more than max_prepared_stmt_count statements (current value: %u) diff --git a/mysql-test/main/plugin.result b/mysql-test/main/plugin.result index 3a141a25b5c..fde2550ad81 100644 --- a/mysql-test/main/plugin.result +++ b/mysql-test/main/plugin.result @@ -12,7 +12,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.13 +PLUGIN_LIBRARY_VERSION 1.14 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL @@ -25,7 +25,7 @@ PLUGIN_STATUS ACTIVE PLUGIN_TYPE DAEMON PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.13 +PLUGIN_LIBRARY_VERSION 1.14 PLUGIN_AUTHOR Sergei Golubchik PLUGIN_DESCRIPTION Unusable Daemon PLUGIN_LICENSE GPL @@ -64,7 +64,7 @@ PLUGIN_STATUS DELETED PLUGIN_TYPE STORAGE ENGINE PLUGIN_TYPE_VERSION # PLUGIN_LIBRARY ha_example.so -PLUGIN_LIBRARY_VERSION 1.13 +PLUGIN_LIBRARY_VERSION 1.14 PLUGIN_AUTHOR Brian Aker, MySQL AB PLUGIN_DESCRIPTION Example storage engine PLUGIN_LICENSE GPL @@ -331,3 +331,48 @@ UNINSTALL PLUGIN example; RENAME TABLE t1 TO t2; ERROR 42S02: Table 'test.t1' doesn't exist DROP TABLE t1; +# +# INSTALL IF NOT EXISTS PLUGIN name SONAME library / +# UNINSTALL IF EXISTS PLUGIN|SONAME name +# +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; +PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE +INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example'; +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; +PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE +EXAMPLE ACTIVE STORAGE ENGINE +INSTALL PLUGIN example SONAME 'ha_example'; +ERROR HY000: Plugin 'example' already installed +INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example'; +Warnings: +Note 1968 Plugin 'example' already installed +SHOW WARNINGS; +Level Code Message +Note 1968 Plugin 'example' already installed +UNINSTALL PLUGIN IF EXISTS example; +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; +PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE +UNINSTALL PLUGIN IF EXISTS example; +Warnings: +Note 1305 PLUGIN example does not exist +SHOW WARNINGS; +Level Code Message +Note 1305 PLUGIN example does not exist +UNINSTALL PLUGIN example; +ERROR 42000: PLUGIN example does not exist +INSTALL SONAME 'ha_example'; +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; +PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE +EXAMPLE ACTIVE STORAGE ENGINE +UNUSABLE ACTIVE DAEMON +UNINSTALL SONAME IF EXISTS 'ha_example'; +UNINSTALL SONAME IF EXISTS 'ha_example'; +Warnings: +Note 1305 SONAME ha_example.so does not exist +SHOW WARNINGS; +Level Code Message +Note 1305 SONAME ha_example.so does not exist +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; +PLUGIN_NAME PLUGIN_STATUS PLUGIN_TYPE +UNINSTALL SONAME 'ha_example'; +ERROR 42000: SONAME ha_example.so does not exist diff --git a/mysql-test/main/plugin.test b/mysql-test/main/plugin.test index 68c4d5afd64..273e1e064a5 100644 --- a/mysql-test/main/plugin.test +++ b/mysql-test/main/plugin.test @@ -265,3 +265,43 @@ UNINSTALL PLUGIN example; --error ER_NO_SUCH_TABLE RENAME TABLE t1 TO t2; DROP TABLE t1; + +--echo # +--echo # INSTALL IF NOT EXISTS PLUGIN name SONAME library / +--echo # UNINSTALL IF EXISTS PLUGIN|SONAME name +--echo # + +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; +INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example'; +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; + +--replace_regex /\.dll/.so/ +--error ER_PLUGIN_INSTALLED +INSTALL PLUGIN example SONAME 'ha_example'; + +INSTALL PLUGIN IF NOT EXISTS example SONAME 'ha_example'; +SHOW WARNINGS; + +UNINSTALL PLUGIN IF EXISTS example; +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; + +UNINSTALL PLUGIN IF EXISTS example; +SHOW WARNINGS; + +--error 1305 +UNINSTALL PLUGIN example; + +INSTALL SONAME 'ha_example'; +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; + +UNINSTALL SONAME IF EXISTS 'ha_example'; + +--replace_regex /\.dll/.so/ +UNINSTALL SONAME IF EXISTS 'ha_example'; +--replace_regex /\.dll/.so/ +SHOW WARNINGS; +select PLUGIN_NAME,PLUGIN_STATUS,PLUGIN_TYPE from information_schema.plugins where plugin_library like 'ha_example%'; + +--replace_regex /\.dll/.so/ +--error 1305 +UNINSTALL SONAME 'ha_example'; diff --git a/mysql-test/main/plugin_auth.result b/mysql-test/main/plugin_auth.result index 899e0292142..d69246f8c7d 100644 --- a/mysql-test/main/plugin_auth.result +++ b/mysql-test/main/plugin_auth.result @@ -11,6 +11,8 @@ SELECT plugin,authentication_string FROM mysql.user WHERE User='plug'; plugin authentication_string test_plugin_server plug_dest ## test plugin auth +connect(localhost,plug,plug_dest,test,MYSQL_PORT,MYSQL_SOCK); +connect plug_con,localhost,plug,plug_dest; ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES) GRANT PROXY ON plug_dest TO plug; test proxies_priv columns @@ -32,7 +34,6 @@ proxies_priv CREATE TABLE `proxies_priv` ( KEY `Grantor` (`Grantor`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User proxy privileges' connect plug_con,localhost,plug,plug_dest; -connection plug_con; select USER(),CURRENT_USER(); USER() CURRENT_USER() plug@localhost plug_dest@% @@ -41,11 +42,18 @@ SET PASSWORD = PASSWORD('plug_dest'); connection default; disconnect plug_con; ## test bad credentials +connect(localhost,plug,bad_credentials,test,MYSQL_PORT,MYSQL_SOCK); +connect plug_con,localhost,plug,bad_credentials; ERROR 28000: Access denied for user 'plug'@'localhost' (using password: YES) -## test bad default plugin : should get CR_AUTH_PLUGIN_CANNOT_LOAD +## test bad default plugin : nothing bad happens, as that plugin was't required by the server +connect plug_con_wrongp,localhost,plug,plug_dest,,,,,wrong_plugin_name; +select USER(),CURRENT_USER(); +USER() CURRENT_USER() +plug@localhost plug_dest@% +connection default; +disconnect plug_con_wrongp; ## test correct default plugin connect plug_con_rightp,localhost,plug,plug_dest,,,,,auth_test_plugin; -connection plug_con_rightp; select USER(),CURRENT_USER(); USER() CURRENT_USER() plug@localhost plug_dest@% @@ -60,7 +68,6 @@ DROP USER grant_user; CREATE USER `Ÿ` IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; GRANT PROXY ON plug_dest TO `Ÿ`; connect non_ascii,localhost,Ÿ,plug_dest; -connection non_ascii; select USER(),CURRENT_USER(); USER() CURRENT_USER() Ÿ@localhost plug_dest@% @@ -74,7 +81,6 @@ GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; GRANT PROXY ON plug_dest TO new_grant_user; connect plug_con_grant,localhost,new_grant_user,plug_dest; -connection plug_con_grant; select USER(),CURRENT_USER(); USER() CURRENT_USER() new_grant_user@localhost plug_dest@% @@ -91,7 +97,6 @@ connect(localhost,new_grant_user,plug_dest,test,MYSQL_PORT,MYSQL_SOCK); connect plug_con_grant_deny,localhost,new_grant_user,plug_dest; ERROR 28000: Access denied for user 'new_grant_user'@'localhost' (using password: YES) connect plug_con_grant,localhost,new_grant_user,new_password; -connection plug_con_grant; select USER(),CURRENT_USER(); USER() CURRENT_USER() new_grant_user@localhost new_grant_user@% @@ -133,8 +138,6 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp REVOKE PROXY ON grant_plug_dest FROM grant_plug; ERROR 42000: There is no such grant defined for user 'grant_plug' on host '%' connect grant_plug_dest_con,localhost,grant_plug_dest,grant_plug_dest_passwd; -connection grant_plug_dest_con; -in grant_plug_dest_con ## testing what an ordinary user can grant this should fail : no rights to grant all GRANT PROXY ON ''@'%%' TO grant_plug; @@ -158,7 +161,6 @@ this should fail : can't create users GRANT PROXY ON grant_plug_dest TO grant_plug@localhost; ERROR 42000: You are not allowed to create a user with GRANT connection default; -in default connection disconnect grant_plug_dest_con; # test what root can grant should work : root has PROXY to all users @@ -170,12 +172,9 @@ WITH GRANT OPTION; need USAGE : PROXY doesn't contain it. GRANT USAGE on *.* TO proxy_admin; connect proxy_admin_con,localhost,proxy_admin,test; -connection proxy_admin_con; -in proxy_admin_con; should work : proxy_admin has proxy to ''@'%%' GRANT PROXY ON future_user TO grant_plug; connection default; -in default connection disconnect proxy_admin_con; SHOW GRANTS FOR grant_plug; Grants for grant_plug@% @@ -221,13 +220,10 @@ SELECT @@LOCAL.proxy_user; @@LOCAL.proxy_user NULL connect plug_con,localhost,plug,plug_dest; -connection plug_con; -# in connection plug_con SELECT @@LOCAL.proxy_user; @@LOCAL.proxy_user 'plug'@'%' connection default; -# in connection default disconnect plug_con; ## cleanup DROP USER plug; @@ -253,13 +249,10 @@ SELECT @@LOCAL.external_user; @@LOCAL.external_user NULL connect plug_con,localhost,plug,plug_dest; -connection plug_con; -# in connection plug_con SELECT @@LOCAL.external_user; @@LOCAL.external_user plug_dest connection default; -# in connection default disconnect plug_con; ## cleanup DROP USER plug; @@ -315,7 +308,6 @@ REVOKE PROXY ON u2@localhost FROM u1@localhost; ERROR 28000: Access denied for user 'root'@'localhost' # go try graning proxy on itself, so that it will need the table connect proxy_granter_con,localhost,u2,; -connection proxy_granter_con; GRANT PROXY ON u2@localhost TO u1@localhost; ERROR 42S02: Table 'mysql.proxies_priv' doesn't exist REVOKE PROXY ON u2@localhost FROM u1@localhost; @@ -355,13 +347,13 @@ CREATE USER uplain@localhost IDENTIFIED WITH 'cleartext_plugin_server' ## test plugin auth ERROR 28000: Access denied for user 'uplain'@'localhost' (using password: YES) connect cleartext_con,localhost,uplain,cleartext_test; -connection cleartext_con; select USER(),CURRENT_USER(); USER() CURRENT_USER() uplain@localhost uplain@localhost connection default; disconnect cleartext_con; DROP USER uplain@localhost; +drop view mysql.user_bak; # # Bug #59038 : mysql.user.authentication_string column # causes configuration wizard to fail @@ -443,6 +435,8 @@ ORDER BY COLUMN_NAME; IS_NULLABLE COLUMN_NAME NO authentication_string NO plugin +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; # # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN # .-> USING PASSWORD: NO @@ -471,7 +465,6 @@ CREATE USER bug12818542_dest@localhost IDENTIFIED BY 'bug12818542_dest_passwd'; GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost; connect bug12818542_con,localhost,bug12818542,bug12818542_dest; -connection bug12818542_con; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() bug12818542@localhost bug12818542_dest@localhost @@ -479,7 +472,6 @@ SET PASSWORD = PASSWORD('bruhaha'); connection default; disconnect bug12818542_con; connect bug12818542_con2,localhost,bug12818542,bug12818542_dest; -connection bug12818542_con2; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() bug12818542@localhost bug12818542_dest@localhost diff --git a/mysql-test/main/plugin_auth.test b/mysql-test/main/plugin_auth.test index c3c18b7e427..30e4fa6e0ad 100644 --- a/mysql-test/main/plugin_auth.test +++ b/mysql-test/main/plugin_auth.test @@ -15,10 +15,9 @@ CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT plugin,authentication_string FROM mysql.user WHERE User='plug'; --echo ## test plugin auth ---disable_query_log +--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --error ER_ACCESS_DENIED_ERROR : this should fail : no grant connect(plug_con,localhost,plug,plug_dest); ---enable_query_log GRANT PROXY ON plug_dest TO plug; --echo test proxies_priv columns @@ -28,8 +27,6 @@ SELECT * FROM mysql.proxies_priv WHERE user !='root'; SHOW CREATE TABLE mysql.proxies_priv; connect(plug_con,localhost,plug,plug_dest); - -connection plug_con; select USER(),CURRENT_USER(); --echo ## test SET PASSWORD @@ -40,22 +37,18 @@ connection default; disconnect plug_con; --echo ## test bad credentials ---disable_query_log +--replace_result $MASTER_MYPORT MYSQL_PORT $MASTER_MYSOCK MYSQL_SOCK --error ER_ACCESS_DENIED_ERROR connect(plug_con,localhost,plug,bad_credentials); ---enable_query_log ---echo ## test bad default plugin : should get CR_AUTH_PLUGIN_CANNOT_LOAD ---disable_result_log ---disable_query_log ---error 2059 +--echo ## test bad default plugin : nothing bad happens, as that plugin was't required by the server connect(plug_con_wrongp,localhost,plug,plug_dest,,,,,wrong_plugin_name); ---enable_query_log ---enable_result_log +select USER(),CURRENT_USER(); +connection default; +disconnect plug_con_wrongp; --echo ## test correct default plugin connect(plug_con_rightp,localhost,plug,plug_dest,,,,,auth_test_plugin); -connection plug_con_rightp; select USER(),CURRENT_USER(); connection default; disconnect plug_con_rightp; @@ -72,7 +65,6 @@ CREATE USER `Ÿ` IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; GRANT PROXY ON plug_dest TO `Ÿ`; connect(non_ascii,localhost,Ÿ,plug_dest); -connection non_ascii; select USER(),CURRENT_USER(); connection default; @@ -90,7 +82,6 @@ GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user GRANT PROXY ON plug_dest TO new_grant_user; connect(plug_con_grant,localhost,new_grant_user,plug_dest); -connection plug_con_grant; select USER(),CURRENT_USER(); USE test_grant_db; CREATE TABLE t1 (a INT); @@ -108,7 +99,6 @@ GRANT ALL PRIVILEGES ON test_grant_db.* TO new_grant_user connect(plug_con_grant_deny,localhost,new_grant_user,plug_dest); connect(plug_con_grant,localhost,new_grant_user,new_password); -connection plug_con_grant; select USER(),CURRENT_USER(); USE test_grant_db; CREATE TABLE t1 (a INT); @@ -166,8 +156,6 @@ GRANT ALL SELECT,PROXY ON grant_plug_dest TO grant_plug; REVOKE PROXY ON grant_plug_dest FROM grant_plug; connect(grant_plug_dest_con,localhost,grant_plug_dest,grant_plug_dest_passwd); -connection grant_plug_dest_con; ---echo in grant_plug_dest_con --echo ## testing what an ordinary user can grant --echo this should fail : no rights to grant all @@ -209,7 +197,6 @@ REVOKE PROXY ON grant_plug_dest@localhost FROM grant_plug; GRANT PROXY ON grant_plug_dest TO grant_plug@localhost; connection default; ---echo in default connection disconnect grant_plug_dest_con; --echo # test what root can grant @@ -226,14 +213,11 @@ GRANT PROXY ON ''@'%%' TO proxy_admin IDENTIFIED BY 'test' GRANT USAGE on *.* TO proxy_admin; connect (proxy_admin_con,localhost,proxy_admin,test); -connection proxy_admin_con; ---echo in proxy_admin_con; --echo should work : proxy_admin has proxy to ''@'%%' GRANT PROXY ON future_user TO grant_plug; connection default; ---echo in default connection disconnect proxy_admin_con; SHOW GRANTS FOR grant_plug; @@ -275,11 +259,8 @@ SET LOCAL proxy_user = 'test'; SELECT @@LOCAL.proxy_user; connect(plug_con,localhost,plug,plug_dest); -connection plug_con; ---echo # in connection plug_con SELECT @@LOCAL.proxy_user; connection default; ---echo # in connection default disconnect plug_con; --echo ## cleanup @@ -304,11 +285,8 @@ SET LOCAL external_user = 'test'; SELECT @@LOCAL.external_user; connect(plug_con,localhost,plug,plug_dest); -connection plug_con; ---echo # in connection plug_con SELECT @@LOCAL.external_user; connection default; ---echo # in connection default disconnect plug_con; --echo ## cleanup @@ -382,7 +360,6 @@ REVOKE PROXY ON u2@localhost FROM u1@localhost; --echo # go try graning proxy on itself, so that it will need the table connect(proxy_granter_con,localhost,u2,); -connection proxy_granter_con; --error ER_NO_SUCH_TABLE GRANT PROXY ON u2@localhost TO u1@localhost; @@ -438,13 +415,16 @@ connect(cleartext_fail_con,localhost,uplain,cleartext_test2); --enable_query_log connect(cleartext_con,localhost,uplain,cleartext_test); -connection cleartext_con; select USER(),CURRENT_USER(); connection default; disconnect cleartext_con; DROP USER uplain@localhost; +# prepare for two tests that use mysql.user table +source include/switch_to_mysql_user.inc; +drop view mysql.user_bak; + --echo # --echo # Bug #59038 : mysql.user.authentication_string column --echo # causes configuration wizard to fail @@ -502,7 +482,6 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_SCHEMA='mysql' ORDER BY COLUMN_NAME; - --echo # --echo # Bug #11936829: diff. between mysql.user (authentication_string) --echo # in fresh and upgraded 5.5.11 @@ -524,7 +503,8 @@ SELECT IS_NULLABLE, COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS ORDER BY COLUMN_NAME; let $datadir= `select @@datadir`; remove_file $datadir/mysql_upgrade_info; - +drop table mysql.global_priv; +rename table mysql.global_priv_bak to mysql.global_priv; --echo # --echo # Bug # 11766641: 59792: BIN/MYSQL -UUNKNOWN -PUNKNOWN @@ -567,7 +547,6 @@ CREATE USER bug12818542_dest@localhost GRANT PROXY ON bug12818542_dest@localhost TO bug12818542@localhost; connect(bug12818542_con,localhost,bug12818542,bug12818542_dest); -connection bug12818542_con; SELECT USER(),CURRENT_USER(); SET PASSWORD = PASSWORD('bruhaha'); @@ -576,7 +555,6 @@ connection default; disconnect bug12818542_con; connect(bug12818542_con2,localhost,bug12818542,bug12818542_dest); -connection bug12818542_con2; SELECT USER(),CURRENT_USER(); connection default; diff --git a/mysql-test/main/plugin_auth_qa.result b/mysql-test/main/plugin_auth_qa.result index 4f274c45971..e00ac1a4c96 100644 --- a/mysql-test/main/plugin_auth_qa.result +++ b/mysql-test/main/plugin_auth_qa.result @@ -1,38 +1,38 @@ set sql_mode=""; CREATE DATABASE test_user_db; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string ========== test 1.1 ====================================================== CREATE USER plug IDENTIFIED WITH test_plugin_server; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug; DROP USER plug; CREATE USER plug IDENTIFIED WITH 'test_plugin_server'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug; DROP USER plug; CREATE USER plug IDENTIFIED WITH test_plugin_server AS ''; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS ''; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server REVOKE ALL PRIVILEGES ON test_user_db.* FROM plug; DROP USER plug; @@ -100,63 +100,63 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; ========== test 1.1.1.6/1.1.2.5 ============================ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest -plug_dest +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug, plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest DROP USER plug; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plug_dest +User plugin authentication_string +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest -plug_dest +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug, plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest DROP USER plug; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plug_dest +User plugin authentication_string +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest -plug_dest +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug, plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plug_dest DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plug_dest +User plugin authentication_string +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; @@ -170,12 +170,12 @@ ERROR HY000: Operation CREATE USER failed for 'plug'@'%' DROP USER plug; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password plug test_plugin_server plug_dest GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password -plug *939AEE68989794C0F408277411C26055CDF41119 +User plugin authentication_string Password +plug mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug; GRANT ALL PRIVILEGES ON test_user_db.* TO plug IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug IDENTIFIED BY 'plug_dest_passwd'; @@ -184,18 +184,18 @@ DROP USER plug; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password plug test_plugin_server plug_dest plug_dest test_plugin_server plug_dest DROP USER plug,plug_dest; CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'plug_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password plug test_plugin_server plug_dest GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password plug test_plugin_server plug_dest plug_dest test_plugin_server plug_dest DROP USER plug,plug_dest; @@ -203,24 +203,24 @@ DROP USER plug,plug_dest; SET NAMES utf8; CREATE USER plüg IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg test_plugin_server plüg_dest DROP USER plüg; CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plüg_dest +User plugin authentication_string +plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plüg_dest; SET NAMES ascii; CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string pl??g test_plugin_server pl??g_dest DROP USER 'plüg'; CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -pl??g_dest +User plugin authentication_string +pl??g_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER 'plüg_dest'; SET NAMES latin1; ========== test 1.1.1.5 ==================================== @@ -228,36 +228,36 @@ CREATE USER 'plüg' IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest'; ERROR HY000: Plugin 'test_plügin_server' is not loaded CREATE USER 'plug' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server plüg_dest DROP USER 'plug'; CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plüg_dest +User plugin authentication_string +plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER 'plüg_dest'; SET NAMES utf8; CREATE USER plüg IDENTIFIED WITH 'test_plügin_server' AS 'plüg_dest'; ERROR HY000: Plugin 'test_plügin_server' is not loaded CREATE USER 'plüg' IDENTIFIED WITH 'test_plugin_server' AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg test_plugin_server plüg_dest DROP USER 'plüg'; CREATE USER 'plüg_dest' IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plüg_dest +User plugin authentication_string +plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER 'plüg_dest'; CREATE USER plüg IDENTIFIED WITH test_plugin_server AS 'plüg_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plüg test_plugin_server plüg_dest DROP USER plüg; CREATE USER plüg_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plüg_dest +User plugin authentication_string +plüg_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER plüg_dest; ========== test 1.1.1.2/1.1.2.2============================= SET @auth_name= 'test_plugin_server'; @@ -271,13 +271,13 @@ CREATE USER plug IDENTIFIED WITH 'hh''s_test_plugin_server' AS 'plug_dest'; ERROR HY000: Plugin 'hh's_test_plugin_server' is not loaded CREATE USER plug IDENTIFIED WITH 'test_plugin_server' AS 'hh''s_plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string plug test_plugin_server hh's_plug_dest DROP USER plug; CREATE USER 'hh''s_plug_dest' IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -hh's_plug_dest +User plugin authentication_string +hh's_plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 DROP USER 'hh''s_plug_dest'; ========== test 1.1.1.4 ==================================== CREATE USER plug IDENTIFIED WITH hh''s_test_plugin_server AS 'plug_dest'; @@ -285,21 +285,21 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp ========== test 1.1.3.1 ==================================== GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string grant_user test_plugin_server plug_dest CREATE USER plug_dest; DROP USER plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string grant_user test_plugin_server plug_dest -plug_dest +plug_dest mysql_native_password DROP USER grant_user,plug_dest; set @save_sql_mode= @@sql_mode; SET @@sql_mode=no_auto_create_user; GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string grant_user test_plugin_server plug_dest CREATE USER plug_dest; DROP USER plug_dest; @@ -308,19 +308,19 @@ ERROR 28000: Can't find any matching row in the user table DROP USER grant_user; GRANT INSERT ON test_user_db.* TO grant_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string grant_user test_plugin_server plug_dest CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password grant_user test_plugin_server plug_dest -plug_dest *939AEE68989794C0F408277411C26055CDF41119 +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 *939AEE68989794C0F408277411C26055CDF41119 DROP USER plug_dest; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_user_passwd'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password grant_user test_plugin_server plug_dest -plug_dest *560881EB651416CEF77314D07D55EDCD5FC1BD6D +plug_dest mysql_native_password *560881EB651416CEF77314D07D55EDCD5FC1BD6D *560881EB651416CEF77314D07D55EDCD5FC1BD6D DROP USER grant_user,plug_dest; set @@sql_mode= @save_sql_mode; DROP DATABASE test_user_db; diff --git a/mysql-test/main/plugin_auth_qa_1.result b/mysql-test/main/plugin_auth_qa_1.result index 42a7b1491c0..d2d902cb6a6 100644 --- a/mysql-test/main/plugin_auth_qa_1.result +++ b/mysql-test/main/plugin_auth_qa_1.result @@ -1,6 +1,6 @@ CREATE DATABASE test_user_db; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string ========== test 1.1.3.2 ==================================== CREATE USER plug_user IDENTIFIED WITH test_plugin_server AS 'plug_dest'; CREATE USER plug_dest IDENTIFIED BY 'plug_dest_passwd'; @@ -19,8 +19,8 @@ IDENTIFIED WITH test_plugin_server AS 'plug_dest'; GRANT ALL PRIVILEGES ON test_user_db.* TO plug_dest IDENTIFIED BY 'plug_dest_passwd'; GRANT PROXY ON plug_dest TO plug_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plug_dest +User plugin authentication_string +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest 1) current_user() @@ -70,8 +70,8 @@ ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using passwo GRANT PROXY ON new_dest TO plug_user; ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -new_dest +User plugin authentication_string +new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest DROP USER plug_user,new_dest; CREATE USER plug_user @@ -88,8 +88,8 @@ ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using passwo GRANT PROXY ON new_dest TO plug_user; ERROR 1045 (28000): Access denied for user 'plug_user'@'localhost' (using password: YES) SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -new_dest +User plugin authentication_string +new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest DROP USER plug_user,new_dest; CREATE USER plug_user @@ -109,15 +109,15 @@ USER() CURRENT_USER() new_user@localhost plug_dest@% connection default; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_user test_plugin_server plug_dest -plug_dest +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 disconnect plug_user; -UPDATE mysql.user SET user='plug_user' WHERE user='new_user'; +UPDATE mysql.global_priv SET user='plug_user' WHERE user='new_user'; FLUSH PRIVILEGES; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plug_dest +User plugin authentication_string +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest DROP USER plug_dest,plug_user; ========== test 1.3 ======================================== @@ -132,35 +132,35 @@ plug_user@localhost plug_dest@% connection default; disconnect plug_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -plug_dest +User plugin authentication_string +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 plug_user test_plugin_server plug_dest -UPDATE mysql.user SET user='new_user' WHERE user='plug_user'; +UPDATE mysql.global_priv SET user='new_user' WHERE user='plug_user'; FLUSH PRIVILEGES; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_user test_plugin_server plug_dest -plug_dest -UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user'; +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.authentication_string', 'new_dest') WHERE user='new_user'; FLUSH PRIVILEGES; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_user test_plugin_server new_dest -plug_dest -UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user'; +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'new_plugin_server') WHERE user='new_user'; FLUSH PRIVILEGES; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string new_user new_plugin_server new_dest -plug_dest +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 ERROR HY000: Plugin 'new_plugin_server' is not loaded -UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user'; -UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'test_plugin_server') WHERE user='new_user'; +UPDATE mysql.global_priv SET user='new_dest' WHERE user='plug_dest'; FLUSH PRIVILEGES; GRANT PROXY ON new_dest TO new_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -new_dest +User plugin authentication_string +new_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 new_user test_plugin_server new_dest connect plug_user,localhost,new_user,new_dest; select USER(),CURRENT_USER(); @@ -168,14 +168,14 @@ USER() CURRENT_USER() new_user@localhost new_dest@% connection default; disconnect plug_user; -UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest'; +UPDATE mysql.global_priv SET user='plug_dest' WHERE user='new_dest'; FLUSH PRIVILEGES; CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -new_dest +User plugin authentication_string +new_dest mysql_native_password *01422E86A6FFF84618914AF149F9AEF64B84170A new_user test_plugin_server new_dest -plug_dest +plug_dest mysql_native_password *939AEE68989794C0F408277411C26055CDF41119 GRANT ALL PRIVILEGES ON test.* TO new_user; connect plug_user,localhost,new_dest,new_dest_passwd; select USER(),CURRENT_USER(); @@ -188,9 +188,9 @@ DROP USER new_user,new_dest,plug_dest; CREATE USER ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string test_plugin_server proxied_user -proxied_user +proxied_user mysql_native_password *D7A51428CD38DB3C5293B9321DA1228BFB1611DD connect proxy_con,localhost,proxied_user,proxied_user_passwd; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() @@ -224,9 +224,9 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'%%' IDENTIFIED WITH test_plugin_server AS 'proxied_user'; CREATE USER proxied_user IDENTIFIED BY 'proxied_user_passwd'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string test_plugin_server proxied_user -proxied_user +proxied_user mysql_native_password *D7A51428CD38DB3C5293B9321DA1228BFB1611DD connect proxy_con,localhost,proxied_user,proxied_user_passwd; SELECT USER(),CURRENT_USER(); USER() CURRENT_USER() @@ -266,13 +266,13 @@ GRANT PROXY ON proxied_user_3 TO ''@'%%'; GRANT PROXY ON proxied_user_4 TO ''@'%%'; GRANT PROXY ON proxied_user_5 TO ''@'%%'; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string +User plugin authentication_string test_plugin_server proxied_user -proxied_user_1 -proxied_user_2 -proxied_user_3 -proxied_user_4 -proxied_user_5 +proxied_user_1 mysql_native_password *551D5A5177FCC3340F7D2FB0F4D8D1EEA7F7EF71 +proxied_user_2 mysql_native_password *3D948F77C6A988AFDCA9755AB2A6724362557220 +proxied_user_3 mysql_native_password *41A18925D237DEE738C76581153990B037F462E3 +proxied_user_4 mysql_native_password *F990073A9B96FF535C2D0721406042B8751E593F +proxied_user_5 mysql_native_password *5AA915C5D0B5B1336336FD2BF7768BC09FD1F5B2 connect proxy_con_1,localhost,proxied_user_1,'proxied_user_1_pwd'; connect proxy_con_2,localhost,proxied_user_2,proxied_user_2_pwd; connect proxy_con_3,localhost,proxied_user_3,proxied_user_3_pwd; diff --git a/mysql-test/main/plugin_auth_qa_1.test b/mysql-test/main/plugin_auth_qa_1.test index b0b8ffb3544..fb577fc178f 100644 --- a/mysql-test/main/plugin_auth_qa_1.test +++ b/mysql-test/main/plugin_auth_qa_1.test @@ -110,7 +110,7 @@ connection default; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; disconnect plug_user; -UPDATE mysql.user SET user='plug_user' WHERE user='new_user'; +UPDATE mysql.global_priv SET user='plug_user' WHERE user='new_user'; FLUSH PRIVILEGES; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; @@ -128,15 +128,15 @@ connection default; disconnect plug_user; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -UPDATE mysql.user SET user='new_user' WHERE user='plug_user'; +UPDATE mysql.global_priv SET user='new_user' WHERE user='plug_user'; FLUSH PRIVILEGES; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -UPDATE mysql.user SET authentication_string='new_dest' WHERE user='new_user'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.authentication_string', 'new_dest') WHERE user='new_user'; FLUSH PRIVILEGES; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -UPDATE mysql.user SET plugin='new_plugin_server' WHERE user='new_user'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'new_plugin_server') WHERE user='new_user'; FLUSH PRIVILEGES; --sorted_result SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; @@ -144,8 +144,8 @@ SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; --error ER_PLUGIN_IS_NOT_LOADED connect(plug_user,localhost,new_user,new_dest); --enable_query_log -UPDATE mysql.user SET plugin='test_plugin_server' WHERE user='new_user'; -UPDATE mysql.user SET USER='new_dest' WHERE user='plug_dest'; +UPDATE mysql.global_priv SET priv=JSON_SET(priv, '$.plugin', 'test_plugin_server') WHERE user='new_user'; +UPDATE mysql.global_priv SET user='new_dest' WHERE user='plug_dest'; FLUSH PRIVILEGES; GRANT PROXY ON new_dest TO new_user; --sorted_result @@ -154,7 +154,7 @@ connect(plug_user,localhost,new_user,new_dest); select USER(),CURRENT_USER(); connection default; disconnect plug_user; -UPDATE mysql.user SET USER='plug_dest' WHERE user='new_dest'; +UPDATE mysql.global_priv SET user='plug_dest' WHERE user='new_dest'; FLUSH PRIVILEGES; CREATE USER new_dest IDENTIFIED BY 'new_dest_passwd'; --sorted_result diff --git a/mysql-test/main/plugin_auth_qa_2.result b/mysql-test/main/plugin_auth_qa_2.result index fa88530be6a..e71132e2bc9 100644 --- a/mysql-test/main/plugin_auth_qa_2.result +++ b/mysql-test/main/plugin_auth_qa_2.result @@ -6,8 +6,8 @@ CREATE USER qa_test_1_dest IDENTIFIED BY 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_1_dest identified by 'dest_passwd'; GRANT PROXY ON qa_test_1_dest TO qa_test_1_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -qa_test_1_dest +User plugin authentication_string +qa_test_1_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_1_user qa_auth_interface qa_test_1_dest SELECT @@proxy_user; @@proxy_user @@ -19,8 +19,8 @@ exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_1_user --password=qa_test_1_ current_user() user() @@local.proxy_user @@local.external_user qa_test_1_user@% qa_test_1_user@localhost NULL NULL SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -qa_test_1_dest +User plugin authentication_string +qa_test_1_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_1_user qa_auth_interface qa_test_1_dest DROP USER qa_test_1_user; DROP USER qa_test_1_dest; @@ -32,9 +32,9 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_2_dest identified by 'dest_pas GRANT PROXY ON qa_test_2_dest TO qa_test_2_user; GRANT PROXY ON authenticated_as TO qa_test_2_user; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -authenticated_as -qa_test_2_dest +User plugin authentication_string +authenticated_as mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +qa_test_2_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_2_user qa_auth_interface qa_test_2_dest SELECT @@proxy_user; @@proxy_user @@ -46,9 +46,9 @@ exec MYSQL -h localhost -P MASTER_MYPORT -u qa_test_2_user --password=qa_test_2_ current_user() user() @@local.proxy_user @@local.external_user authenticated_as@% user_name@localhost 'qa_test_2_user'@'%' externaluser SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -authenticated_as -qa_test_2_dest +User plugin authentication_string +authenticated_as mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +qa_test_2_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_2_user qa_auth_interface qa_test_2_dest DROP USER qa_test_2_user; DROP USER qa_test_2_dest; @@ -82,9 +82,9 @@ GRANT ALL PRIVILEGES ON test_user_db.* TO ''@'localhost' identified by 'dest_pas GRANT PROXY ON qa_test_5_dest TO qa_test_5_user; GRANT PROXY ON qa_test_5_dest TO ''@'localhost'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password - *DFCACE76914AD7BD801FC1A1ECF6562272621A22 -qa_test_5_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +User plugin authentication_string Password + mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +qa_test_5_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_5_user qa_auth_interface qa_test_5_dest exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_5_user --password=qa_test_5_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 ERROR 1045 (28000): Access denied for user 'qa_test_5_user'@'localhost' (using password: YES) @@ -97,22 +97,22 @@ CREATE USER qa_test_6_dest IDENTIFIED BY 'dest_passwd'; GRANT ALL PRIVILEGES ON test_user_db.* TO qa_test_6_dest identified by 'dest_passwd'; GRANT PROXY ON qa_test_6_dest TO qa_test_6_user; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password -qa_test_6_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +User plugin authentication_string Password +qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_user qa_auth_interface qa_test_6_dest exec MYSQL -h localhost -P MASTER_MYPORT --user=qa_test_6_user --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 ERROR 1045 (28000): Access denied for user 'qa_test_6_user'@'localhost' (using password: YES) GRANT PROXY ON qa_test_6_dest TO root IDENTIFIED WITH qa_auth_interface AS 'qa_test_6_dest'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password -qa_test_6_dest *DFCACE76914AD7BD801FC1A1ECF6562272621A22 +User plugin authentication_string Password +qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_user qa_auth_interface qa_test_6_dest exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) REVOKE PROXY ON qa_test_6_dest FROM root; SELECT user,plugin,authentication_string FROM mysql.user WHERE user != 'root'; -user plugin authentication_string -qa_test_6_dest +User plugin authentication_string +qa_test_6_dest mysql_native_password *DFCACE76914AD7BD801FC1A1ECF6562272621A22 qa_test_6_user qa_auth_interface qa_test_6_dest exec MYSQL -h localhost -P MASTER_MYPORT --user=root --password=qa_test_6_dest test_user_db -e "SELECT current_user(),user(),@@local.proxy_user,@@local.external_user;" 2>&1 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) @@ -120,7 +120,7 @@ DROP USER qa_test_6_user; DROP USER qa_test_6_dest; DELETE FROM mysql.user WHERE user='root' AND plugin='qa_auth_interface'; SELECT user,plugin,authentication_string,password FROM mysql.user WHERE user != 'root'; -user plugin authentication_string password +User plugin authentication_string Password === Test of the --default_auth option for clients ==== CREATE USER qa_test_11_user IDENTIFIED WITH qa_auth_interface AS 'qa_test_11_dest'; CREATE USER qa_test_11_dest IDENTIFIED BY 'dest_passwd'; diff --git a/mysql-test/main/processlist.result b/mysql-test/main/processlist.result index b8e2271530d..ab518d961ef 100644 --- a/mysql-test/main/processlist.result +++ b/mysql-test/main/processlist.result @@ -39,7 +39,7 @@ utf8mb4_string xxx😎yyy Warnings: Level Warning Code 1366 -Message Incorrect string value: '\xF0\x9F\x98\x8Eyy...' for column 'INFO' at row 1 +Message Incorrect string value: '\xF0\x9F\x98\x8Eyy...' for column `information_schema`.`(temporary)`.`INFO` at row 1 # # End of 10.1 tests # diff --git a/mysql-test/main/ps.result b/mysql-test/main/ps.result index d619b213508..a72b6660288 100644 --- a/mysql-test/main/ps.result +++ b/mysql-test/main/ps.result @@ -1381,9 +1381,11 @@ test.t1 optimize status Table is already up to date prepare stmt from "analyze table t1"; execute stmt; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date execute stmt; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date prepare stmt from "repair table t1, t2, t3"; execute stmt; @@ -1410,13 +1412,19 @@ test.t3 optimize status Table is already up to date prepare stmt from "analyze table t1, t2, t3"; execute stmt; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date execute stmt; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date prepare stmt from "repair table t1, t4, t3"; execute stmt; @@ -1449,11 +1457,13 @@ execute stmt; Table Op Msg_type Msg_text test.t4 analyze Error Table 'test.t4' doesn't exist test.t4 analyze status Operation failed +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date execute stmt; Table Op Msg_type Msg_text test.t4 analyze Error Table 'test.t4' doesn't exist test.t4 analyze status Operation failed +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date deallocate prepare stmt; drop table t1, t2, t3; @@ -1520,6 +1530,7 @@ Field Type Null Key Default Extra i int(11) YES NULL execute stmt_analyze; Table Op Msg_type Msg_text +mysqltest_long_database_name_to_thrash_heap.t1 analyze status Engine-independent statistics collected mysqltest_long_database_name_to_thrash_heap.t1 analyze status Table is already up to date execute stmt_optimize; Table Op Msg_type Msg_text @@ -2136,7 +2147,11 @@ select Host, User from mysql.user limit 0; Host User show open tables from mysql; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 mysql user 0 0 call proc_1(); show open tables from mysql; @@ -2146,7 +2161,11 @@ select Host, User from mysql.user limit 0; Host User show open tables from mysql; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 mysql user 0 0 call proc_1(); show open tables from mysql; @@ -2156,7 +2175,11 @@ select Host, User from mysql.user limit 0; Host User show open tables from mysql; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 mysql user 0 0 call proc_1(); show open tables from mysql; @@ -2166,7 +2189,11 @@ select Host, User from mysql.user limit 0; Host User show open tables from mysql; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 mysql user 0 0 flush tables; create function func_1() returns int begin flush tables; return 1; end| @@ -2181,7 +2208,11 @@ select Host, User from mysql.user limit 0; Host User show open tables from mysql; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 mysql user 0 0 prepare abc from "flush tables"; execute abc; @@ -2192,7 +2223,11 @@ select Host, User from mysql.user limit 0; Host User show open tables from mysql; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 mysql user 0 0 execute abc; show open tables from mysql; @@ -2202,7 +2237,11 @@ select Host, User from mysql.user limit 0; Host User show open tables from mysql; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 mysql user 0 0 execute abc; show open tables from mysql; @@ -2212,7 +2251,11 @@ select Host, User from mysql.user limit 0; Host User show open tables from mysql; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql global_priv 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 mysql user 0 0 flush tables; deallocate prepare abc; @@ -5122,13 +5165,13 @@ DECLARE a DATETIME; CALL p1(a); END; $$ -ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1 +ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1 BEGIN NOT ATOMIC DECLARE a DATETIME; EXECUTE IMMEDIATE 'CALL p1(?)' USING a; END; $$ -ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1 +ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1 BEGIN NOT ATOMIC DECLARE a DATETIME; PREPARE stmt FROM 'CALL p1(?)'; @@ -5136,7 +5179,7 @@ EXECUTE stmt USING a; DEALLOCATE PREPARE stmt; END; $$ -ERROR 22007: Incorrect datetime value: '10' for column 'a' at row 1 +ERROR 22007: Incorrect datetime value: '10' for column ``.``.`a` at row 1 DROP PROCEDURE p1; # # MDEV-14454 Binary protocol returns wrong collation ID for SP OUT parameters @@ -5221,6 +5264,7 @@ CREATE PROCEDURE p1(tn VARCHAR(32)) EXECUTE IMMEDIATE CONCAT('ANALYZE TABLE ',tn); CALL p1('t1'); Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date DROP PROCEDURE p1; DROP TABLE t1; diff --git a/mysql-test/main/ps_ddl.result b/mysql-test/main/ps_ddl.result index 402dc840479..c5c5b5a9ac0 100644 --- a/mysql-test/main/ps_ddl.result +++ b/mysql-test/main/ps_ddl.result @@ -769,11 +769,12 @@ deallocate prepare stmt; # # Test 3: View referencing an Information schema table # -create view t1 as select table_name from information_schema.views; +create view t1 as select table_name from information_schema.views order by table_name; prepare stmt from "select * from t1"; execute stmt; table_name t1 +user call p_verify_reprepare_count(0); SUCCESS @@ -781,6 +782,7 @@ create temporary table t1 (a int); execute stmt; table_name t1 +user call p_verify_reprepare_count(0); SUCCESS @@ -1405,6 +1407,7 @@ SUCCESS prepare stmt from "analyze table t1"; execute stmt; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK drop table t1; create table t1 (a1 int, a2 int); @@ -1412,14 +1415,17 @@ insert into t1 values (1, 10), (2, 20), (3, 30); # t1 has changed, and it's not a problem execute stmt; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK alter table t1 add column b varchar(50) default NULL; execute stmt; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK alter table t1 drop column b; execute stmt; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK call p_verify_reprepare_count(0); SUCCESS diff --git a/mysql-test/main/ps_ddl.test b/mysql-test/main/ps_ddl.test index 90226d379bf..dafb5b5dea3 100644 --- a/mysql-test/main/ps_ddl.test +++ b/mysql-test/main/ps_ddl.test @@ -699,7 +699,7 @@ deallocate prepare stmt; --echo # --echo # Test 3: View referencing an Information schema table --echo # -create view t1 as select table_name from information_schema.views; +create view t1 as select table_name from information_schema.views order by table_name; prepare stmt from "select * from t1"; execute stmt; diff --git a/mysql-test/main/ps_error.result b/mysql-test/main/ps_error.result new file mode 100644 index 00000000000..c3c312e82f5 --- /dev/null +++ b/mysql-test/main/ps_error.result @@ -0,0 +1,73 @@ +# +# MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS +# +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY NULL WITH ROLLUP; +a +DROP TABLE t1; +SET sql_mode=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ; +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS +# +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT 'All done'; +All done +All done +SET SQL_MODE=DEFAULT; +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +DEALLOCATE PREPARE stmt; +SELECT 'All done'; +All done +All done +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY a; +a +SELECT * FROM t1; +a +DROP TABLE t1; +SET SQL_MODE=DEFAULT; +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +Warnings: +Warning 1292 Truncated incorrect INTEGER value: 'foo' +EXECUTE stmt; +ERROR 22007: Truncated incorrect INTEGER value: 'foo' +SELECT a FROM t1 GROUP BY a; +a +INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; diff --git a/mysql-test/main/ps_error.test b/mysql-test/main/ps_error.test new file mode 100644 index 00000000000..5efb5d36137 --- /dev/null +++ b/mysql-test/main/ps_error.test @@ -0,0 +1,66 @@ +# +# Tests related to PS returning errors rather than doing successfull execution +# + +--echo # +--echo # MDEV-17741 Assertion `thd->Item_change_list::is_empty()' failed in mysql_parse after unsuccessful PS +--echo # + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY NULL WITH ROLLUP; +DROP TABLE t1; +SET sql_mode=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SET @a = REPLACE( @@global.optimizer_switch, '=on', '=off' ) ; +DROP TABLE t1; +SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-17738 Server crashes in Item::delete_self on closing connection after unsuccessful PS +--echo # + +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +--source include/restart_mysqld.inc +SELECT 'All done'; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE='STRICT_ALL_TABLES'; +PREPARE stmt FROM "CREATE TABLE ps AS SELECT 1 FROM DUAL WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +DEALLOCATE PREPARE stmt; +SELECT 'All done'; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY a; +SELECT * FROM t1; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; + +SET SQL_MODE= 'STRICT_ALL_TABLES'; +CREATE TABLE t1 (a INT); +PREPARE stmt FROM "CREATE TABLE tmp AS SELECT * FROM t1 WHERE 'foo' && 0"; +--error ER_TRUNCATED_WRONG_VALUE +EXECUTE stmt; +SELECT a FROM t1 GROUP BY a; +INSERT t1 SELECT * FROM ( SELECT * FROM t1 ) sq; +DROP TABLE t1; +SET SQL_MODE=DEFAULT; diff --git a/mysql-test/main/query_cache.result b/mysql-test/main/query_cache.result index e1123b1cb8b..f5d8b5eb461 100644 --- a/mysql-test/main/query_cache.result +++ b/mysql-test/main/query_cache.result @@ -967,19 +967,19 @@ INSERT INTO t1 VALUES ('20050326'); INSERT INTO t1 VALUES ('20050325'); SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid'; COUNT(*) -0 +1 Warnings: -Warning 1292 Incorrect datetime value: '20050327 invalid' +Warning 1292 Truncated incorrect date value: '20050327 invalid' SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050328 invalid'; COUNT(*) -0 +1 Warnings: -Warning 1292 Incorrect datetime value: '20050328 invalid' +Warning 1292 Truncated incorrect date value: '20050328 invalid' SELECT COUNT(*) FROM t1 WHERE date BETWEEN '20050326' AND '20050327 invalid'; COUNT(*) -0 +1 Warnings: -Warning 1292 Incorrect datetime value: '20050327 invalid' +Warning 1292 Truncated incorrect date value: '20050327 invalid' show status like "Qcache_queries_in_cache"; Variable_name Value Qcache_queries_in_cache 0 diff --git a/mysql-test/main/query_cache_innodb.result b/mysql-test/main/query_cache_innodb.result index 643a065612f..146a6fbc289 100644 --- a/mysql-test/main/query_cache_innodb.result +++ b/mysql-test/main/query_cache_innodb.result @@ -84,7 +84,7 @@ t2id id use test; drop database `#mysql50#-`; SET NAMES default; -FOUND 12 /\[ERROR\] Invalid \(old\?\) table or database name/ in mysqld.1.err +FOUND 8 /\[ERROR\] Invalid \(old\?\) table or database name/ in mysqld.1.err set global query_cache_type=DEFAULT; set global query_cache_size=DEFAULT; End of 10.2 tests diff --git a/mysql-test/main/range.result b/mysql-test/main/range.result index 464c0bf031a..2c2f7be096d 100644 --- a/mysql-test/main/range.result +++ b/mysql-test/main/range.result @@ -416,7 +416,9 @@ count(*) 1026 analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date explain select * from t1, t2 where t1.uid=t2.uid AND t1.uid > 0; id select_type table type possible_keys key key_len ref rows Extra @@ -1101,7 +1103,7 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price Warnings: -Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' +Warning 1292 Truncated incorrect datetime value: '2005-12-01 24:00:00' SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00'; item started price A1 2005-11-01 08:00:00 1000.000 @@ -1113,7 +1115,7 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price Warnings: -Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' +Warning 1292 Truncated incorrect datetime value: '2005-12-01 24:00:00' SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00'; item started price A1 2005-11-01 08:00:00 1000.000 @@ -1563,7 +1565,7 @@ str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND str_to_date('2007-20-00', '%Y-%m-%d') <= ''; str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND @@ -1578,7 +1580,7 @@ SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'; str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''; str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '' NULL @@ -1886,6 +1888,7 @@ alter table t1 add key2 int not null, add index i2(key2); update t1 set key2=key1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK create table t2 (a int); insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8); @@ -2056,22 +2059,22 @@ SELECT * FROM t1 WHERE fd='😁'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 SELECT * FROM t1 WHERE fd='😁'; id fd Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 # The following must not use range access: explain select count(*) from t1 where fd <'😁'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 select count(*) from t1 where fd <'😁'; count(*) 40960 Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 select count(*) from t1 ignore index (ix_fd) where fd <'😁'; count(*) 40960 @@ -2084,6 +2087,7 @@ insert into t2 select * from t2; insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1); analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK select a, b from t2 where (a, b) in ((0, 0), (1, 1)); a b @@ -2293,7 +2297,7 @@ EXPLAIN SELECT * FROM t1 WHERE a<=>'😎'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; # # MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in @@ -2473,7 +2477,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["d"], "rows": 3, - "filtered": 100, + "filtered": 55, "index_condition": "t2.d is not null", "attached_condition": "(t2.d,t2.e) in (((3,3)),((7,7)),((2,2)))" }, @@ -2529,36 +2533,36 @@ insert into t2 values explain select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 6 Using index condition -1 SIMPLE t2 ref idx1,idx2 idx1 5 test.t1.a 12 Using where +1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 8 Using index condition; Using where +1 SIMPLE t1 ref idx idx 5 test.t2.d 8 explain format=json select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "range", - "possible_keys": ["idx"], - "key": "idx", - "key_length": "5", - "used_key_parts": ["a"], - "rows": 6, - "filtered": 100, - "index_condition": "t1.a is not null" - }, "table": { "table_name": "t2", - "access_type": "ref", + "access_type": "range", "possible_keys": ["idx1", "idx2"], "key": "idx1", "key_length": "5", "used_key_parts": ["d"], - "ref": ["test.t1.a"], - "rows": 12, - "filtered": 100, - "attached_condition": "(t1.a,t2.e) in (((3,3)),((7,7)),((8,8))) and octet_length(t2.f) = 1" + "rows": 8, + "filtered": 12.5, + "index_condition": "t2.d is not null", + "attached_condition": "(t2.d,t2.e) in (((3,3)),((7,7)),((8,8))) and octet_length(t2.f) = 1" + }, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.d"], + "rows": 8, + "filtered": 100 } } } @@ -2566,16 +2570,16 @@ select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; a b c d e f 3 2 uuuw 3 3 i -3 2 uuuw 3 3 i -3 2 uuua 3 3 i 3 2 uuua 3 3 i 3 3 zzzz 3 3 i -3 3 zzzz 3 3 i 3 3 zyxw 3 3 i -3 3 zyxw 3 3 i -3 3 zzza 3 3 i 3 3 zzza 3 3 i 3 3 zyxa 3 3 i +3 2 uuuw 3 3 i +3 2 uuua 3 3 i +3 3 zzzz 3 3 i +3 3 zyxw 3 3 i +3 3 zzza 3 3 i 3 3 zyxa 3 3 i 7 7 xxxyy 7 7 h 7 7 xxxya 7 7 h @@ -2586,16 +2590,16 @@ where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1"; execute stmt; a b c d e f 3 2 uuuw 3 3 i -3 2 uuuw 3 3 i -3 2 uuua 3 3 i 3 2 uuua 3 3 i 3 3 zzzz 3 3 i -3 3 zzzz 3 3 i 3 3 zyxw 3 3 i -3 3 zyxw 3 3 i -3 3 zzza 3 3 i 3 3 zzza 3 3 i 3 3 zyxa 3 3 i +3 2 uuuw 3 3 i +3 2 uuua 3 3 i +3 3 zzzz 3 3 i +3 3 zyxw 3 3 i +3 3 zzza 3 3 i 3 3 zyxa 3 3 i 7 7 xxxyy 7 7 h 7 7 xxxya 7 7 h @@ -2604,16 +2608,16 @@ a b c d e f execute stmt; a b c d e f 3 2 uuuw 3 3 i -3 2 uuuw 3 3 i -3 2 uuua 3 3 i 3 2 uuua 3 3 i 3 3 zzzz 3 3 i -3 3 zzzz 3 3 i 3 3 zyxw 3 3 i -3 3 zyxw 3 3 i -3 3 zzza 3 3 i 3 3 zzza 3 3 i 3 3 zyxa 3 3 i +3 2 uuuw 3 3 i +3 2 uuua 3 3 i +3 3 zzzz 3 3 i +3 3 zyxw 3 3 i +3 3 zzza 3 3 i 3 3 zyxa 3 3 i 7 7 xxxyy 7 7 h 7 7 xxxya 7 7 h @@ -2642,7 +2646,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["e"], "rows": 6, - "filtered": 100, + "filtered": 6.7308, "attached_condition": "(t2.d,t2.e) in (((4,4)),((7,7)),((8,8))) and octet_length(t2.f) = 1 and t2.d is not null" }, "table": { @@ -2993,6 +2997,7 @@ insert into t1 select a+15, concat(b,'yy') from t1; insert into t1 select a+100, concat(b,'xx') from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK select cast(count(a)/count(distinct a) as unsigned) as rec_per_key from t1; rec_per_key @@ -3011,7 +3016,7 @@ a b set eq_range_index_dive_limit=2; explain select * from t1 where a in (8, 15, 31, 1, 9); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 10 Using index condition +1 SIMPLE t1 range idx idx 5 NULL 5 Using index condition select * from t1 where a in (8, 15, 31, 1, 9); a b 1 yy diff --git a/mysql-test/main/range_innodb.result b/mysql-test/main/range_innodb.result index 794e6c7b3cc..30161a2711d 100644 --- a/mysql-test/main/range_innodb.result +++ b/mysql-test/main/range_innodb.result @@ -30,6 +30,7 @@ repeat('0123456789', 10) from t1; analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK # The following must not use "Range checked for each record": explain select * from t0 left join t2 on t2.a 0; id select_type table type possible_keys key key_len ref rows Extra @@ -1103,7 +1105,7 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price Warnings: -Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' +Warning 1292 Truncated incorrect datetime value: '2005-12-01 24:00:00' SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00'; item started price A1 2005-11-01 08:00:00 1000.000 @@ -1115,7 +1117,7 @@ id select_type table type possible_keys key key_len ref rows Extra SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-01 24:00:00'; item started price Warnings: -Warning 1292 Incorrect datetime value: '2005-12-01 24:00:00' +Warning 1292 Truncated incorrect datetime value: '2005-12-01 24:00:00' SELECT * FROM t1 WHERE item='A1' AND started<='2005-12-02 00:00:00'; item started price A1 2005-11-01 08:00:00 1000.000 @@ -1565,7 +1567,7 @@ str_to_date('2007-10-00', '%Y-%m-%d') >= '' AND str_to_date('2007-10-00', '%Y-%m-%d') <= '2007/10/20' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND str_to_date('2007-20-00', '%Y-%m-%d') <= ''; str_to_date('2007-20-00', '%Y-%m-%d') >= '2007/10/20' AND @@ -1580,7 +1582,7 @@ SELECT str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20'; str_to_date('2007-10-00', '%Y-%m-%d') BETWEEN '' AND '2007/10/20' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND ''; str_to_date('2007-20-00', '%Y-%m-%d') BETWEEN '2007/10/20' AND '' NULL @@ -1888,6 +1890,7 @@ alter table t1 add key2 int not null, add index i2(key2); update t1 set key2=key1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK create table t2 (a int); insert into t2 values (1),(2),(3),(4),(5),(6),(7),(8); @@ -2058,22 +2061,22 @@ SELECT * FROM t1 WHERE fd='😁'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 SELECT * FROM t1 WHERE fd='😁'; id fd Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 # The following must not use range access: explain select count(*) from t1 where fd <'😁'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE t1 index ix_fd ix_fd 63 NULL # Using where; Using index Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 select count(*) from t1 where fd <'😁'; count(*) 40960 Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column 'fd' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x81' for column `test`.`t1`.`fd` at row 1 select count(*) from t1 ignore index (ix_fd) where fd <'😁'; count(*) 40960 @@ -2086,6 +2089,7 @@ insert into t2 select * from t2; insert into t2 values (0, 0, 0, 0), (1, 1, 1, 1); analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK select a, b from t2 where (a, b) in ((0, 0), (1, 1)); a b @@ -2295,7 +2299,7 @@ EXPLAIN SELECT * FROM t1 WHERE a<=>'😎'; id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables Warnings: -Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column 'a' at row 1 +Warning 1366 Incorrect string value: '\xF0\x9F\x98\x8E' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; # # MDEV-10185: Assertion `tree1->keys[key_no] && tree2->keys[key_no]' failed in @@ -2478,7 +2482,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["d"], "rows": 3, - "filtered": 100, + "filtered": 55, "index_condition": "t2.d is not null", "attached_condition": "(t2.d,t2.e) in (((3,3)),((7,7)),((2,2)))", "mrr_type": "Rowid-ordered scan" @@ -2535,97 +2539,97 @@ insert into t2 values explain select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 6 Using index condition; Rowid-ordered scan -1 SIMPLE t2 ref idx1,idx2 idx1 5 test.t1.a 12 Using where +1 SIMPLE t2 range idx1,idx2 idx1 5 NULL 8 Using index condition; Using where; Rowid-ordered scan +1 SIMPLE t1 ref idx idx 5 test.t2.d 8 explain format=json select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; EXPLAIN { "query_block": { "select_id": 1, - "table": { - "table_name": "t1", - "access_type": "range", - "possible_keys": ["idx"], - "key": "idx", - "key_length": "5", - "used_key_parts": ["a"], - "rows": 6, - "filtered": 100, - "index_condition": "t1.a is not null", - "mrr_type": "Rowid-ordered scan" - }, "table": { "table_name": "t2", - "access_type": "ref", + "access_type": "range", "possible_keys": ["idx1", "idx2"], "key": "idx1", "key_length": "5", "used_key_parts": ["d"], - "ref": ["test.t1.a"], - "rows": 12, - "filtered": 100, - "attached_condition": "(t1.a,t2.e) in (((3,3)),((7,7)),((8,8))) and octet_length(t2.f) = 1" + "rows": 8, + "filtered": 12.5, + "index_condition": "t2.d is not null", + "attached_condition": "(t2.d,t2.e) in (((3,3)),((7,7)),((8,8))) and octet_length(t2.f) = 1", + "mrr_type": "Rowid-ordered scan" + }, + "table": { + "table_name": "t1", + "access_type": "ref", + "possible_keys": ["idx"], + "key": "idx", + "key_length": "5", + "used_key_parts": ["a"], + "ref": ["test.t2.d"], + "rows": 8, + "filtered": 100 } } } select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1; a b c d e f +3 2 uuuw 3 3 i +3 2 uuua 3 3 i 3 3 zzzz 3 3 i -3 3 zzzz 3 3 i -7 8 xxxxx 7 7 h +3 3 zyxw 3 3 i +3 3 zzza 3 3 i +3 3 zyxa 3 3 i 7 7 xxxyy 7 7 h -3 3 zyxw 3 3 i -3 3 zyxw 3 3 i -3 2 uuuw 3 3 i -3 2 uuuw 3 3 i -3 3 zzza 3 3 i -3 3 zzza 3 3 i -7 8 xxxxa 7 7 h 7 7 xxxya 7 7 h -3 3 zyxa 3 3 i -3 3 zyxa 3 3 i -3 2 uuua 3 3 i +7 8 xxxxx 7 7 h +7 8 xxxxa 7 7 h +3 2 uuuw 3 3 i 3 2 uuua 3 3 i +3 3 zzzz 3 3 i +3 3 zyxw 3 3 i +3 3 zzza 3 3 i +3 3 zyxa 3 3 i prepare stmt from "select * from t1,t2 where a = d and (a,e) in ((3,3),(7,7),(8,8)) and length(f) = 1"; execute stmt; a b c d e f +3 2 uuuw 3 3 i +3 2 uuua 3 3 i 3 3 zzzz 3 3 i -3 3 zzzz 3 3 i -7 8 xxxxx 7 7 h +3 3 zyxw 3 3 i +3 3 zzza 3 3 i +3 3 zyxa 3 3 i 7 7 xxxyy 7 7 h -3 3 zyxw 3 3 i -3 3 zyxw 3 3 i -3 2 uuuw 3 3 i -3 2 uuuw 3 3 i -3 3 zzza 3 3 i -3 3 zzza 3 3 i -7 8 xxxxa 7 7 h 7 7 xxxya 7 7 h -3 3 zyxa 3 3 i -3 3 zyxa 3 3 i -3 2 uuua 3 3 i +7 8 xxxxx 7 7 h +7 8 xxxxa 7 7 h +3 2 uuuw 3 3 i 3 2 uuua 3 3 i +3 3 zzzz 3 3 i +3 3 zyxw 3 3 i +3 3 zzza 3 3 i +3 3 zyxa 3 3 i execute stmt; a b c d e f +3 2 uuuw 3 3 i +3 2 uuua 3 3 i 3 3 zzzz 3 3 i -3 3 zzzz 3 3 i -7 8 xxxxx 7 7 h +3 3 zyxw 3 3 i +3 3 zzza 3 3 i +3 3 zyxa 3 3 i 7 7 xxxyy 7 7 h -3 3 zyxw 3 3 i -3 3 zyxw 3 3 i -3 2 uuuw 3 3 i -3 2 uuuw 3 3 i -3 3 zzza 3 3 i -3 3 zzza 3 3 i -7 8 xxxxa 7 7 h 7 7 xxxya 7 7 h -3 3 zyxa 3 3 i -3 3 zyxa 3 3 i -3 2 uuua 3 3 i +7 8 xxxxx 7 7 h +7 8 xxxxa 7 7 h +3 2 uuuw 3 3 i 3 2 uuua 3 3 i +3 3 zzzz 3 3 i +3 3 zyxw 3 3 i +3 3 zzza 3 3 i +3 3 zyxa 3 3 i deallocate prepare stmt; insert into t1 select * from t1; # join order: (t2,t1) with ref access of t1 @@ -2649,7 +2653,7 @@ EXPLAIN "key_length": "5", "used_key_parts": ["e"], "rows": 6, - "filtered": 100, + "filtered": 6.7308, "attached_condition": "(t2.d,t2.e) in (((4,4)),((7,7)),((8,8))) and octet_length(t2.f) = 1 and t2.d is not null", "mrr_type": "Rowid-ordered scan" }, @@ -3005,6 +3009,7 @@ insert into t1 select a+15, concat(b,'yy') from t1; insert into t1 select a+100, concat(b,'xx') from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK select cast(count(a)/count(distinct a) as unsigned) as rec_per_key from t1; rec_per_key @@ -3023,7 +3028,7 @@ a b set eq_range_index_dive_limit=2; explain select * from t1 where a in (8, 15, 31, 1, 9); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 range idx idx 5 NULL 10 Using index condition; Rowid-ordered scan +1 SIMPLE t1 range idx idx 5 NULL 5 Using index condition; Rowid-ordered scan select * from t1 where a in (8, 15, 31, 1, 9); a b 1 yy diff --git a/mysql-test/main/range_vs_index_merge.result b/mysql-test/main/range_vs_index_merge.result index bc46a4fdd0b..b8900afb774 100644 --- a/mysql-test/main/range_vs_index_merge.result +++ b/mysql-test/main/range_vs_index_merge.result @@ -1079,7 +1079,7 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CountryName,CityName 38,35 NULL 28 Using sort_union(CountryName,CityName); Using where +1 SIMPLE City index_merge Country,CountryPopulation,CountryName,CityName CityName,CountryName 35,38 NULL 27 Using sort_union(CityName,CountryName); Using where SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@ -1166,7 +1166,7 @@ EXPLAIN SELECT Name, Country, Population FROM City WHERE (Name='Samara' AND Country='RUS') OR (Name='Seattle' AND Country='USA'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 29 Using index condition; Using where +1 SIMPLE City range Country,CountryPopulation,CountryName,CityName CountryName 38 NULL 27 Using index condition; Using where SELECT Name, Country, Population FROM City WHERE (Name='Manila' AND Country='PHL') OR (Name='Addis Abeba' AND Country='ETH') OR @@ -1343,6 +1343,38 @@ Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 +set @tmp_mdev585=@@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=1; +EXPLAIN +SELECT * FROM City +WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) +AND (Population >= 100000 AND Population < 120000) +ORDER BY Population LIMIT 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where +FLUSH STATUS; +SELECT * FROM City +WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) +AND (Population >= 100000 AND Population < 120000) +ORDER BY Population LIMIT 5; +ID Name Country Population +519 Worthing GBR 100000 +638 al-Arish EGY 100447 +518 Basildon GBR 100924 +707 Marbella ESP 101144 +3792 Tartu EST 101246 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_last 0 +Handler_read_next 59 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +set optimizer_use_condition_selectivity=@tmp_mdev585; set optimizer_switch='index_merge=off'; EXPLAIN SELECT * FROM City @@ -1430,6 +1462,7 @@ insert into t1(account_id, login, home_state, work_state) select 1, 'pw', 'ak', 'ak' from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK select count(*) from t1 where account_id = 1; count(*) @@ -1491,6 +1524,7 @@ insert into t1 (c2, c3, c4, c5, cp) select c2, c3, c4, c5, cp from t1 where cp = 4; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (c2=1 and c3=1) or (c4=2 and c5=1); @@ -1543,6 +1577,7 @@ insert into t1 (c2,c3,c4) select c2,c3,3 from t1 where c2 != 'a'; insert into t1 (c2,c3,c4) select c2,c3,4 from t1 where c2 != 'a'; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK select count(*) from t1 where (c2='e' OR c3='q'); count(*) @@ -1582,6 +1617,7 @@ update t1 set c1=lpad(id+1000, 12, ' '), c2=lpad(id+10000, 15, ' '); alter table t1 add unique index (c1), add unique index (c2), add index (c3); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date explain select * from t1 where (c1=' 100000' or c2=' 2000000'); @@ -1886,6 +1922,6 @@ Country='POL' AND Name IN ('Warszawa', 'Wroclaw') OR Country='NOR' AND Name IN ('Oslo', 'Bergen') OR Country='ITA' AND Name IN ('Napoli', 'Venezia'); id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE City range CountryName,Name CountryName 38 NULL 22 Using index condition; Using where +1 SIMPLE City range CountryName,Name CountryName 38 NULL 20 Using index condition; Using where DROP DATABASE world; set session optimizer_switch='index_merge_sort_intersection=default'; diff --git a/mysql-test/main/range_vs_index_merge.test b/mysql-test/main/range_vs_index_merge.test index 84b87579e85..762fb481b39 100644 --- a/mysql-test/main/range_vs_index_merge.test +++ b/mysql-test/main/range_vs_index_merge.test @@ -718,6 +718,23 @@ SELECT * FROM City ORDER BY Population LIMIT 5; SHOW STATUS LIKE 'Handler_read_%'; +set @tmp_mdev585=@@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=1; +--replace_column 9 # +EXPLAIN +SELECT * FROM City + WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) + AND (Population >= 100000 AND Population < 120000) +ORDER BY Population LIMIT 5; + +FLUSH STATUS; +SELECT * FROM City + WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) + AND (Population >= 100000 AND Population < 120000) +ORDER BY Population LIMIT 5; +SHOW STATUS LIKE 'Handler_read_%'; + +set optimizer_use_condition_selectivity=@tmp_mdev585; set optimizer_switch='index_merge=off'; diff --git a/mysql-test/main/range_vs_index_merge_innodb.result b/mysql-test/main/range_vs_index_merge_innodb.result index ce90f522d6e..9e85973474c 100644 --- a/mysql-test/main/range_vs_index_merge_innodb.result +++ b/mysql-test/main/range_vs_index_merge_innodb.result @@ -1344,6 +1344,38 @@ Handler_read_retry 0 Handler_read_rnd 0 Handler_read_rnd_deleted 0 Handler_read_rnd_next 0 +set @tmp_mdev585=@@optimizer_use_condition_selectivity; +set optimizer_use_condition_selectivity=1; +EXPLAIN +SELECT * FROM City +WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) +AND (Population >= 100000 AND Population < 120000) +ORDER BY Population LIMIT 5; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE City range Country,Name,Population Population 4 NULL # Using where +FLUSH STATUS; +SELECT * FROM City +WHERE ((Name > 'Ca' AND Name < 'Cf') OR (Country > 'E' AND Country < 'H')) +AND (Population >= 100000 AND Population < 120000) +ORDER BY Population LIMIT 5; +ID Name Country Population +519 Worthing GBR 100000 +638 al-Arish EGY 100447 +518 Basildon GBR 100924 +707 Marbella ESP 101144 +3792 Tartu EST 101246 +SHOW STATUS LIKE 'Handler_read_%'; +Variable_name Value +Handler_read_first 0 +Handler_read_key 1 +Handler_read_last 0 +Handler_read_next 59 +Handler_read_prev 0 +Handler_read_retry 0 +Handler_read_rnd 0 +Handler_read_rnd_deleted 0 +Handler_read_rnd_next 0 +set optimizer_use_condition_selectivity=@tmp_mdev585; set optimizer_switch='index_merge=off'; EXPLAIN SELECT * FROM City @@ -1431,6 +1463,7 @@ insert into t1(account_id, login, home_state, work_state) select 1, 'pw', 'ak', 'ak' from t1; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK select count(*) from t1 where account_id = 1; count(*) @@ -1492,6 +1525,7 @@ insert into t1 (c2, c3, c4, c5, cp) select c2, c3, c4, c5, cp from t1 where cp = 4; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (c2=1 and c3=1) or (c4=2 and c5=1); @@ -1544,6 +1578,7 @@ insert into t1 (c2,c3,c4) select c2,c3,3 from t1 where c2 != 'a'; insert into t1 (c2,c3,c4) select c2,c3,4 from t1 where c2 != 'a'; analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK select count(*) from t1 where (c2='e' OR c3='q'); count(*) @@ -1583,6 +1618,7 @@ update t1 set c1=lpad(id+1000, 12, ' '), c2=lpad(id+10000, 15, ' '); alter table t1 add unique index (c1), add unique index (c2), add index (c3); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK explain select * from t1 where (c1=' 100000' or c2=' 2000000'); diff --git a/mysql-test/main/read_only.result b/mysql-test/main/read_only.result index 2029413c0f0..83dfada5f29 100644 --- a/mysql-test/main/read_only.result +++ b/mysql-test/main/read_only.result @@ -170,11 +170,24 @@ flush privileges; drop database mysqltest_db1; set global read_only= @start_read_only; # +# MDEV-16987 - ALTER DATABASE possible in read-only mode +# +CREATE USER user1@localhost; +GRANT ALTER ON test1.* TO user1@localhost; +CREATE DATABASE test1; +SET GLOBAL read_only=1; +ALTER DATABASE test1 CHARACTER SET utf8; +ERROR HY000: The MariaDB server is running with the --read-only option so it cannot execute this statement +SET GLOBAL read_only=0; +DROP DATABASE test1; +DROP USER user1@localhost; +USE test; +# End of 5.5 tests +# # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY); # # # Test interaction with read_only system variable. -DROP TABLE IF EXISTS t1; CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1), (2); CREATE USER user1; @@ -211,3 +224,4 @@ connection default; DROP USER user1; SET GLOBAL read_only= 0; DROP TABLE t1; +# End of 10.0 tests diff --git a/mysql-test/main/read_only.test b/mysql-test/main/read_only.test index a05f813346e..5314b11154f 100644 --- a/mysql-test/main/read_only.test +++ b/mysql-test/main/read_only.test @@ -283,6 +283,23 @@ flush privileges; drop database mysqltest_db1; set global read_only= @start_read_only; +--echo # +--echo # MDEV-16987 - ALTER DATABASE possible in read-only mode +--echo # +CREATE USER user1@localhost; +GRANT ALTER ON test1.* TO user1@localhost; +CREATE DATABASE test1; +SET GLOBAL read_only=1; +change_user user1; +--error ER_OPTION_PREVENTS_STATEMENT +ALTER DATABASE test1 CHARACTER SET utf8; +change_user root; +SET GLOBAL read_only=0; +DROP DATABASE test1; +DROP USER user1@localhost; +USE test; + +--echo # End of 5.5 tests --echo # --echo # WL#5968 Implement START TRANSACTION READ (WRITE|ONLY); @@ -291,10 +308,6 @@ set global read_only= @start_read_only; --echo # --echo # Test interaction with read_only system variable. ---disable_warnings -DROP TABLE IF EXISTS t1; ---enable_warnings - CREATE TABLE t1(a INT); INSERT INTO t1 VALUES (1), (2); @@ -344,3 +357,5 @@ DROP TABLE t1; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc + +--echo # End of 10.0 tests diff --git a/mysql-test/main/reset_connection.result b/mysql-test/main/reset_connection.result index 925195f704e..54f6ffdbd25 100644 --- a/mysql-test/main/reset_connection.result +++ b/mysql-test/main/reset_connection.result @@ -5,3 +5,23 @@ Com_select 10 SHOW local STATUS LIKE 'com_select'; Variable_name Value Com_select 0 +# Test if charset changes after reset (utf8) +connect utf8_conn,localhost,root,,,,,CHARSET=utf8; +connection utf8_conn; +SELECT IF(@@character_set_client='utf8','OK', 'FAIL') AS RESULT; +RESULT +OK +SELECT IF(@@character_set_client='utf8','OK', 'FAIL') AS RESULT; +RESULT +OK +disconnect utf8_conn; +# Test if charset changes after reset (latin1) +connect latin1_conn,localhost,root,,,,,CHARSET=latin1; +connection latin1_conn; +SELECT IF(@@character_set_client='latin1','OK', 'FAIL') AS RESULT; +RESULT +OK +SELECT IF(@@character_set_client='latin1','OK', 'FAIL') AS RESULT; +RESULT +OK +disconnect latin1_conn; diff --git a/mysql-test/main/reset_connection.test b/mysql-test/main/reset_connection.test index 49f41c32fc3..73c8280703c 100644 --- a/mysql-test/main/reset_connection.test +++ b/mysql-test/main/reset_connection.test @@ -23,3 +23,18 @@ SHOW local STATUS LIKE 'com_select'; SHOW local STATUS LIKE 'com_select'; +--echo # Test if charset changes after reset (utf8) +connect(utf8_conn,localhost,root,,,,,CHARSET=utf8); +connection utf8_conn; +SELECT IF(@@character_set_client='utf8','OK', 'FAIL') AS RESULT; +--reset_connection +SELECT IF(@@character_set_client='utf8','OK', 'FAIL') AS RESULT; +disconnect utf8_conn; + +--echo # Test if charset changes after reset (latin1) +connect(latin1_conn,localhost,root,,,,,CHARSET=latin1); +connection latin1_conn; +SELECT IF(@@character_set_client='latin1','OK', 'FAIL') AS RESULT; +--reset_connection +SELECT IF(@@character_set_client='latin1','OK', 'FAIL') AS RESULT; +disconnect latin1_conn; \ No newline at end of file diff --git a/mysql-test/main/row.result b/mysql-test/main/row.result index 2d4ebc35b84..40d3e2640f0 100644 --- a/mysql-test/main/row.result +++ b/mysql-test/main/row.result @@ -483,7 +483,7 @@ select * from t1,t2 where (a,b) = (c,d); a b c d abc 1 abc 1 select host,user from mysql.user where (host,user) = ('localhost','test'); -host user +Host User drop table t1,t2; # # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings diff --git a/mysql-test/main/select.result b/mysql-test/main/select.result index 9b6a570717b..9029828080a 100644 --- a/mysql-test/main/select.result +++ b/mysql-test/main/select.result @@ -2118,8 +2118,8 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12 SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time Warnings: -Warning 1292 Incorrect datetime value: 'wrong-date-value' -Warning 1292 Incorrect datetime value: 'wrong-date-value' +Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' +Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time DROP TABLE t1,t2; @@ -3453,6 +3453,7 @@ create table t2 (a int, b int, c int, e int, primary key(a,b,c)); insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C; analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK select 'In next EXPLAIN, B.rows must be exactly 10:' Z; Z @@ -3746,12 +3747,14 @@ CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDAT INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a)); INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00"); INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2; ANALYZE TABLE t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 @@ -4111,7 +4114,7 @@ select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' 0 Warnings: -Warning 1292 Incorrect datetime value: '2007/10/2000:00:00 GMT-6' +Warning 1292 Truncated incorrect datetime value: '2007/10/2000:00:00 GMT-6' select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' 1 @@ -4198,7 +4201,7 @@ select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'; str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20' 0 @@ -4212,22 +4215,22 @@ select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '' 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('1','%Y-%m-%d') = '1'; str_to_date('1','%Y-%m-%d') = '1' 0 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' select str_to_date('1','%Y-%m-%d') = '1'; str_to_date('1','%Y-%m-%d') = '1' 0 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' select str_to_date('','%Y-%m-%d') = ''; str_to_date('','%Y-%m-%d') = '' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'; str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' 1 @@ -5282,30 +5285,30 @@ SELECT * FROM t1 HAVING f1 = 'zz'; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'zz' SELECT * FROM t1 HAVING f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM t1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM t1 WHERE f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' DROP TABLE t1; DROP VIEW v1; # diff --git a/mysql-test/main/select_jcl6.result b/mysql-test/main/select_jcl6.result index d78fad15da1..490fa05b039 100644 --- a/mysql-test/main/select_jcl6.result +++ b/mysql-test/main/select_jcl6.result @@ -2129,8 +2129,8 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12 SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time Warnings: -Warning 1292 Incorrect datetime value: 'wrong-date-value' -Warning 1292 Incorrect datetime value: 'wrong-date-value' +Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' +Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time DROP TABLE t1,t2; @@ -3464,6 +3464,7 @@ create table t2 (a int, b int, c int, e int, primary key(a,b,c)); insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C; analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK select 'In next EXPLAIN, B.rows must be exactly 10:' Z; Z @@ -3757,12 +3758,14 @@ CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDAT INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a)); INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00"); INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2; ANALYZE TABLE t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 @@ -4122,7 +4125,7 @@ select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' 0 Warnings: -Warning 1292 Incorrect datetime value: '2007/10/2000:00:00 GMT-6' +Warning 1292 Truncated incorrect datetime value: '2007/10/2000:00:00 GMT-6' select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' 1 @@ -4209,7 +4212,7 @@ select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'; str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20' 0 @@ -4223,22 +4226,22 @@ select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '' 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('1','%Y-%m-%d') = '1'; str_to_date('1','%Y-%m-%d') = '1' 0 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' select str_to_date('1','%Y-%m-%d') = '1'; str_to_date('1','%Y-%m-%d') = '1' 0 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' select str_to_date('','%Y-%m-%d') = ''; str_to_date('','%Y-%m-%d') = '' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'; str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' 1 @@ -5293,30 +5296,30 @@ SELECT * FROM t1 HAVING f1 = 'zz'; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'zz' SELECT * FROM t1 HAVING f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM t1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM t1 WHERE f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' DROP TABLE t1; DROP VIEW v1; # diff --git a/mysql-test/main/select_pkeycache.result b/mysql-test/main/select_pkeycache.result index 9b6a570717b..9029828080a 100644 --- a/mysql-test/main/select_pkeycache.result +++ b/mysql-test/main/select_pkeycache.result @@ -2118,8 +2118,8 @@ INSERT INTO t2 VALUES (1,3,10,'2002-06-01 08:00:00',35),(1,3,1010,'2002-06-01 12 SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= 'wrong-date-value' AND b.sampletime < 'wrong-date-value' AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time Warnings: -Warning 1292 Incorrect datetime value: 'wrong-date-value' -Warning 1292 Incorrect datetime value: 'wrong-date-value' +Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' +Warning 1292 Truncated incorrect datetime value: 'wrong-date-value' SELECT a.gvid, (SUM(CASE b.sampletid WHEN 140 THEN b.samplevalue ELSE 0 END)) as the_success,(SUM(CASE b.sampletid WHEN 141 THEN b.samplevalue ELSE 0 END)) as the_fail,(SUM(CASE b.sampletid WHEN 142 THEN b.samplevalue ELSE 0 END)) as the_size,(SUM(CASE b.sampletid WHEN 143 THEN b.samplevalue ELSE 0 END)) as the_time FROM t1 a, t2 b WHERE a.hmid = b.hmid AND a.volid = b.volid AND b.sampletime >= NULL AND b.sampletime < NULL AND b.sampletid IN (140, 141, 142, 143) GROUP BY a.gvid; gvid the_success the_fail the_size the_time DROP TABLE t1,t2; @@ -3453,6 +3453,7 @@ create table t2 (a int, b int, c int, e int, primary key(a,b,c)); insert into t2 select A.a, B.a, C.a, C.a from t1 A, t1 B, t1 C; analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK select 'In next EXPLAIN, B.rows must be exactly 10:' Z; Z @@ -3746,12 +3747,14 @@ CREATE TABLE t1 (a INT, ts TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDAT INSERT INTO t1 VALUES (30,"2006-01-03 23:00:00"), (31,"2006-01-03 23:00:00"); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK CREATE TABLE t2 (a INT, dt1 DATETIME, dt2 DATETIME, PRIMARY KEY (a)); INSERT INTO t2 VALUES (30, "2006-01-01 00:00:00", "2999-12-31 00:00:00"); INSERT INTO t2 SELECT a+1,dt1,dt2 FROM t2; ANALYZE TABLE t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK EXPLAIN SELECT * FROM t1 LEFT JOIN t2 ON (t1.a=t2.a) WHERE t1.a=30 @@ -4111,7 +4114,7 @@ select str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6'; str_to_date('2007-10-09','%Y-%m-%d') <= '2007/10/2000:00:00 GMT-6' 0 Warnings: -Warning 1292 Incorrect datetime value: '2007/10/2000:00:00 GMT-6' +Warning 1292 Truncated incorrect datetime value: '2007/10/2000:00:00 GMT-6' select str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6'; str_to_date('2007-10-01','%Y-%m-%d') = '2007-10-1 00:00:00 GMT-6' 1 @@ -4198,7 +4201,7 @@ select str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20'; str_to_date('2007-10-00','%Y-%m-%d') between '' and '2007/10/20' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20'; str_to_date('','%Y-%m-%d') between '2007/10/01' and '2007/10/20' 0 @@ -4212,22 +4215,22 @@ select str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = ''; str_to_date('2007-10-00 12:34','%Y-%m-%d %H:%i') = '' 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('1','%Y-%m-%d') = '1'; str_to_date('1','%Y-%m-%d') = '1' 0 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' select str_to_date('1','%Y-%m-%d') = '1'; str_to_date('1','%Y-%m-%d') = '1' 0 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' select str_to_date('','%Y-%m-%d') = ''; str_to_date('','%Y-%m-%d') = '' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01'; str_to_date('2000-01-01','%Y-%m-%d') between '1000-01-01' and '2001-01-01' 1 @@ -5282,30 +5285,30 @@ SELECT * FROM t1 HAVING f1 = 'zz'; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'zz' SELECT * FROM t1 HAVING f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM t1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM t1 WHERE f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' SELECT * FROM v1 HAVING f1 = 'zz' AND f1 <= 'aa' ; f1 0000-00-00 Warnings: -Warning 1292 Incorrect datetime value: 'zz' -Warning 1292 Incorrect datetime value: 'aa' +Warning 1292 Truncated incorrect datetime value: 'zz' +Warning 1292 Truncated incorrect datetime value: 'aa' DROP TABLE t1; DROP VIEW v1; # diff --git a/mysql-test/main/select_safe.result b/mysql-test/main/select_safe.result index 60364b8c4ec..649e2dc484e 100644 --- a/mysql-test/main/select_safe.result +++ b/mysql-test/main/select_safe.result @@ -62,19 +62,20 @@ a b 5 a analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK insert into t1 values (null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"),(null,"a"); insert into t1 values (null,"b"),(null,"b"),(null,"c"),(null,"c"),(null,"d"),(null,"d"),(null,"e"),(null,"e"),(null,"a"),(null,"e"); insert into t1 values (null,"x"),(null,"x"),(null,"y"),(null,"y"),(null,"z"),(null,"z"),(null,"v"),(null,"v"),(null,"a"),(null,"v"); explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL b NULL NULL NULL 41 Using where -1 SIMPLE t2 ref b b 21 test.t1.b 6 +1 SIMPLE t1 ALL b NULL NULL NULL 11 +1 SIMPLE t2 ALL b NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) set MAX_SEEKS_FOR_KEY=1; explain select STRAIGHT_JOIN * from t1,t1 as t2 where t1.b=t2.b; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE t1 ALL b NULL NULL NULL 41 Using where -1 SIMPLE t2 ref b b 21 test.t1.b 6 +1 SIMPLE t1 ALL b NULL NULL NULL 11 +1 SIMPLE t2 ALL b NULL NULL NULL 11 Using where; Using join buffer (flat, BNL join) SET MAX_SEEKS_FOR_KEY=DEFAULT; drop table t1; create table t1 (a int); diff --git a/mysql-test/main/selectivity.result b/mysql-test/main/selectivity.result index aff14b23ccb..00907235ecc 100644 --- a/mysql-test/main/selectivity.result +++ b/mysql-test/main/selectivity.result @@ -782,9 +782,9 @@ set optimizer_use_condition_selectivity=3; explain extended select * from t1 where a < 1 and a > 7; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select 7 AS `a` from `test`.`t1` where 0 +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7 select * from t1 where a < 1 and a > 7; a drop table t1; @@ -1506,9 +1506,9 @@ col1 explain extended select * from t2 where col1 < 'b' and col1 > 'd'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select 'd' AS `col1` from `test`.`t2` where 0 +Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` < 'b' and `test`.`t2`.`col1` > 'd' drop table t1,t2; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; @@ -1595,3 +1595,43 @@ drop table t1,t0; set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; +# +# MDEV-15306: Wrong/Unexpected result with the value +# optimizer_use_condition_selectivity set to 4 +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +CREATE FUNCTION f1() RETURNS INT DETERMINISTIC +BEGIN +SET @cnt := @cnt + 1; +RETURN 1; +END;| +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @save_use_stat_tables= @@use_stat_tables; +set @@use_stat_tables='complementary'; +set @@optimizer_use_condition_selectivity=4; +SET @cnt= 0; +SELECT * FROM t1 WHERE a = f1(); +a +1 +SELECT @cnt; +@cnt +1 +set @@use_stat_tables='preferably'; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SET @cnt := 0; +set @@optimizer_use_condition_selectivity=4; +SELECT * FROM t1 WHERE a = f1(); +a +1 +SELECT @cnt; +@cnt +2 +alter table t1 force; +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t1; +drop function f1; diff --git a/mysql-test/main/selectivity.test b/mysql-test/main/selectivity.test index cf12bdaea21..3df49456332 100644 --- a/mysql-test/main/selectivity.test +++ b/mysql-test/main/selectivity.test @@ -1066,3 +1066,39 @@ drop table t1,t0; set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; + +--echo # +--echo # MDEV-15306: Wrong/Unexpected result with the value +--echo # optimizer_use_condition_selectivity set to 4 +--echo # + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); + +delimiter |; +CREATE FUNCTION f1() RETURNS INT DETERMINISTIC +BEGIN + SET @cnt := @cnt + 1; + RETURN 1; +END;| +delimiter ;| +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @save_use_stat_tables= @@use_stat_tables; +set @@use_stat_tables='complementary'; +set @@optimizer_use_condition_selectivity=4; +SET @cnt= 0; +SELECT * FROM t1 WHERE a = f1(); +SELECT @cnt; + +set @@use_stat_tables='preferably'; +analyze table t1 persistent for all; +SET @cnt := 0; +set @@optimizer_use_condition_selectivity=4; +SELECT * FROM t1 WHERE a = f1(); +SELECT @cnt; +alter table t1 force; +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t1; +drop function f1; + diff --git a/mysql-test/main/selectivity_innodb.result b/mysql-test/main/selectivity_innodb.result index ab698760c55..93917065722 100644 --- a/mysql-test/main/selectivity_innodb.result +++ b/mysql-test/main/selectivity_innodb.result @@ -789,9 +789,9 @@ set optimizer_use_condition_selectivity=3; explain extended select * from t1 where a < 1 and a > 7; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +1 SIMPLE t1 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select 7 AS `a` from `test`.`t1` where 0 +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` < 1 and `test`.`t1`.`a` > 7 select * from t1 where a < 1 and a > 7; a drop table t1; @@ -1150,7 +1150,6 @@ alter table t1 change column a a int; analyze table t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected -test.t1 analyze Note Data truncated for column 'avg_frequency' at row 1 test.t1 analyze status OK flush table t1; explain extended select * from t1 where a between 5 and 7; @@ -1517,9 +1516,9 @@ col1 explain extended select * from t2 where col1 < 'b' and col1 > 'd'; id select_type table type possible_keys key key_len ref rows filtered Extra -1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +1 SIMPLE t2 ALL NULL NULL NULL NULL 8 100.00 Using where Warnings: -Note 1003 select 'd' AS `col1` from `test`.`t2` where 0 +Note 1003 select `test`.`t2`.`col1` AS `col1` from `test`.`t2` where `test`.`t2`.`col1` < 'b' and `test`.`t2`.`col1` > 'd' drop table t1,t2; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; @@ -1606,6 +1605,46 @@ drop table t1,t0; set histogram_size=@save_histogram_size; set optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; +# +# MDEV-15306: Wrong/Unexpected result with the value +# optimizer_use_condition_selectivity set to 4 +# +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); +CREATE FUNCTION f1() RETURNS INT DETERMINISTIC +BEGIN +SET @cnt := @cnt + 1; +RETURN 1; +END;| +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @save_use_stat_tables= @@use_stat_tables; +set @@use_stat_tables='complementary'; +set @@optimizer_use_condition_selectivity=4; +SET @cnt= 0; +SELECT * FROM t1 WHERE a = f1(); +a +1 +SELECT @cnt; +@cnt +1 +set @@use_stat_tables='preferably'; +analyze table t1 persistent for all; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +SET @cnt := 0; +set @@optimizer_use_condition_selectivity=4; +SELECT * FROM t1 WHERE a = f1(); +a +1 +SELECT @cnt; +@cnt +2 +alter table t1 force; +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t1; +drop function f1; set optimizer_switch=@save_optimizer_switch_for_selectivity_test; set @tmp_ust= @@use_stat_tables; set @tmp_oucs= @@optimizer_use_condition_selectivity; diff --git a/mysql-test/main/session_tracker_last_gtid.result b/mysql-test/main/session_tracker_last_gtid.result index deffeca1333..795d0aaa2a2 100644 --- a/mysql-test/main/session_tracker_last_gtid.result +++ b/mysql-test/main/session_tracker_last_gtid.result @@ -2,13 +2,7 @@ # MDEV-15477: SESSION_SYSVARS_TRACKER does not track last_gtid # SET gtid_seq_no=1000; --- Tracker : SESSION_TRACK_SCHEMA --- test - SET @@session.session_track_system_variables='last_gtid'; --- Tracker : SESSION_TRACK_SCHEMA --- test - create table t1 (a int) engine=innodb; -- Tracker : SESSION_TRACK_SYSTEM_VARIABLES -- last_gtid diff --git a/mysql-test/main/set_password.result b/mysql-test/main/set_password.result index 315d0bef9fb..bb1124e09d4 100644 --- a/mysql-test/main/set_password.result +++ b/mysql-test/main/set_password.result @@ -8,13 +8,13 @@ create user oldpass@localhost identified by password '378b243e220ca493'; create user oldpassold@localhost identified with 'mysql_old_password'; set password for oldpassold@localhost = '378b243e220ca493'; select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; -user host password plugin authentication_string -natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 -newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 -newpassnat localhost mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 -oldauth localhost 378b243e220ca493 -oldpass localhost 378b243e220ca493 -oldpassold localhost mysql_old_password 378b243e220ca493 +User Host Password plugin authentication_string +natauth localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +newpass localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +newpassnat localhost *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 mysql_native_password *94BDCEBE19083CE2A1F959FD02F964C7AF4CFC29 +oldauth localhost 378b243e220ca493 mysql_old_password 378b243e220ca493 +oldpass localhost 378b243e220ca493 mysql_old_password 378b243e220ca493 +oldpassold localhost 378b243e220ca493 mysql_old_password 378b243e220ca493 connect con,localhost,natauth,test,; select current_user(); current_user() @@ -85,13 +85,13 @@ set password for oldauth@localhost = PASSWORD('test2'); set password for oldpass@localhost = PASSWORD('test2'); set password for oldpassold@localhost = PASSWORD('test2'); select user, host, password, plugin, authentication_string from mysql.user where user != 'root'; -user host password plugin authentication_string -natauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -newpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -newpassnat localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -oldauth localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -oldpass localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E -oldpassold localhost mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +User Host Password plugin authentication_string +natauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +newpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +newpassnat localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldauth localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldpass localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E +oldpassold localhost *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E mysql_native_password *7CEB3FDE5F7A9C4CE5FBE610D7D8EDA62EBE5F4E connect con,localhost,natauth,test2,; select current_user(); current_user() diff --git a/mysql-test/main/set_password.test b/mysql-test/main/set_password.test index fc1ecb5ef5c..c67dc22dc81 100644 --- a/mysql-test/main/set_password.test +++ b/mysql-test/main/set_password.test @@ -132,6 +132,7 @@ set global secure_auth=default; # # MDEV-16238 root/localhost authn prioritizes authentication_string over Password # +--source include/switch_to_mysql_user.inc create user foo@localhost identified with mysql_native_password; update mysql.user set authentication_string=password('foo'), plugin='mysql_native_password' where user='foo' and host='localhost'; set password for 'foo'@'localhost' = password('bar'); @@ -145,3 +146,4 @@ select user,host,password,plugin,authentication_string from mysql.user where use set password for 'foo'@'localhost' = ''; select user,host,password,plugin,authentication_string from mysql.user where user='foo'; drop user foo@localhost; +--source include/switch_to_mysql_global_priv.inc diff --git a/mysql-test/main/show_check.result b/mysql-test/main/show_check.result index f4e2047414c..741514b99b1 100644 --- a/mysql-test/main/show_check.result +++ b/mysql-test/main/show_check.result @@ -162,8 +162,9 @@ Catalog Database Table Table_alias Column Column_alias Type Length Max length Is def Table 253 128 7 Y 0 39 8 def Op 253 10 7 Y 0 39 8 def Msg_type 253 10 6 Y 0 39 8 -def Msg_text 250 393216 2 Y 0 39 8 +def Msg_text 250 393216 39 Y 0 39 8 Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK show index from t1; Table Non_unique Key_name Seq_in_index Column_name Collation Cardinality Sub_part Packed Null Index_type Comment Index_comment @@ -261,7 +262,10 @@ create table t1(n int); insert into t1 values (1); show open tables; Database Table In_use Name_locked +mysql column_stats 0 0 mysql general_log 0 0 +mysql index_stats 0 0 +mysql table_stats 0 0 test t1 0 0 drop table t1; create table t1 (a int not null, b VARCHAR(10), INDEX (b) ) AVG_ROW_LENGTH=10 CHECKSUM=1 COMMENT="test" ENGINE=MYISAM MIN_ROWS=10 MAX_ROWS=100 PACK_KEYS=1 DELAY_KEY_WRITE=1 ROW_FORMAT=fixed; diff --git a/mysql-test/main/show_create_user.result b/mysql-test/main/show_create_user.result index 63013eca074..1205b658b6e 100644 --- a/mysql-test/main/show_create_user.result +++ b/mysql-test/main/show_create_user.result @@ -10,10 +10,10 @@ create user foo2@test identified by 'password'; show create user foo2@test; CREATE USER for foo2@test CREATE USER 'foo2'@'test' IDENTIFIED BY PASSWORD '*2470C0C06DEE42FD1618BB99005ADCA2EC9D1E19' -alter user foo2@test identified with 'someplugin' as 'somepassword'; +alter user foo2@test identified with 'mysql_old_password' as '0123456789ABCDEF'; show create user foo2@test; CREATE USER for foo2@test -CREATE USER 'foo2'@'test' IDENTIFIED VIA someplugin USING 'somepassword' +CREATE USER 'foo2'@'test' IDENTIFIED BY PASSWORD '0123456789ABCDEF' create user foo3@test require SSL; show create user foo3@test; CREATE USER for foo3@test diff --git a/mysql-test/main/show_create_user.test b/mysql-test/main/show_create_user.test index a10c8aeeda6..03852b5abbc 100644 --- a/mysql-test/main/show_create_user.test +++ b/mysql-test/main/show_create_user.test @@ -9,7 +9,7 @@ show create user foo@test; create user foo2@test identified by 'password'; show create user foo2@test; -alter user foo2@test identified with 'someplugin' as 'somepassword'; +alter user foo2@test identified with 'mysql_old_password' as '0123456789ABCDEF'; show create user foo2@test; create user foo3@test require SSL; diff --git a/mysql-test/main/show_grants_with_plugin-7985.result b/mysql-test/main/show_grants_with_plugin-7985.result deleted file mode 100644 index 0f8e1e39969..00000000000 --- a/mysql-test/main/show_grants_with_plugin-7985.result +++ /dev/null @@ -1,197 +0,0 @@ -call mtr.add_suppression("password and an authentication plugin"); -# -# Create a user with mysql_native_password plugin. -# The user has no password or auth_string set. -# -create user u1; -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % -# -# The user's grants should show no password at all. -# -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Test to see if connecting with no password is succesful. -# -connect con1, localhost, u1,,; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Test after flushing privileges. -# -flush privileges; -connect con1, localhost, u1,,; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Now add a mysql_native password string in authentication_string. -# -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password -USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % *7AFEFD08B6B720E781FB000CAA418F54FA662626 -# -# Test to see if connecting with password is succesful. -# -connect con1, localhost, u1,'SOMETHING',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Test after flushing privileges. -# -flush privileges; -connect con1, localhost, u1,'SOMETHING',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Now we also set a password for the user. -# -set password for u1 = PASSWORD('SOMETHINGELSE'); -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % mysql_native_password *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 -# -# Here we should use the password field, as that primes over -# the authentication_string field. -# -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Logging in with the user's password should work. -# -connect con1, localhost, u1,'SOMETHINGELSE',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Reload privileges and test logging in again. -# -flush privileges; -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Here we connect via the user's password again. -# -connect con1, localhost, u1,'SOMETHINGELSE',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Now we remove the authentication plugin password, flush privileges and -# try again. -# -update mysql.user set password=authentication_string, plugin='', authentication_string='' where user='u1'; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 -flush privileges; -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Here we connect via the user's password. -# -connect con1, localhost, u1,'SOMETHINGELSE',; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % *054B7BBD2B9A553DA560520DCD3F76DA2D81B7C6 -disconnect con1; -connection default; -# -# Try and set a wrong auth_string password, with mysql_native_password. -# Make sure it fails. -# -GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd'; -ERROR HY000: Password hash should be a 41-digit hexadecimal number -# -# Now set a correct password. -# -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password -USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; -show grants for u1; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -# -# Test if the user can now use that password instead. -# -connect con1, localhost, u1,'SOMETHING',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -# -# Test if the user can now use that password instead, after flushing privileges; -# -connection default; -flush privileges; -connect con1, localhost, u1,'SOMETHING',; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' IDENTIFIED BY PASSWORD '*7AFEFD08B6B720E781FB000CAA418F54FA662626' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Clear all passwords from the user. -# -set password for u1 = ''; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -user host password plugin authentication_string -u1 % mysql_native_password -# -# Test no password connect. -# -connect con1, localhost, u1,,; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -# -# Test no password connect, after flushing privileges. -# -flush privileges; -connect con1, localhost, u1,,; -show grants; -Grants for u1@% -GRANT USAGE ON *.* TO 'u1'@'%' -GRANT SELECT ON `mysql`.* TO 'u1'@'%' -disconnect con1; -connection default; -drop user u1; diff --git a/mysql-test/main/show_grants_with_plugin-7985.test b/mysql-test/main/show_grants_with_plugin-7985.test deleted file mode 100644 index 85952870254..00000000000 --- a/mysql-test/main/show_grants_with_plugin-7985.test +++ /dev/null @@ -1,160 +0,0 @@ ---source include/not_embedded.inc -call mtr.add_suppression("password and an authentication plugin"); - ---echo # ---echo # Create a user with mysql_native_password plugin. ---echo # The user has no password or auth_string set. ---echo # - -create user u1; -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; - ---echo # ---echo # The user's grants should show no password at all. ---echo # -show grants for u1; ---echo # ---echo # Test to see if connecting with no password is succesful. ---echo # ---connect (con1, localhost, u1,,) -show grants; ---disconnect con1 - ---connection default ---echo # ---echo # Test after flushing privileges. ---echo # -flush privileges; ---connect (con1, localhost, u1,,) -show grants; ---disconnect con1 - ---connection default ---echo # ---echo # Now add a mysql_native password string in authentication_string. ---echo # -# Password string is SOMETHING -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password -USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; ---echo # ---echo # Test to see if connecting with password is succesful. ---echo # ---connect (con1, localhost, u1,'SOMETHING',) -show grants; ---disconnect con1 - ---connection default ---echo # ---echo # Test after flushing privileges. ---echo # -flush privileges; ---connect (con1, localhost, u1,'SOMETHING',) -show grants; ---disconnect con1 ---connection default - ---echo # ---echo # Now we also set a password for the user. ---echo # -set password for u1 = PASSWORD('SOMETHINGELSE'); -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; - ---echo # ---echo # Here we should use the password field, as that primes over ---echo # the authentication_string field. ---echo # -show grants for u1; - ---echo # ---echo # Logging in with the user's password should work. ---echo # ---connect (con1, localhost, u1,'SOMETHINGELSE',) -show grants; ---disconnect con1 ---connection default ---echo # ---echo # Reload privileges and test logging in again. ---echo # -flush privileges; -show grants for u1; ---echo # ---echo # Here we connect via the user's password again. ---echo # ---connect (con1, localhost, u1,'SOMETHINGELSE',) -show grants; ---disconnect con1 ---connection default - ---echo # ---echo # Now we remove the authentication plugin password, flush privileges and ---echo # try again. ---echo # -update mysql.user set password=authentication_string, plugin='', authentication_string='' where user='u1'; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; -flush privileges; -show grants for u1; ---echo # ---echo # Here we connect via the user's password. ---echo # ---connect (con1, localhost, u1,'SOMETHINGELSE',) -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; ---disconnect con1 ---connection default - ---echo # ---echo # Try and set a wrong auth_string password, with mysql_native_password. ---echo # Make sure it fails. ---echo # ---error ER_PASSWD_LENGTH -GRANT USAGE ON *.* TO u1 IDENTIFIED VIA mysql_native_password USING 'asd'; ---echo # ---echo # Now set a correct password. ---echo # -GRANT SELECT ON mysql.* to u1 IDENTIFIED VIA mysql_native_password -USING '*7AFEFD08B6B720E781FB000CAA418F54FA662626'; -show grants for u1; - ---echo # ---echo # Test if the user can now use that password instead. ---echo # ---connect (con1, localhost, u1,'SOMETHING',) -show grants; ---disconnect con1 - ---echo # ---echo # Test if the user can now use that password instead, after flushing privileges; ---echo # ---connection default -flush privileges; - ---connect (con1, localhost, u1,'SOMETHING',) -show grants; ---disconnect con1 ---connection default - ---echo # ---echo # Clear all passwords from the user. ---echo # -set password for u1 = ''; -select user, host, password, plugin, authentication_string from mysql.user where user = 'u1'; - ---echo # ---echo # Test no password connect. ---echo # ---connect (con1, localhost, u1,,) -show grants; ---disconnect con1 ---connection default - ---echo # ---echo # Test no password connect, after flushing privileges. ---echo # -flush privileges; ---connect (con1, localhost, u1,,) -show grants; ---disconnect con1 ---connection default - -drop user u1; diff --git a/mysql-test/main/sp-code.result b/mysql-test/main/sp-code.result index c3af01d19e8..0ff30ba7764 100644 --- a/mysql-test/main/sp-code.result +++ b/mysql-test/main/sp-code.result @@ -1020,8 +1020,8 @@ i SHOW PROCEDURE CODE p1; Pos Instruction 0 set i@0 1 -1 set [upper_bound]@1 3 -2 jump_if_not 6(6) i@0 <= [upper_bound]@1 +1 set [target_bound]@1 3 +2 jump_if_not 6(6) i@0 <= [target_bound]@1 3 stmt 0 "SELECT i" 4 set i@0 i@0 + 1 5 jump 2 @@ -1058,11 +1058,11 @@ i j SHOW PROCEDURE CODE p1; Pos Instruction 0 set i@0 1 -1 set [upper_bound]@1 3 -2 jump_if_not 17(17) i@0 <= [upper_bound]@1 +1 set [target_bound]@1 3 +2 jump_if_not 17(17) i@0 <= [target_bound]@1 3 set j@2 1 -4 set [upper_bound]@3 3 -5 jump_if_not 13(13) j@2 <= [upper_bound]@3 +4 set [target_bound]@3 3 +5 jump_if_not 13(13) j@2 <= [target_bound]@3 6 jump_if_not 8(8) i@0 = 3 7 jump 17 8 jump_if_not 10(10) j@2 = 3 diff --git a/mysql-test/main/sp-cursor.result b/mysql-test/main/sp-cursor.result index f1dd8ed5eaa..2656ef8821d 100644 --- a/mysql-test/main/sp-cursor.result +++ b/mysql-test/main/sp-cursor.result @@ -172,7 +172,7 @@ CALL p1('b1'); v_a 0 Warnings: -Warning 1366 Incorrect integer value: 'b1' for column 'p_a' at row 1 +Warning 1366 Incorrect integer value: 'b1' for column ``.``.`p_a` at row 1 DROP PROCEDURE p1; SET sql_mode=DEFAULT; # @@ -713,3 +713,27 @@ END; $$ CALL p1; DROP PROCEDURE p1; +# +# MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH) +# +CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c')); +INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c'); +CREATE PROCEDURE p1() +BEGIN +FOR rec IN (SELECT en1 FROM t1) +DO +SELECT rec.en1; +END FOR; +END; +$$ +CALL p1(); +rec.en1 +aaa +rec.en1 +a +rec.en1 +b +rec.en1 +c +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/main/sp-cursor.test b/mysql-test/main/sp-cursor.test index 735514ff376..97483ef9caf 100644 --- a/mysql-test/main/sp-cursor.test +++ b/mysql-test/main/sp-cursor.test @@ -723,3 +723,24 @@ $$ DELIMITER ;$$ CALL p1; DROP PROCEDURE p1; + + +--echo # +--echo # MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH) +--echo # + +CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c')); +INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c'); +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + FOR rec IN (SELECT en1 FROM t1) + DO + SELECT rec.en1; + END FOR; +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/main/sp-error.result b/mysql-test/main/sp-error.result index 74723f832a7..3d4e7895fa4 100644 --- a/mysql-test/main/sp-error.result +++ b/mysql-test/main/sp-error.result @@ -2784,7 +2784,7 @@ END| CALL p1()| Warnings: -Warning 1366 Incorrect integer value: 'string' for column 'var1' at row 1 +Warning 1366 Incorrect integer value: 'string' for column ``.``.`var1` at row 1 SET sql_mode = DEFAULT; CREATE PROCEDURE p2() diff --git a/mysql-test/main/sp-for-loop.result b/mysql-test/main/sp-for-loop.result index 0da09586df5..d62d6ae3612 100644 --- a/mysql-test/main/sp-for-loop.result +++ b/mysql-test/main/sp-for-loop.result @@ -80,7 +80,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURNS INT BEGIN DECLARE total INT DEFAULT 0; fori: -FOR i IN REVERSE a..1 +FOR i IN REVERSE 1..a DO SET total= total + i; IF i = b THEN diff --git a/mysql-test/main/sp-for-loop.test b/mysql-test/main/sp-for-loop.test index 6350e9fb9d3..420ab58aaa7 100644 --- a/mysql-test/main/sp-for-loop.test +++ b/mysql-test/main/sp-for-loop.test @@ -86,7 +86,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURNS INT BEGIN DECLARE total INT DEFAULT 0; fori: - FOR i IN REVERSE a..1 + FOR i IN REVERSE 1..a DO SET total= total + i; IF i = b THEN diff --git a/mysql-test/main/sp-security.result b/mysql-test/main/sp-security.result index 7813ab6a192..662d52902d0 100644 --- a/mysql-test/main/sp-security.result +++ b/mysql-test/main/sp-security.result @@ -506,9 +506,9 @@ DROP DATABASE mysqltest; GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow'; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO user19857@localhost; -SELECT Host,User,Password FROM mysql.user WHERE User='user19857'; -Host User Password -localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C +SELECT Host,User,Plugin,Authentication_string FROM mysql.user WHERE User='user19857'; +Host User plugin authentication_string +localhost user19857 mysql_native_password *82DC221D557298F6CE9961037DB1C90604792F5C connect mysqltest_2_con,localhost,user19857,meow,test; connection mysqltest_2_con; USE test; @@ -533,9 +533,9 @@ connection mysqltest_2_con; DROP PROCEDURE IF EXISTS test.sp19857; connection con1root; disconnect mysqltest_2_con; -SELECT Host,User,Password FROM mysql.user WHERE User='user19857'; -Host User Password -localhost user19857 *82DC221D557298F6CE9961037DB1C90604792F5C +SELECT Host,User,Plugin,Authentication_string FROM mysql.user WHERE User='user19857'; +Host User plugin authentication_string +localhost user19857 mysql_native_password *82DC221D557298F6CE9961037DB1C90604792F5C DROP USER user19857@localhost; disconnect con1root; connection default; @@ -710,6 +710,30 @@ connection default; disconnect con2; DROP USER user2@localhost; DROP DATABASE db1; +create user foo@local_ost; +create user foo@`local\_ost` identified via mysql_old_password using '0123456789ABCDEF'; +create database foodb; +grant create routine on foodb.* to foo@local_ost; +connect con1,localhost,foo; +select user(), current_user(); +user() current_user() +foo@localhost foo@local_ost +show grants; +Grants for foo@local_ost +GRANT USAGE ON *.* TO 'foo'@'local_ost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'local_ost' +create procedure fooproc() select 'i am fooproc'; +show grants; +Grants for foo@local_ost +GRANT USAGE ON *.* TO 'foo'@'local_ost' +GRANT CREATE ROUTINE ON `foodb`.* TO 'foo'@'local_ost' +GRANT EXECUTE, ALTER ROUTINE ON PROCEDURE `test`.`fooproc` TO 'foo'@'local_ost' +disconnect con1; +connection default; +drop user foo@local_ost; +drop user foo@`local\_ost`; +drop procedure fooproc; +drop database foodb; # # Test for bug#12602983 - User without privilege on routine can discover # its existence by executing "select non_existing_func();" or by @@ -741,21 +765,23 @@ connection default; disconnect conn1; drop user bug12602983_user@localhost; drop database mysqltest_db; +create user u1@localhost; +grant all privileges on *.* to u1@localhost with grant option; +connect u1, localhost, u1; set password=password('foobar'); create procedure sp1() select 1; show grants; -Grants for root@localhost -GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION -GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +Grants for u1@localhost +GRANT ALL PRIVILEGES ON *.* TO 'u1'@'localhost' IDENTIFIED BY PASSWORD '*9B500343BC52E2911172EB52AE5CF4847604C6E5' WITH GRANT OPTION grant execute on procedure sp1 to current_user() identified by 'barfoo'; show grants; -Grants for root@localhost -GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION -GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'root'@'localhost' -GRANT PROXY ON ''@'%' TO 'root'@'localhost' WITH GRANT OPTION +Grants for u1@localhost +GRANT ALL PRIVILEGES ON *.* TO 'u1'@'localhost' IDENTIFIED BY PASSWORD '*343915A8181B5728EADBDC73E1F7E6B0C3998483' WITH GRANT OPTION +GRANT EXECUTE ON PROCEDURE `test`.`sp1` TO 'u1'@'localhost' drop procedure sp1; -set password=''; -update mysql.user set plugin=''; +disconnect u1; +connection default; +drop user u1@localhost; # # MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE # diff --git a/mysql-test/main/sp-security.test b/mysql-test/main/sp-security.test index 73d0263dd69..7a87fae4097 100644 --- a/mysql-test/main/sp-security.test +++ b/mysql-test/main/sp-security.test @@ -742,7 +742,7 @@ DROP DATABASE mysqltest; GRANT USAGE ON *.* TO user19857@localhost IDENTIFIED BY 'meow'; GRANT SELECT, INSERT, UPDATE, DELETE, CREATE ROUTINE, ALTER ROUTINE ON test.* TO user19857@localhost; -SELECT Host,User,Password FROM mysql.user WHERE User='user19857'; +SELECT Host,User,Plugin,Authentication_string FROM mysql.user WHERE User='user19857'; --connect (mysqltest_2_con,localhost,user19857,meow,test) --connection mysqltest_2_con @@ -770,7 +770,7 @@ DROP PROCEDURE IF EXISTS test.sp19857; --disconnect mysqltest_2_con -SELECT Host,User,Password FROM mysql.user WHERE User='user19857'; +SELECT Host,User,Plugin,Authentication_string FROM mysql.user WHERE User='user19857'; DROP USER user19857@localhost; @@ -973,6 +973,25 @@ disconnect con2; DROP USER user2@localhost; DROP DATABASE db1; +# +# Bug#27407480: AUTOMATIC_SP_PRIVILEGES REQUIRES NEED THE INSERT PRIVILEGES FOR MYSQL.USER TABLE +# +create user foo@local_ost; +create user foo@`local\_ost` identified via mysql_old_password using '0123456789ABCDEF'; +create database foodb; +grant create routine on foodb.* to foo@local_ost; +connect con1,localhost,foo; +select user(), current_user(); +show grants; +create procedure fooproc() select 'i am fooproc'; +show grants; +disconnect con1; +connection default; +drop user foo@local_ost; +drop user foo@`local\_ost`; +drop procedure fooproc; +drop database foodb; + --echo # --echo # Test for bug#12602983 - User without privilege on routine can discover --echo # its existence by executing "select non_existing_func();" or by @@ -1016,15 +1035,18 @@ drop database mysqltest_db; # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc +create user u1@localhost; +grant all privileges on *.* to u1@localhost with grant option; +connect u1, localhost, u1; set password=password('foobar'); create procedure sp1() select 1; show grants; grant execute on procedure sp1 to current_user() identified by 'barfoo'; show grants; drop procedure sp1; -set password=''; -#cleanup after MDEV-16238 -update mysql.user set plugin=''; +disconnect u1; +connection default; +drop user u1@localhost; --echo # --echo # MDEV-13396 Unexpected "alter routine comand defined" during CREATE OR REPLACE PROCEDURE diff --git a/mysql-test/main/sp-vars.result b/mysql-test/main/sp-vars.result index 0d4d18c577d..236695a6c0f 100644 --- a/mysql-test/main/sp-vars.result +++ b/mysql-test/main/sp-vars.result @@ -140,7 +140,7 @@ SELECT sp_vars_check_ret3(); sp_vars_check_ret3() 0 Warnings: -Warning 1366 Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1 +Warning 1366 Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1 SELECT sp_vars_check_ret4(); sp_vars_check_ret4() 154.12 @@ -195,7 +195,7 @@ SELECT sp_vars_check_ret3(); sp_vars_check_ret3() 0 Warnings: -Warning 1366 Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1 +Warning 1366 Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1 SELECT sp_vars_check_ret4(); sp_vars_check_ret4() 154.12 @@ -314,7 +314,7 @@ ERROR 22003: Out of range value for column 'sp_vars_check_ret1()' at row 1 SELECT sp_vars_check_ret2(); ERROR 22003: Out of range value for column 'sp_vars_check_ret2()' at row 1 SELECT sp_vars_check_ret3(); -ERROR 22007: Incorrect integer value: 'Hello, world' for column 'sp_vars_check_ret3()' at row 1 +ERROR 22007: Incorrect integer value: 'Hello, world' for column ``.``.`sp_vars_check_ret3()` at row 1 SELECT sp_vars_check_ret4(); sp_vars_check_ret4() 154.12 @@ -896,7 +896,7 @@ sp_var @user_var 0 Warnings: -Warning 1366 Incorrect integer value: 'Hello, world!' for column 'sp_var' at row 1 +Warning 1366 Incorrect integer value: 'Hello, world!' for column ``.``.`sp_var` at row 1 DROP PROCEDURE p1; DROP TABLE t1; diff --git a/mysql-test/main/sp.result b/mysql-test/main/sp.result index ac4840cb37b..39bc09e21d6 100644 --- a/mysql-test/main/sp.result +++ b/mysql-test/main/sp.result @@ -2293,9 +2293,11 @@ create procedure bug3843() analyze table t1| call bug3843()| Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK call bug3843()| Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date select 1+2| 1+2 @@ -2442,7 +2444,7 @@ drop procedure if exists bug4904| create procedure bug4904() begin declare continue handler for sqlstate 'HY000' begin end; -create table t2 as select * from t3; +create table not_existing_table as select * from t3; end| call bug4904()| ERROR 42S02: Table 'test.t3' doesn't exist @@ -4331,8 +4333,11 @@ test.t3 optimize status OK test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE' test.v1 optimize status Operation failed Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE' test.v1 analyze status Operation failed @@ -4350,8 +4355,11 @@ test.t3 optimize status OK test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE' test.v1 optimize status Operation failed Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE' test.v1 analyze status Operation failed @@ -4369,8 +4377,11 @@ test.t3 optimize status OK test.v1 optimize Error 'test.v1' is not of type 'BASE TABLE' test.v1 optimize status Operation failed Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date test.v1 analyze Error 'test.v1' is not of type 'BASE TABLE' test.v1 analyze status Operation failed @@ -4579,7 +4590,7 @@ call bug15231_3()| Result Missed it (correct) Level Code Message -Warning 1366 Incorrect decimal value: 'zap' for column 'x' at row 1 +Warning 1366 Incorrect decimal value: 'zap' for column ``.``.`x` at row 1 Result Caught it (correct) call bug15231_5()| @@ -6444,7 +6455,7 @@ DROP TABLE t1; CALL p2('text'); Warnings: -Warning 1366 Incorrect integer value: 'text' for column 'v' at row 1 +Warning 1366 Incorrect integer value: 'text' for column ``.``.`v` at row 1 SHOW CREATE TABLE t1; Table Create Table t1 CREATE TABLE `t1` ( @@ -7878,6 +7889,23 @@ SET S.CLOSE_YN = '' where 1=1; drop function if exists f1; drop table t1,t2; +# +# MDEV-16957: Server crashes in Field_iterator_natural_join::next +# upon 2nd execution of SP +# +CREATE TABLE t1 (a INT, b VARCHAR(32)); +CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c); +CALL sp; +ERROR 42S22: Unknown column 'c' in 'from clause' +CALL sp; +ERROR 42S22: Unknown column 'c' in 'from clause' +CALL sp; +ERROR 42S22: Unknown column 'c' in 'from clause' +alter table t1 add column c int; +CALL sp; +c a b a b +DROP PROCEDURE sp; +DROP TABLE t1; # End of 5.5 test # # MDEV-7040: Crash in field_conv, memcpy_field_possible, part#2 @@ -8346,7 +8374,7 @@ FETCH c INTO a; CLOSE c; END; $$ -ERROR 22007: Incorrect integer value: 'y' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: 'y' for column ``.``.`a` at row 1 DROP TABLE t1; SET sql_mode=DEFAULT; # @@ -8542,11 +8570,11 @@ RETURN a = timestamp'2038-01-19 03:14:07.999999' END $$ SELECT f1(e) FROM t1; -ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30' +ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30.000000' SELECT f2(e) FROM t1; -ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30' +ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30.000000' SELECT f3(e) FROM t1; -ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30' +ERROR 22007: Truncated incorrect DOUBLE value: '2001-01-01 10:20:30.000000' DROP FUNCTION f1; DROP FUNCTION f2; DROP FUNCTION f3; @@ -8680,3 +8708,38 @@ t1 CREATE TABLE `t1` ( ) ENGINE=MyISAM DEFAULT CHARSET=latin1 DROP TABLE t1; DROP FUNCTION f1; +# +# MDEV-16036: Debug assertion failed in resignal on create +# temporary table +# +set @save_sql_mode= @@sql_mode; +set sql_mode='ORACLE'; +CREATE or replace procedure p4() +AS +CONTINUE HANDLER FOR SQLWARNING +BEGIN +NULL; +END; +EXIT HANDLER FOR OTHERS -- SQLEXCEPTION +BEGIN +GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; +SELECT @sqlstate, @errno, @text; +SHOW WARNINGS; +RESIGNAL; -- cause DBG_ASSERT failed +END; +BEGIN +CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL); +END +/ +call p4(); +call p4(); +@sqlstate @errno @text +42S01 1050 Table 't1' already exists +Level Code Message +Note 1050 Table 't1' already exists +Warnings: +Note 1050 Table 't1' already exists +drop procedure p4; +drop table t1; +set @@sql_mode=@save_sql_mode; +# End of 10.3 tests diff --git a/mysql-test/main/sp.test b/mysql-test/main/sp.test index 5f18f6585a7..230e9c8bb18 100644 --- a/mysql-test/main/sp.test +++ b/mysql-test/main/sp.test @@ -2918,7 +2918,7 @@ create procedure bug4904() begin declare continue handler for sqlstate 'HY000' begin end; - create table t2 as select * from t3; + create table not_existing_table as select * from t3; end| -- error 1146 @@ -9332,6 +9332,27 @@ where 1=1; drop function if exists f1; drop table t1,t2; +--echo # +--echo # MDEV-16957: Server crashes in Field_iterator_natural_join::next +--echo # upon 2nd execution of SP +--echo # + +CREATE TABLE t1 (a INT, b VARCHAR(32)); +CREATE PROCEDURE sp() SELECT * FROM t1 AS t1x JOIN t1 AS t1y USING (c); +--error ER_BAD_FIELD_ERROR +CALL sp; +--error ER_BAD_FIELD_ERROR +CALL sp; +--error ER_BAD_FIELD_ERROR +CALL sp; +alter table t1 add column c int; +CALL sp; + +# Cleanup +DROP PROCEDURE sp; +DROP TABLE t1; + + --echo # End of 5.5 test --echo # @@ -10218,3 +10239,37 @@ CREATE TABLE t1 AS SELECT f1() AS c1, COALESCE(f1()) AS c2, CONCAT(f1()) AS c3; SHOW CREATE TABLE t1; DROP TABLE t1; DROP FUNCTION f1; + +--echo # +--echo # MDEV-16036: Debug assertion failed in resignal on create +--echo # temporary table +--echo # + +set @save_sql_mode= @@sql_mode; +set sql_mode='ORACLE'; +delimiter /; +CREATE or replace procedure p4() +AS + CONTINUE HANDLER FOR SQLWARNING + BEGIN + NULL; + END; + EXIT HANDLER FOR OTHERS -- SQLEXCEPTION + BEGIN + GET DIAGNOSTICS CONDITION 1 @sqlstate = RETURNED_SQLSTATE, @errno = MYSQL_ERRNO, @text = MESSAGE_TEXT; + SELECT @sqlstate, @errno, @text; + SHOW WARNINGS; + RESIGNAL; -- cause DBG_ASSERT failed + END; +BEGIN + CREATE TEMPORARY TABLE IF NOT EXISTS t1(origine VARCHAR2(10) NOT NULL); +END +/ +delimiter ;/ +call p4(); +call p4(); +drop procedure p4; +drop table t1; +set @@sql_mode=@save_sql_mode; + +--echo # End of 10.3 tests diff --git a/mysql-test/main/sp_notembedded.result b/mysql-test/main/sp_notembedded.result index 8edb9e79b70..3883225e9bc 100644 --- a/mysql-test/main/sp_notembedded.result +++ b/mysql-test/main/sp_notembedded.result @@ -231,8 +231,6 @@ CREATE PROCEDURE p1(i INT) BEGIN END; disconnect con1; connection default; DROP PROCEDURE p1; -DELETE FROM mysql.user WHERE User='mysqltest_1'; -FLUSH PRIVILEGES; # # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. # @@ -324,7 +322,7 @@ DROP EVENT teste_bug11763507; # -- End of 5.1 tests # ------------------------------------------------------------------ grant create routine on test.* to foo1@localhost identified by 'foo'; -update mysql.user set password = replace(password, '*', '-') where user='foo1'; +update mysql.user set authentication_string = replace(authentication_string, '*', '-') where user='foo1'; connect foo,localhost,foo1,foo; show grants; Grants for foo1@localhost diff --git a/mysql-test/main/sp_notembedded.test b/mysql-test/main/sp_notembedded.test index 41bfd871c39..2f1c4cd92f5 100644 --- a/mysql-test/main/sp_notembedded.test +++ b/mysql-test/main/sp_notembedded.test @@ -305,6 +305,7 @@ set session low_priority_updates=default; # # Bug#44798 MySQL engine crashes when creating stored procedures with execute_priv=N # +--source include/switch_to_mysql_user.inc INSERT IGNORE INTO mysql.user (Host, User, Password, Select_priv, Insert_priv, Update_priv, Delete_priv, Create_priv, Drop_priv, Reload_priv, Shutdown_priv, Process_priv, File_priv, Grant_priv, References_priv, Index_priv, Alter_priv, Show_db_priv, Super_priv, @@ -323,10 +324,7 @@ CREATE PROCEDURE p1(i INT) BEGIN END; disconnect con1; connection default; DROP PROCEDURE p1; - -DELETE FROM mysql.user WHERE User='mysqltest_1'; -FLUSH PRIVILEGES; - +--source include/switch_to_mysql_global_priv.inc --echo # --echo # Bug#44521 Prepared Statement: CALL p() - crashes: `! thd->main_da.is_sent' failed et.al. @@ -464,8 +462,9 @@ DROP EVENT teste_bug11763507; # A case of SHOW GRANTS # (creating a new procedure changes the password) # +--source include/switch_to_mysql_user.inc grant create routine on test.* to foo1@localhost identified by 'foo'; -update mysql.user set password = replace(password, '*', '-') where user='foo1'; +update mysql.user set authentication_string = replace(authentication_string, '*', '-') where user='foo1'; --connect (foo,localhost,foo1,foo) show grants; --connection default @@ -479,6 +478,7 @@ show grants; --disconnect foo drop procedure spfoo; drop user foo1@localhost; +--source include/switch_to_mysql_global_priv.inc # # Restore global concurrent_insert value. Keep in the end of the test file. diff --git a/mysql-test/main/sql_mode.result b/mysql-test/main/sql_mode.result index 238bae2efd8..25a90703bf5 100644 --- a/mysql-test/main/sql_mode.result +++ b/mysql-test/main/sql_mode.result @@ -476,10 +476,14 @@ select @@sql_mode; @@sql_mode REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI set sql_mode=2147483648*2*2*2; -ERROR 42000: Variable 'sql_mode' can't be set to the value of '17179869184' select @@sql_mode; @@sql_mode -REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,NO_TABLE_OPTIONS,ANSI +TIME_ROUND_FRACTIONAL +set sql_mode=2147483648*2*2*2*2; +ERROR 42000: Variable 'sql_mode' can't be set to the value of '34359738368' +select @@sql_mode; +@@sql_mode +TIME_ROUND_FRACTIONAL set sql_mode=PAD_CHAR_TO_FULL_LENGTH; create table t1 (a int auto_increment primary key, b char(5)); insert into t1 (b) values('a'),('b\t'),('c '); diff --git a/mysql-test/main/sql_mode.test b/mysql-test/main/sql_mode.test index 8cf50f73f6f..97f5cf42791 100644 --- a/mysql-test/main/sql_mode.test +++ b/mysql-test/main/sql_mode.test @@ -263,8 +263,10 @@ set sql_mode=4194304; select @@sql_mode; set sql_mode=16384+(65536*4); select @@sql_mode; +set sql_mode=2147483648*2*2*2; +select @@sql_mode; --error 1231 -set sql_mode=2147483648*2*2*2; # that mode does not exist +set sql_mode=2147483648*2*2*2*2; # that mode does not exist select @@sql_mode; # diff --git a/mysql-test/main/sql_safe_updates.opt b/mysql-test/main/sql_safe_updates.opt new file mode 100644 index 00000000000..7ffaa462d01 --- /dev/null +++ b/mysql-test/main/sql_safe_updates.opt @@ -0,0 +1 @@ +--enable-sql-safe-updates diff --git a/mysql-test/main/sql_safe_updates.result b/mysql-test/main/sql_safe_updates.result new file mode 100644 index 00000000000..356cd36bad9 --- /dev/null +++ b/mysql-test/main/sql_safe_updates.result @@ -0,0 +1,3 @@ +select @@sql_safe_updates; +@@sql_safe_updates +1 diff --git a/mysql-test/main/sql_safe_updates.test b/mysql-test/main/sql_safe_updates.test new file mode 100644 index 00000000000..18decd0ff2c --- /dev/null +++ b/mysql-test/main/sql_safe_updates.test @@ -0,0 +1,4 @@ +# +# MDEV-14429 sql_safe_updates in my.cnf not work +# +select @@sql_safe_updates; diff --git a/mysql-test/main/ssl-crl-revoked-crl.result b/mysql-test/main/ssl-crl-revoked-crl.result deleted file mode 100644 index 8ecc6a509d3..00000000000 --- a/mysql-test/main/ssl-crl-revoked-crl.result +++ /dev/null @@ -1 +0,0 @@ -# try logging in with a certificate in the server's --ssl-crl : should fail diff --git a/mysql-test/main/ssl.result b/mysql-test/main/ssl.result index 5de9e5174d8..8de36f55ecf 100644 --- a/mysql-test/main/ssl.result +++ b/mysql-test/main/ssl.result @@ -4,10 +4,10 @@ have_ssl 1 SHOW STATUS LIKE 'Ssl_server_not_before'; Variable_name Value -Ssl_server_not_before Apr 25 20:52:21 2017 GMT +Ssl_server_not_before Jan 27 10:11:10 2019 GMT SHOW STATUS LIKE 'Ssl_server_not_after'; Variable_name Value -Ssl_server_not_after Apr 20 20:52:21 2037 GMT +Ssl_server_not_after Jan 22 10:11:10 2039 GMT drop table if exists t1,t2,t3,t4; CREATE TABLE t1 ( Period smallint(4) unsigned zerofill DEFAULT '0000' NOT NULL, @@ -2175,8 +2175,3 @@ still connected? still connected? connection default; disconnect ssl_con; -create user mysqltest_1@localhost; -grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA"; -Variable_name Value -Ssl_cipher AES256-SHA -drop user mysqltest_1@localhost; diff --git a/mysql-test/main/ssl.test b/mysql-test/main/ssl.test index f2ac288db7a..67db668a1c2 100644 --- a/mysql-test/main/ssl.test +++ b/mysql-test/main/ssl.test @@ -32,10 +32,5 @@ select 'still connected?'; connection default; disconnect ssl_con; -create user mysqltest_1@localhost; -grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA"; ---exec $MYSQL -umysqltest_1 --ssl-cipher=AES256-SHA -e "show status like 'ssl_cipher'" 2>&1 -drop user mysqltest_1@localhost; - # Wait till all disconnects are completed --source include/wait_until_count_sessions.inc diff --git a/mysql-test/main/ssl_cert_verify.result b/mysql-test/main/ssl_cert_verify.result deleted file mode 100644 index 1da77329509..00000000000 --- a/mysql-test/main/ssl_cert_verify.result +++ /dev/null @@ -1,5 +0,0 @@ -#T1: Host name (/CN=localhost/) as OU name in the server certificate, server certificate verification should fail. -#T2: Host name (localhost) as common name in the server certificate, server certificate verification should pass. -Variable_name Value -Ssl_version TLS_VERSION -# restart server using restart diff --git a/mysql-test/main/ssl_cert_verify.test b/mysql-test/main/ssl_cert_verify.test deleted file mode 100644 index 83f621b7ca9..00000000000 --- a/mysql-test/main/ssl_cert_verify.test +++ /dev/null @@ -1,43 +0,0 @@ -# Want to skip this test from Valgrind execution ---source include/no_valgrind_without_big.inc -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc --- source include/have_ssl_communication.inc -# Save the initial number of concurrent sessions ---source include/count_sessions.inc - -let $ssl_verify_fail_path = --ssl --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-key-verify-fail.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert-verify-fail.pem; -let $ssl_verify_pass_path = --ssl --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-key-verify-pass.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-cert-verify-pass.pem; - ---echo #T1: Host name (/CN=localhost/) as OU name in the server certificate, server certificate verification should fail. ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server ---source include/wait_until_disconnected.inc - ---exec echo "restart:" $ssl_verify_fail_path > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - ---error 1 ---exec $MYSQL --protocol=tcp --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-verify-server-cert -e "SHOW STATUS like 'Ssl_version'" - ---echo #T2: Host name (localhost) as common name in the server certificate, server certificate verification should pass. ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server ---source include/wait_until_disconnected.inc - ---exec echo "restart:" $ssl_verify_pass_path > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc - ---replace_result TLSv1.2 TLS_VERSION TLSv1.1 TLS_VERSION TLSv1 TLS_VERSION ---exec $MYSQL --protocol=tcp --ssl-ca=$MYSQL_TEST_DIR/std_data/ca-cert-verify.pem --ssl-verify-server-cert -e "SHOW STATUS like 'Ssl_version'" - ---echo # restart server using restart ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---shutdown_server ---source include/wait_until_disconnected.inc - ---exec echo "restart: " > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect ---enable_reconnect ---source include/wait_until_connected_again.inc diff --git a/mysql-test/main/ssl_cipher-master.opt b/mysql-test/main/ssl_cipher-master.opt deleted file mode 100644 index d750c46ba5c..00000000000 --- a/mysql-test/main/ssl_cipher-master.opt +++ /dev/null @@ -1 +0,0 @@ ---loose-ssl-cipher=AES128-SHA diff --git a/mysql-test/main/ssl_cipher.result b/mysql-test/main/ssl_cipher.result index 79998dfca80..266c9f9322a 100644 --- a/mysql-test/main/ssl_cipher.result +++ b/mysql-test/main/ssl_cipher.result @@ -1,6 +1,61 @@ -# -# BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'" -# +create user ssl_user1@localhost require SSL; +create user ssl_user2@localhost require cipher 'AES256-SHA'; +create user ssl_user3@localhost require cipher 'AES256-SHA' AND SUBJECT '/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client'; +create user ssl_user4@localhost require cipher 'AES256-SHA' AND SUBJECT '/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client' ISSUER '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'; +create user ssl_user5@localhost require cipher 'AES256-SHA' AND SUBJECT 'xxx'; +connect con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA; +connect(localhost,ssl_user2,,test,MASTER_PORT,MASTER_SOCKET); +connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA; +ERROR 28000: Access denied for user 'ssl_user2'@'localhost' (using password: NO) +connect con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA; +connect con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA; +connect con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA; +connect(localhost,ssl_user5,,test,MASTER_PORT,MASTER_SOCKET); +connect con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA; +ERROR 28000: Access denied for user 'ssl_user5'@'localhost' (using password: NO) +connection con1; +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher AES256-SHA +disconnect con1; +connection con2; +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher AES256-SHA +disconnect con2; +connection con3; +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher AES256-SHA +disconnect con3; +connection con4; +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher AES256-SHA +disconnect con4; +connection default; +drop user ssl_user1@localhost, ssl_user2@localhost, ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost; +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher AES256-SHA +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher AES128-SHA +SHOW STATUS LIKE 'Ssl_cipher'; +Variable_name Value +Ssl_cipher AES128-SHA +mysqltest: Could not open connection 'default': 2026 SSL connection error: xxxxVariable_name Value +Ssl_cipher AES256-SHA +Variable_name Value +Ssl_cipher AES128-SHA +select 'is still running; no cipher request crashed the server' as result from dual; +result +is still running; no cipher request crashed the server +create user mysqltest_1@localhost; +grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA"; +Variable_name Value +Ssl_cipher AES256-SHA +drop user mysqltest_1@localhost; connect ssl_con,localhost,root,,,,,SSL; SHOW STATUS LIKE 'Ssl_cipher'; Variable_name Value @@ -8,5 +63,5 @@ Ssl_cipher AES128-SHA SHOW STATUS LIKE 'Ssl_cipher_list'; Variable_name Value Ssl_cipher_list AES128-SHA -connection default; disconnect ssl_con; +connection default; diff --git a/mysql-test/main/ssl_cipher.test b/mysql-test/main/ssl_cipher.test index cf249343324..27854654a9f 100644 --- a/mysql-test/main/ssl_cipher.test +++ b/mysql-test/main/ssl_cipher.test @@ -1,23 +1,103 @@ -# Turn on ssl between the client and server -# and run a number of tests +# +# Various tests that require setting of a specific ssl_cipher +# which currently doesn't work in OpenSSL 1.1.1 +# +--source include/have_ssl_communication.inc ---echo # ---echo # BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'" ---echo # +if (`select @@version_ssl_library like 'OpenSSL 1.1.1%'`) { + skip OpenSSL 1.1.1; +} --- source include/have_ssl_communication.inc +create user ssl_user1@localhost require SSL; +create user ssl_user2@localhost require cipher 'AES256-SHA'; +create user ssl_user3@localhost require cipher 'AES256-SHA' AND SUBJECT '/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client'; +create user ssl_user4@localhost require cipher 'AES256-SHA' AND SUBJECT '/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB/CN=client' ISSUER '/CN=cacert/C=FI/ST=Helsinki/L=Helsinki/O=MariaDB'; +create user ssl_user5@localhost require cipher 'AES256-SHA' AND SUBJECT 'xxx'; -# Save the initial number of concurrent sessions ---source include/count_sessions.inc +connect (con1,localhost,ssl_user1,,,,,SSL-CIPHER=AES256-SHA); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES128-SHA); +connect (con2,localhost,ssl_user2,,,,,SSL-CIPHER=AES256-SHA); +connect (con3,localhost,ssl_user3,,,,,SSL-CIPHER=AES256-SHA); +connect (con4,localhost,ssl_user4,,,,,SSL-CIPHER=AES256-SHA); +--replace_result $MASTER_MYSOCK MASTER_SOCKET $MASTER_MYPORT MASTER_PORT +--error ER_ACCESS_DENIED_ERROR +connect (con5,localhost,ssl_user5,,,,,SSL-CIPHER=AES256-SHA); +connection con1; +SHOW STATUS LIKE 'Ssl_cipher'; +disconnect con1; +connection con2; +SHOW STATUS LIKE 'Ssl_cipher'; +disconnect con2; +connection con3; +SHOW STATUS LIKE 'Ssl_cipher'; +disconnect con3; +connection con4; +SHOW STATUS LIKE 'Ssl_cipher'; +disconnect con4; +connection default; +drop user ssl_user1@localhost, ssl_user2@localhost, ssl_user3@localhost, ssl_user4@localhost, ssl_user5@localhost; + +# +# Bug#21611 Slave can't connect when master-ssl-cipher specified +# - Apparently selecting a cipher doesn't work at all +# - Use a cipher that both yaSSL and OpenSSL supports +# +--write_file $MYSQLTEST_VARDIR/tmp/test.sql +SHOW STATUS LIKE 'Ssl_cipher'; +EOF +--exec $MYSQL_TEST --ssl-cipher=AES256-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 +# Test to connect using a list of ciphers +--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER:AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 +# Test to connect using a specifi cipher +--exec $MYSQL_TEST --ssl-cipher=AES128-SHA < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 +# Test to connect using an unknown cipher +--replace_regex /2026 SSL connection error.*/2026 SSL connection error: xxxx/ +--error 1 +--exec $MYSQL_TEST --ssl-cipher=UNKNOWN-CIPHER < $MYSQLTEST_VARDIR/tmp/test.sql 2>&1 +--remove_file $MYSQLTEST_VARDIR/tmp/test.sql + +# +# Bug#39172 Asking for DH+non-RSA key with server set to use other key caused +# YaSSL to crash the server. +# + +# Common ciphers to openssl and yassl +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES256-SHA +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl_cipher';" --ssl-cipher=AES128-SHA +--disable_query_log +--disable_result_log + +# Below here caused crashes. ################ +--error 0,1 +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=NOT----EXIST +# These probably exist but the server's keys can't be used to accept these kinds of connections. +--error 0,1 +--exec $MYSQL --host=localhost -e "SHOW STATUS LIKE 'Ssl-cipher';" --ssl-cipher=AES128-RMD + +# If this gives a result, then the bug is fixed. +--enable_result_log +--enable_query_log +select 'is still running; no cipher request crashed the server' as result from dual; + +# +# MDEV-10054 Secure login fails when CIPHER is required +# +create user mysqltest_1@localhost; +grant usage on mysqltest.* to mysqltest_1@localhost require cipher "AES256-SHA"; +--exec $MYSQL -umysqltest_1 --ssl-cipher=AES256-SHA -e "show status like 'ssl_cipher'" 2>&1 +drop user mysqltest_1@localhost; + +# +# BUG#11760210 - SSL_CIPHER_LIST NOT SET OR RETURNED FOR "SHOW STATUS LIKE 'SSL_CIPHER_LIST'" +# it was a bug in yaSSL, fixed in d2e36e4258bb +# +let $restart_parameters=--ssl-cipher=AES128-SHA; +source include/restart_mysqld.inc; connect (ssl_con,localhost,root,,,,,SSL); - -# Check Cipher Name and Cipher List SHOW STATUS LIKE 'Ssl_cipher'; SHOW STATUS LIKE 'Ssl_cipher_list'; - -connection default; disconnect ssl_con; - -# Wait till all disconnects are completed ---source include/wait_until_count_sessions.inc +connection default; diff --git a/mysql-test/main/ssl_crl-master.opt b/mysql-test/main/ssl_crl-master.opt deleted file mode 100644 index 8500f8cd6e7..00000000000 --- a/mysql-test/main/ssl_crl-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem ---ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem ---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem ---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl diff --git a/mysql-test/main/ssl_crl.combinations b/mysql-test/main/ssl_crl.combinations new file mode 100644 index 00000000000..abeec480510 --- /dev/null +++ b/mysql-test/main/ssl_crl.combinations @@ -0,0 +1,5 @@ +[file] +ssl-crl=$MYSQL_TEST_DIR/std_data/client-cert.crl + +[path] +ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir diff --git a/mysql-test/main/ssl_crl.result b/mysql-test/main/ssl_crl.result index 570dd9cab06..598774bd772 100644 --- a/mysql-test/main/ssl_crl.result +++ b/mysql-test/main/ssl_crl.result @@ -1,23 +1,5 @@ -# test --crl for the client : should connect +# try logging in with a certificate not in the server's --ssl-crl : should succeed Variable_name Value -have_openssl YES -have_ssl YES -ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem -ssl_capath -ssl_cert MYSQL_TEST_DIR/std_data/crl-server-cert.pem -ssl_cipher -ssl_crl MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -ssl_crlpath -ssl_key MYSQL_TEST_DIR/std_data/crl-server-key.pem -# test --crlpath for the client : should connect -Variable_name Value -have_openssl YES -have_ssl YES -ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem -ssl_capath -ssl_cert MYSQL_TEST_DIR/std_data/crl-server-cert.pem -ssl_cipher -ssl_crl MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -ssl_crlpath -ssl_key MYSQL_TEST_DIR/std_data/crl-server-key.pem +Ssl_version TLS_VERSION # try logging in with a certificate in the server's --ssl-crl : should fail +ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked diff --git a/mysql-test/main/ssl_crl.test b/mysql-test/main/ssl_crl.test index 65c14837e50..dc30a9b5934 100644 --- a/mysql-test/main/ssl_crl.test +++ b/mysql-test/main/ssl_crl.test @@ -2,15 +2,12 @@ -- source include/not_embedded.inc -- source include/have_openssl.inc ---echo # test --crl for the client : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem test --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -e "SHOW VARIABLES like '%ssl%';" - ---echo # test --crlpath for the client : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir test -e "SHOW VARIABLES like '%ssl%';" +--echo # try logging in with a certificate not in the server's --ssl-crl : should succeed +--replace_result TLSv1.3 TLS_VERSION TLSv1.2 TLS_VERSION TLSv1.1 TLS_VERSION TLSv1 TLS_VERSION +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/server-new-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/server-new-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'" --echo # try logging in with a certificate in the server's --ssl-crl : should fail ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR +# OpenSSL 1.1.1a correctly rejects the certificate, but the error message is wrong +--replace_result "ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0" "ERROR 2026 (HY000): SSL connection error: sslv3 alert certificate revoked" --error 1 ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem test -e "SHOW VARIABLES like '%ssl%';" +--exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1 diff --git a/mysql-test/main/ssl_crl_clients-master.opt b/mysql-test/main/ssl_crl_clients-master.opt deleted file mode 100644 index fa885a61a0c..00000000000 --- a/mysql-test/main/ssl_crl_clients-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem ---ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem ---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem ---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl diff --git a/mysql-test/main/ssl_crl_clients-valid.result b/mysql-test/main/ssl_crl_clients-valid.result deleted file mode 100644 index f3f47d51846..00000000000 --- a/mysql-test/main/ssl_crl_clients-valid.result +++ /dev/null @@ -1,24 +0,0 @@ -# Test clients with and without CRL lists -############ Test mysql ############## -# Test mysql connecting to a server with an empty crl -Variable_name Value -have_openssl YES -have_ssl YES -ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem -ssl_capath -ssl_cert MYSQL_TEST_DIR/std_data/crl-client-cert.pem -ssl_cipher -ssl_crl -ssl_crlpath -ssl_key MYSQL_TEST_DIR/std_data/crl-client-key.pem -# Test mysql connecting to a server with a certificate revoked by -crl -# Test mysql connecting to a server with a certificate revoked by -crlpath -############ Test mysqladmin ############## -# Test mysqladmin connecting to a server with an empty crl -mysqld is alive -# Test mysqladmin connecting to a server with a certificate revoked by -crl -mysqladmin: connect to server at 'localhost' failed -error: 'SSL connection error: Failed to set ciphers to use' -# Test mysqladmin connecting to a server with a certificate revoked by -crlpath -mysqladmin: connect to server at 'localhost' failed -error: 'SSL connection error: error:00000005:lib(0):func(0):DH lib' diff --git a/mysql-test/main/ssl_crl_clients.result b/mysql-test/main/ssl_crl_clients.result index 3bb9b4ee7e2..0d8ed9a4158 100644 --- a/mysql-test/main/ssl_crl_clients.result +++ b/mysql-test/main/ssl_crl_clients.result @@ -1,7 +1,13 @@ # Test clients with and without CRL lists ############ Test mysql ############## # Test mysql connecting to a server with a certificate revoked by -crl +ERROR 2026 (HY000): SSL connection error: certificate revoked # Test mysql connecting to a server with a certificate revoked by -crlpath +ERROR 2026 (HY000): SSL connection error: certificate revoked ############ Test mysqladmin ############## # Test mysqladmin connecting to a server with a certificate revoked by -crl +mysqladmin: connect to server at 'localhost' failed +error: 'SSL connection error: certificate revoked' # Test mysqladmin connecting to a server with a certificate revoked by -crlpath +mysqladmin: connect to server at 'localhost' failed +error: 'SSL connection error: certificate revoked' diff --git a/mysql-test/main/ssl_crl_clients.test b/mysql-test/main/ssl_crl_clients.test index 7c05f498fbe..fc954a2fc38 100644 --- a/mysql-test/main/ssl_crl_clients.test +++ b/mysql-test/main/ssl_crl_clients.test @@ -4,38 +4,33 @@ --echo # Test clients with and without CRL lists -let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem; -let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl; -let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir; +let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/cacert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/client-cert.pem --ssl-verify-server-cert; +let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/server-cert.crl; +let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TMP_DIR; +# See `openssl x509 -in server-cert.pem -noout -issuer_hash` +copy_file $MYSQL_TEST_DIR/std_data/server-cert.crl $MYSQL_TMP_DIR/ed1f42db.r0; --echo ############ Test mysql ############## --echo # Test mysql connecting to a server with a certificate revoked by -crl ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --error 1 ---exec $MYSQL $ssl_crl test -e "SHOW VARIABLES like '%ssl%';" +--exec $MYSQL $ssl_crl test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1 --echo # Test mysql connecting to a server with a certificate revoked by -crlpath ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR --error 1 ---exec $MYSQL $ssl_crlpath test -e "SHOW VARIABLES like '%ssl%';" +--exec $MYSQL $ssl_crlpath test -e "SHOW STATUS LIKE 'Ssl_version'" 2>&1 --echo ############ Test mysqladmin ############## -let $admin_prefix = --no-defaults; let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping; --echo # Test mysqladmin connecting to a server with a certificate revoked by -crl ---disable_result_log ---replace_regex /.*mysqladmin.*: connect/mysqladmin: connect/ ---error 2 ---exec $MYSQLADMIN $admin_prefix $ssl_crl $admin_suffix 2>&1 ---enable_result_log +--replace_regex /.*mysqladmin.*:/mysqladmin:/ +--error 1 +--exec $MYSQLADMIN $ssl_crl $admin_suffix 2>&1 ---disable_result_log --echo # Test mysqladmin connecting to a server with a certificate revoked by -crlpath ---replace_regex /.*mysqladmin.*: connect/mysqladmin: connect/ ---error 2 ---exec $MYSQLADMIN $admin_prefix $ssl_crlpath $admin_suffix 2>&1 ---enable_result_log +--replace_regex /.*mysqladmin.*:/mysqladmin:/ +--error 1 +--exec $MYSQLADMIN $ssl_crlpath $admin_suffix 2>&1 diff --git a/mysql-test/main/ssl_crl_clients_valid-master.opt b/mysql-test/main/ssl_crl_clients_valid-master.opt deleted file mode 100644 index 258df564eba..00000000000 --- a/mysql-test/main/ssl_crl_clients_valid-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem ---ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem ---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem ---ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl diff --git a/mysql-test/main/ssl_crl_clients_valid.result b/mysql-test/main/ssl_crl_clients_valid.result deleted file mode 100644 index 32ee72d5c39..00000000000 --- a/mysql-test/main/ssl_crl_clients_valid.result +++ /dev/null @@ -1,16 +0,0 @@ -# Test clients with and without CRL lists -############ Test mysql ############## -# Test mysql connecting to a server with an empty crl -Variable_name Value -have_openssl YES -have_ssl YES -ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem -ssl_capath -ssl_cert MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem -ssl_cipher -ssl_crl MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -ssl_crlpath -ssl_key MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem -############ Test mysqladmin ############## -# Test mysqladmin connecting to a server with an empty crl -mysqld is alive diff --git a/mysql-test/main/ssl_crl_clients_valid.test b/mysql-test/main/ssl_crl_clients_valid.test deleted file mode 100644 index f08fbf09397..00000000000 --- a/mysql-test/main/ssl_crl_clients_valid.test +++ /dev/null @@ -1,23 +0,0 @@ -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc --- source include/have_openssl.inc - ---echo # Test clients with and without CRL lists - -let $ssl_base = --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem; -let $ssl_crl = $ssl_base --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl; -let $ssl_crlpath = $ssl_base --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir; - - ---echo ############ Test mysql ############## - ---echo # Test mysql connecting to a server with an empty crl ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL $ssl_crl test -e "SHOW VARIABLES like '%ssl%';" 2>&1 - ---echo ############ Test mysqladmin ############## -let $admin_prefix = --no-defaults; -let $admin_suffix = --default-character-set=latin1 -S $MASTER_MYSOCK -P $MASTER_MYPORT -u root --password= ping; - ---echo # Test mysqladmin connecting to a server with an empty crl ---exec $MYSQLADMIN $admin_prefix $ssl_crl $admin_suffix 2>&1 diff --git a/mysql-test/main/ssl_crl_clrpath-master.opt b/mysql-test/main/ssl_crl_clrpath-master.opt deleted file mode 100644 index b1f486a322b..00000000000 --- a/mysql-test/main/ssl_crl_clrpath-master.opt +++ /dev/null @@ -1,4 +0,0 @@ ---ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem ---ssl-key=$MYSQL_TEST_DIR/std_data/crl-server-key.pem ---ssl-cert=$MYSQL_TEST_DIR/std_data/crl-server-cert.pem ---ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir diff --git a/mysql-test/main/ssl_crl_clrpath.result b/mysql-test/main/ssl_crl_clrpath.result deleted file mode 100644 index b4b4d13eca1..00000000000 --- a/mysql-test/main/ssl_crl_clrpath.result +++ /dev/null @@ -1,23 +0,0 @@ -# test --crl for the client : should connect -Variable_name Value -have_openssl YES -have_ssl YES -ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem -ssl_capath -ssl_cert MYSQL_TEST_DIR/std_data/crl-server-cert.pem -ssl_cipher -ssl_crl -ssl_crlpath MYSQL_TEST_DIR/std_data/crldir -ssl_key MYSQL_TEST_DIR/std_data/crl-server-key.pem -# test --crlpath for the client : should connect -Variable_name Value -have_openssl YES -have_ssl YES -ssl_ca MYSQL_TEST_DIR/std_data/crl-ca-cert.pem -ssl_capath -ssl_cert MYSQL_TEST_DIR/std_data/crl-server-cert.pem -ssl_cipher -ssl_crl -ssl_crlpath MYSQL_TEST_DIR/std_data/crldir -ssl_key MYSQL_TEST_DIR/std_data/crl-server-key.pem -# try logging in with a certificate in the server's --ssl-crlpath : should fail diff --git a/mysql-test/main/ssl_crl_clrpath.test b/mysql-test/main/ssl_crl_clrpath.test deleted file mode 100644 index 50d84ad175e..00000000000 --- a/mysql-test/main/ssl_crl_clrpath.test +++ /dev/null @@ -1,16 +0,0 @@ -# This test should work in embedded server after we fix mysqltest --- source include/not_embedded.inc --- source include/have_openssl.inc - ---echo # test --crl for the client : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem test --ssl-crl=$MYSQL_TEST_DIR/std_data/crl-client-revoked.crl -e "SHOW VARIABLES like '%ssl%';" - ---echo # test --crlpath for the client : should connect ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-valid-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-valid-cert.pem --ssl-crlpath=$MYSQL_TEST_DIR/std_data/crldir test -e "SHOW VARIABLES like '%ssl%';" - ---echo # try logging in with a certificate in the server's --ssl-crlpath : should fail ---replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR ---error 1 ---exec $MYSQL --ssl-ca=$MYSQL_TEST_DIR/std_data/crl-ca-cert.pem --ssl-key=$MYSQL_TEST_DIR/std_data/crl-client-key.pem --ssl-cert=$MYSQL_TEST_DIR/std_data/crl-client-cert.pem test -e "SHOW VARIABLES like '%ssl%';" diff --git a/mysql-test/main/stat_tables.result b/mysql-test/main/stat_tables.result index ceadb61feea..db550c1c80e 100644 --- a/mysql-test/main/stat_tables.result +++ b/mysql-test/main/stat_tables.result @@ -64,12 +64,12 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' group by n_name order by revenue desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 179 Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 +1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 +1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 +1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where 1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where -1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey and l_orderkey = o_orderkey @@ -80,7 +80,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' group by n_name order by revenue desc; n_name revenue -PERU 321915.8715 +PERU 321915.87150000007 ARGENTINA 69817.1451 set optimizer_switch=@save_optimizer_switch; delete from mysql.index_stats; @@ -171,12 +171,12 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' group by n_name order by revenue desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 179 Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 +1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 +1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 +1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where 1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where -1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region where c_custkey = o_custkey and l_orderkey = o_orderkey @@ -187,7 +187,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' group by n_name order by revenue desc; n_name revenue -PERU 321915.8715 +PERU 321915.87150000007 ARGENTINA 69817.1451 set optimizer_switch=@save_optimizer_switch; EXPLAIN select o_year, @@ -207,14 +207,14 @@ and o_orderdate between date '1995-01-01' and date '1996-12-31' group by o_year order by o_year; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where -1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_partkey 1 Using where +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE part ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 5 dbt3_s001.part.p_partkey 30 Using index condition 1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where 1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +1 SIMPLE orders eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 +1 SIMPLE n1 ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 Using where select o_year, sum(case when nation = 'UNITED STATES' then volume else 0 end) / sum(volume) as mkt_share @@ -578,58 +578,37 @@ db_name table_name column_name min_value max_value nulls_ratio avg_length avg_fr DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; # -# MDEV-16757: manual addition of min/max statistics for BLOB +# MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4 # -SET use_stat_tables= PREFERABLY; -CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze Warning Engine-independent statistics are not collected for column 't' -test.t1 analyze status OK -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -DELETE FROM mysql.column_stats -WHERE db_name='test' AND table_name='t1' AND column_name='t'; -INSERT INTO mysql.column_stats VALUES -('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL); -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL -SELECT pk FROM t1; -pk -1 -2 -DROP TABLE t1; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables= PREFERABLY; +explain +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL +1 SIMPLE global_priv ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # -# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE +# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes # -SET use_stat_tables= PREFERABLY; -CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32)); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; +set @@use_stat_tables= PREFERABLY; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @save_use_stat_tables= @@use_stat_tables; +create table t1 (a int, b int); +insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); +analyze table t1 persistent for columns (a) indexes (); Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK -SELECT * FROM t1; -pk c -1 foo -2 bar -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL -CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7)); -SELECT * FROM t1; -pk a -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -DROP TABLE t1; +select * from t1 where a=1 and b=3; +a b +1 3 +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; +drop table t1; # # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column # @@ -646,3 +625,59 @@ MAX(pk) NULL DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; +# +# MDEV-17255: New optimizer defaults and ANALYZE TABLE +# +create table t1 (a int, b int); +insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); +set use_stat_tables= preferably_for_queries; +# +# with use_stat_tables= PREFERABLY_FOR_QUERIES +# analyze table t1 will not collect statistics +# +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select * from mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +analyze +select * from t1 where a = 1 and b=3; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +# +# with use_stat_tables= PREFERABLY_FOR_QUERIES +# analyze table t1 will collect statistics if we use PERSISTENT +# for columns, indexes or everything +# +analyze table t1 persistent for columns (a) indexes (); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +select * from mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL +# filtered shows that we used the data from stat tables +analyze +select * from t1 where a = 1 and b=3; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where +# +# with use_stat_tables= PREFERABLY +# analyze table t1 will collect statistics +# +set use_stat_tables=PREFERABLY; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status Table is already up to date +select * from mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL +test t1 b 2 10 0.0000 4.0000 1.1111 0 NULL NULL +# filtered shows that we used the data from stat tables +analyze +select * from t1 where a=1 and b=3; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where +drop table t1; +set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/main/stat_tables.test b/mysql-test/main/stat_tables.test index 2cb6b55f665..2c1d53a2583 100644 --- a/mysql-test/main/stat_tables.test +++ b/mysql-test/main/stat_tables.test @@ -358,49 +358,33 @@ DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; --echo # ---echo # MDEV-16757: manual addition of min/max statistics for BLOB +--echo # MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4 --echo # -SET use_stat_tables= PREFERABLY; - -CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; ---sorted_result -SELECT * FROM mysql.column_stats; -DELETE FROM mysql.column_stats - WHERE db_name='test' AND table_name='t1' AND column_name='t'; -INSERT INTO mysql.column_stats VALUES - ('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL); ---sorted_result -SELECT * FROM mysql.column_stats; - -SELECT pk FROM t1; - -DROP TABLE t1; - +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables= PREFERABLY; +explain +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; --echo # ---echo # MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE +--echo # MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes --echo # -SET use_stat_tables= PREFERABLY; - -CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32)); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; -SELECT * FROM t1; -SELECT * FROM mysql.column_stats; - -CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7)); -SELECT * FROM t1; -SELECT * FROM mysql.column_stats; - -DROP TABLE t1; +set @@use_stat_tables= PREFERABLY; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @save_use_stat_tables= @@use_stat_tables; +create table t1 (a int, b int); +insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); +analyze table t1 persistent for columns (a) indexes (); +select * from t1 where a=1 and b=3; +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; - +drop table t1; --echo # --echo # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column @@ -416,5 +400,47 @@ CREATE OR REPLACE TABLE t1 (pk INT PRIMARY KEY, t TEXT); SELECT MAX(pk) FROM t1; DROP TABLE t1; - +set use_stat_tables=@save_use_stat_tables; + +--echo # +--echo # MDEV-17255: New optimizer defaults and ANALYZE TABLE +--echo # + +create table t1 (a int, b int); +insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); +set use_stat_tables= preferably_for_queries; +--echo # +--echo # with use_stat_tables= PREFERABLY_FOR_QUERIES +--echo # analyze table t1 will not collect statistics +--echo # + +analyze table t1; +select * from mysql.column_stats; +analyze +select * from t1 where a = 1 and b=3; + +--echo # +--echo # with use_stat_tables= PREFERABLY_FOR_QUERIES +--echo # analyze table t1 will collect statistics if we use PERSISTENT +--echo # for columns, indexes or everything +--echo # + +analyze table t1 persistent for columns (a) indexes (); +select * from mysql.column_stats; +--echo # filtered shows that we used the data from stat tables +analyze +select * from t1 where a = 1 and b=3; + +--echo # +--echo # with use_stat_tables= PREFERABLY +--echo # analyze table t1 will collect statistics +--echo # + +set use_stat_tables=PREFERABLY; +analyze table t1; +select * from mysql.column_stats; +--echo # filtered shows that we used the data from stat tables +analyze +select * from t1 where a=1 and b=3; +drop table t1; set use_stat_tables=@save_use_stat_tables; diff --git a/mysql-test/main/stat_tables_disabled.result b/mysql-test/main/stat_tables_disabled.result index f57abc34e0c..f2207592f98 100644 --- a/mysql-test/main/stat_tables_disabled.result +++ b/mysql-test/main/stat_tables_disabled.result @@ -1,10 +1,10 @@ SET SESSION STORAGE_ENGINE='InnoDB'; select @@global.use_stat_tables; @@global.use_stat_tables -NEVER +PREFERABLY select @@session.use_stat_tables; @@session.use_stat_tables -NEVER +PREFERABLY set @save_use_stat_tables=@@use_stat_tables; set use_stat_tables='preferably'; DROP DATABASE IF EXISTS dbt3_s001; diff --git a/mysql-test/main/stat_tables_innodb.result b/mysql-test/main/stat_tables_innodb.result index 7b98ca4259f..c8b18f05876 100644 --- a/mysql-test/main/stat_tables_innodb.result +++ b/mysql-test/main/stat_tables_innodb.result @@ -67,11 +67,11 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' group by n_name order by revenue desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 -1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 +1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index +1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where 1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region @@ -83,7 +83,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' group by n_name order by revenue desc; n_name revenue -PERU 321915.8715 +PERU 321915.87150000007 ARGENTINA 69817.1451 set optimizer_switch=@save_optimizer_switch; delete from mysql.index_stats; @@ -198,11 +198,11 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' group by n_name order by revenue desc; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders range PRIMARY,i_o_orderdate,i_o_custkey i_o_orderdate 4 NULL 213 Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE nation eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 -1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.customer.c_nationkey 1 Using index -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE nation ref PRIMARY,i_n_regionkey i_n_regionkey 5 dbt3_s001.region.r_regionkey 5 +1 SIMPLE supplier ref PRIMARY,i_s_nationkey i_s_nationkey 5 dbt3_s001.nation.n_nationkey 1 Using index +1 SIMPLE customer ref PRIMARY,i_c_nationkey i_c_nationkey 5 dbt3_s001.nation.n_nationkey 6 Using index +1 SIMPLE orders ref PRIMARY,i_o_orderdate,i_o_custkey i_o_custkey 5 dbt3_s001.customer.c_custkey 15 Using where 1 SIMPLE lineitem ref PRIMARY,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where select n_name, sum(l_extendedprice * (1 - l_discount)) as revenue from customer, orders, lineitem, supplier, nation, region @@ -214,7 +214,7 @@ and r_name = 'AMERICA' and o_orderdate >= date '1995-01-01' group by n_name order by revenue desc; n_name revenue -PERU 321915.8715 +PERU 321915.87150000007 ARGENTINA 69817.1451 set optimizer_switch=@save_optimizer_switch; EXPLAIN select o_year, @@ -234,14 +234,14 @@ and o_orderdate between date '1995-01-01' and date '1996-12-31' group by o_year order by o_year; id select_type table type possible_keys key key_len ref rows Extra -1 SIMPLE orders ALL PRIMARY,i_o_orderdate,i_o_custkey NULL NULL NULL 1500 Using where; Using temporary; Using filesort -1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where -1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 -1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using join buffer (flat, BNL join) -1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity PRIMARY 4 dbt3_s001.orders.o_orderkey 4 Using where -1 SIMPLE part eq_ref PRIMARY PRIMARY 4 dbt3_s001.lineitem.l_partkey 1 Using where +1 SIMPLE region ALL PRIMARY NULL NULL NULL 5 Using where; Using temporary; Using filesort +1 SIMPLE part ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join) +1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_suppkey_partkey 5 dbt3_s001.part.p_partkey 30 Using index condition 1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where 1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1 +1 SIMPLE orders eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where +1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where +1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 Using where select o_year, sum(case when nation = 'UNITED STATES' then volume else 0 end) / sum(volume) as mkt_share @@ -605,58 +605,37 @@ db_name table_name column_name min_value max_value nulls_ratio avg_length avg_fr DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; # -# MDEV-16757: manual addition of min/max statistics for BLOB +# MDEV-17023: Crash during read_histogram_for_table with optimizer_use_condition_selectivity set to 4 # -SET use_stat_tables= PREFERABLY; -CREATE TABLE t1 (pk INT PRIMARY KEY, t TEXT); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; -Table Op Msg_type Msg_text -test.t1 analyze status Engine-independent statistics collected -test.t1 analyze Warning Engine-independent statistics are not collected for column 't' -test.t1 analyze status OK -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -DELETE FROM mysql.column_stats -WHERE db_name='test' AND table_name='t1' AND column_name='t'; -INSERT INTO mysql.column_stats VALUES -('test','t1','t','bar','foo', 0.0, 3.0, 1.0, 0, NULL, NULL); -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -test t1 t bar foo 0.0000 3.0000 1.0000 0 NULL NULL -SELECT pk FROM t1; -pk -1 -2 -DROP TABLE t1; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @@use_stat_tables= PREFERABLY; +explain +SELECT * FROM INFORMATION_SCHEMA.PROFILING, mysql.user; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE PROFILING ALL NULL NULL NULL NULL NULL +1 SIMPLE global_priv ALL NULL NULL NULL NULL 4 Using join buffer (flat, BNL join) +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; # -# MDEV-16760: CREATE OR REPLACE TABLE after ANALYZE TABLE +# MDEV-17734: AddressSanitizer: use-after-poison in create_key_parts_for_pseudo_indexes # -SET use_stat_tables= PREFERABLY; -CREATE TABLE t1 (pk int PRIMARY KEY, c varchar(32)); -INSERT INTO t1 VALUES (1,'foo'),(2,'bar'); -ANALYZE TABLE t1; +set @@use_stat_tables= PREFERABLY; +set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=4; +set @save_use_stat_tables= @@use_stat_tables; +create table t1 (a int, b int); +insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); +analyze table t1 persistent for columns (a) indexes (); Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK -SELECT * FROM t1; -pk c -1 foo -2 bar -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -test t1 pk 1 2 0.0000 4.0000 1.0000 0 NULL NULL -test t1 c bar foo 0.0000 3.0000 1.0000 0 NULL NULL -CREATE OR REPLACE TABLE t1 (pk int PRIMARY KEY, a char(7)); -SELECT * FROM t1; -pk a -SELECT * FROM mysql.column_stats; -db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram -DROP TABLE t1; +select * from t1 where a=1 and b=3; +a b +1 3 +set @@optimizer_use_condition_selectivity= @save_optimizer_use_condition_selectivity; set use_stat_tables=@save_use_stat_tables; +drop table t1; # # MDEV-16711:CREATE OR REPLACE TABLE introducing BLOB column # @@ -673,5 +652,61 @@ MAX(pk) NULL DROP TABLE t1; set use_stat_tables=@save_use_stat_tables; +# +# MDEV-17255: New optimizer defaults and ANALYZE TABLE +# +create table t1 (a int, b int); +insert into t1(a,b) values (1,2),(1,3),(1,4),(1,5),(2,6),(2,7),(3,8),(3,9),(3,9),(4,10); +set use_stat_tables= preferably_for_queries; +# +# with use_stat_tables= PREFERABLY_FOR_QUERIES +# analyze table t1 will not collect statistics +# +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status OK +select * from mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +analyze +select * from t1 where a = 1 and b=3; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 100.00 10.00 Using where +# +# with use_stat_tables= PREFERABLY_FOR_QUERIES +# analyze table t1 will collect statistics if we use PERSISTENT +# for columns, indexes or everything +# +analyze table t1 persistent for columns (a) indexes (); +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select * from mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL +# filtered shows that we used the data from stat tables +analyze +select * from t1 where a = 1 and b=3; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 25.00 10.00 Using where +# +# with use_stat_tables= PREFERABLY +# analyze table t1 will collect statistics +# +set use_stat_tables=PREFERABLY; +analyze table t1; +Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze status OK +select * from mysql.column_stats; +db_name table_name column_name min_value max_value nulls_ratio avg_length avg_frequency hist_size hist_type histogram +test t1 a 1 4 0.0000 4.0000 2.5000 0 NULL NULL +test t1 b 2 10 0.0000 4.0000 1.1111 0 NULL NULL +# filtered shows that we used the data from stat tables +analyze +select * from t1 where a=1 and b=3; +id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 10 10.00 2.78 10.00 Using where +drop table t1; +set use_stat_tables=@save_use_stat_tables; set optimizer_switch=@save_optimizer_switch_for_stat_tables_test; SET SESSION STORAGE_ENGINE=DEFAULT; diff --git a/mysql-test/main/stat_tables_rbr.result b/mysql-test/main/stat_tables_rbr.result index 7ae7ade4398..130d1f6da9a 100644 --- a/mysql-test/main/stat_tables_rbr.result +++ b/mysql-test/main/stat_tables_rbr.result @@ -1,15 +1,15 @@ # # Bug mdev-463: assertion failure when running ANALYZE with RBR on # -SET GLOBAL use_stat_tables = PREFERABLY; connect con1,localhost,root,,; CREATE TABLE t1 (i INT) ENGINE=InnoDB; +set use_stat_tables= PREFERABLY; ANALYZE TABLE t1; Table Op Msg_type Msg_text test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; -SET GLOBAL use_stat_tables = DEFAULT; +SET use_stat_tables = DEFAULT; disconnect con1; connection default; SET use_stat_tables = PREFERABLY; diff --git a/mysql-test/main/stat_tables_rbr.test b/mysql-test/main/stat_tables_rbr.test index 29f7c4e6622..1b6a9603743 100644 --- a/mysql-test/main/stat_tables_rbr.test +++ b/mysql-test/main/stat_tables_rbr.test @@ -6,15 +6,14 @@ --echo # Bug mdev-463: assertion failure when running ANALYZE with RBR on --echo # -SET GLOBAL use_stat_tables = PREFERABLY; - --connect (con1,localhost,root,,) CREATE TABLE t1 (i INT) ENGINE=InnoDB; +set use_stat_tables= PREFERABLY; ANALYZE TABLE t1; # Cleanup DROP TABLE t1; -SET GLOBAL use_stat_tables = DEFAULT; +SET use_stat_tables = DEFAULT; --disconnect con1 --connection default diff --git a/mysql-test/main/statistics.result b/mysql-test/main/statistics.result index 574eb5f4727..34a17cf049c 100644 --- a/mysql-test/main/statistics.result +++ b/mysql-test/main/statistics.result @@ -1086,9 +1086,6 @@ test t2 idx4 3 1.1304 ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 test.t2 analyze status OK SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; db_name table_name index_name prefix_arity avg_frequency @@ -1149,11 +1146,6 @@ test t2 idx4 4 1.0000 ANALYZE TABLE t2 PERSISTENT FOR COLUMNS ALL INDEXES ALL; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected -test.t2 analyze Note Data truncated for column 'avg_length' at row 1 -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 test.t2 analyze status OK SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; db_name table_name index_name prefix_arity avg_frequency @@ -1179,8 +1171,6 @@ test t2 idx3 1 8.5000 ANALYZE TABLE t2 PERSISTENT FOR COLUMNS() INDEXES ALL; Table Op Msg_type Msg_text test.t2 analyze status Engine-independent statistics collected -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 -test.t2 analyze Note Data truncated for column 'avg_frequency' at row 1 test.t2 analyze status OK SELECT * FROM mysql.index_stats ORDER BY index_name, prefix_arity, table_name; db_name table_name index_name prefix_arity avg_frequency diff --git a/mysql-test/main/status.result b/mysql-test/main/status.result index 688d8acee1a..37c551328f0 100644 --- a/mysql-test/main/status.result +++ b/mysql-test/main/status.result @@ -324,7 +324,7 @@ Handler_mrr_key_refills 0 Handler_mrr_rowid_refills 0 Handler_prepare 0 Handler_read_first 0 -Handler_read_key 4 +Handler_read_key 9 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 @@ -403,9 +403,9 @@ Table_open_cache_overflows 0 SHOW STATUS LIKE 'Table_open_cache%'; Variable_name Value Table_open_cache_active_instances 1 -Table_open_cache_hits 30 -Table_open_cache_misses 15 -Table_open_cache_overflows 5 +Table_open_cache_hits 72 +Table_open_cache_misses 18 +Table_open_cache_overflows 8 FLUSH TABLES; FLUSH STATUS; SET @@global.table_open_cache= @old_table_open_cache; diff --git a/mysql-test/main/str_to_datetime_457.result b/mysql-test/main/str_to_datetime_457.result index 4fd0d00691c..e365c303c81 100644 --- a/mysql-test/main/str_to_datetime_457.result +++ b/mysql-test/main/str_to_datetime_457.result @@ -1,6 +1,6 @@ select cast('01:02:03 ' as time), cast('01:02:03 ' as time); cast('01:02:03 ' as time) cast('01:02:03 ' as time) -01:02:03 00:00:00 +01:02:03 01:02:03 select cast('2002-011-012' as date), cast('2002.11.12' as date), cast('2002.011.012' as date); cast('2002-011-012' as date) cast('2002.11.12' as date) cast('2002.011.012' as date) 2002-11-12 2002-11-12 2002-11-12 @@ -17,10 +17,7 @@ Warnings: Warning 1292 Incorrect datetime value: '0' select extract(hour from '100000:02:03'), extract(hour from '100000:02:03 '); extract(hour from '100000:02:03') extract(hour from '100000:02:03 ') -NULL NULL -Warnings: -Warning 1292 Truncated incorrect time value: '100000:02:03' -Warning 1292 Truncated incorrect time value: '100000:02:03 ' +16 16 # # backward compatibility craziness # diff --git a/mysql-test/main/strict.result b/mysql-test/main/strict.result index 315bb9dc1b5..b9db4166398 100644 --- a/mysql-test/main/strict.result +++ b/mysql-test/main/strict.result @@ -8,43 +8,43 @@ CREATE TABLE t1 (col1 date); INSERT INTO t1 VALUES('2004-01-01'),('2004-02-29'); INSERT INTO t1 VALUES('0000-10-31'); INSERT INTO t1 VALUES('2004-0-31'); -ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-0-31' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-01-02'),('2004-0-31'); -ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 2 +ERROR 22007: Incorrect date value: '2004-0-31' for column `test`.`t1`.`col1` at row 2 INSERT INTO t1 VALUES('2004-10-0'); -ERROR 22007: Incorrect date value: '2004-10-0' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-10-0' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-09-31'); -ERROR 22007: Incorrect date value: '2004-09-31' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-09-31' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-10-32'); -ERROR 22007: Incorrect date value: '2004-10-32' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-10-32' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2003-02-29'); -ERROR 22007: Incorrect date value: '2003-02-29' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2003-02-29' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-13-15'); -ERROR 22007: Incorrect date value: '2004-13-15' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-13-15' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('0000-00-00'); -ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES ('59'); -ERROR 22007: Incorrect date value: '59' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '59' for column `test`.`t1`.`col1` at row 1 set @@sql_mode='STRICT_ALL_TABLES'; INSERT INTO t1 VALUES('2004-01-03'),('2004-0-31'); set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE'; INSERT INTO t1 VALUES('2004-0-30'); -ERROR 22007: Incorrect date value: '2004-0-30' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-0-30' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-01-04'),('2004-0-31'),('2004-01-05'); -ERROR 22007: Incorrect date value: '2004-0-31' for column 'col1' at row 2 +ERROR 22007: Incorrect date value: '2004-0-31' for column `test`.`t1`.`col1` at row 2 INSERT INTO t1 VALUES('0000-00-00'); INSERT IGNORE INTO t1 VALUES('2004-0-29'); Warnings: Warning 1265 Data truncated for column 'col1' at row 1 set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE'; INSERT INTO t1 VALUES('0000-00-00'); -ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`col1` at row 1 INSERT IGNORE INTO t1 VALUES('0000-00-00'); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 INSERT INTO t1 VALUES ('2004-0-30'); INSERT INTO t1 VALUES ('2004-2-30'); -ERROR 22007: Incorrect date value: '2004-2-30' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-2-30' for column `test`.`t1`.`col1` at row 1 set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES'; INSERT INTO t1 VALUES ('2004-2-30'); set @@sql_mode='ansi,traditional'; @@ -73,7 +73,7 @@ drop table t1; set @@sql_mode='strict_trans_tables'; CREATE TABLE t1 (col1 date) engine=myisam; INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1'); -ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-13-31' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES ('2004-1-2'), ('2004-13-31'),('2004-1-3'); Warnings: Warning 1265 Data truncated for column 'col1' at row 2 @@ -81,7 +81,7 @@ INSERT IGNORE INTO t1 VALUES('2004-13-31'),('2004-1-4'); Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT INTO t1 VALUES ('2003-02-29'); -ERROR 22007: Incorrect date value: '2003-02-29' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2003-02-29' for column `test`.`t1`.`col1` at row 1 INSERT ignore INTO t1 VALUES('2003-02-30'); Warnings: Warning 1265 Data truncated for column 'col1' at row 1 @@ -100,14 +100,14 @@ drop table t1; set @@sql_mode='strict_trans_tables'; CREATE TABLE t1 (col1 date) engine=innodb; INSERT INTO t1 VALUES('2004-13-31'),('2004-1-1'); -ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-13-31' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES ('2004-1-2'), ('2004-13-31'),('2004-1-3'); -ERROR 22007: Incorrect date value: '2004-13-31' for column 'col1' at row 2 +ERROR 22007: Incorrect date value: '2004-13-31' for column `test`.`t1`.`col1` at row 2 INSERT IGNORE INTO t1 VALUES('2004-13-31'),('2004-1-4'); Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT INTO t1 VALUES ('2003-02-29'); -ERROR 22007: Incorrect date value: '2003-02-29' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2003-02-29' for column `test`.`t1`.`col1` at row 1 INSERT ignore INTO t1 VALUES('2003-02-30'); Warnings: Warning 1265 Data truncated for column 'col1' at row 1 @@ -125,21 +125,21 @@ CREATE TABLE t1 (col1 datetime); INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00'); INSERT INTO t1 VALUES('0000-10-31 15:30:00'); INSERT INTO t1 VALUES('2004-0-31 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-10-0 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-09-31 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-10-32 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2003-02-29 15:30:00'); -ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-13-15 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('0000-00-00 15:30:00'); -ERROR 22007: Incorrect datetime value: '0000-00-00 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES ('59'); -ERROR 22007: Incorrect datetime value: '59' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '59' for column `test`.`t1`.`col1` at row 1 select * from t1; col1 2004-10-31 15:30:00 @@ -149,49 +149,49 @@ drop table t1; CREATE TABLE t1 (col1 timestamp); INSERT INTO t1 VALUES('2004-10-31 15:30:00'),('2004-02-29 15:30:00'); INSERT INTO t1 VALUES('0000-10-31 15:30:00'); -ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-0-31 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-10-0 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-09-31 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-10-32 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2003-02-29 15:30:00'); -ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-13-15 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-13-15 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-02-29 25:30:00'); -ERROR 22007: Incorrect datetime value: '2004-02-29 25:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-02-29 25:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-02-29 15:65:00'); -ERROR 22007: Incorrect datetime value: '2004-02-29 15:65:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-02-29 15:65:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-02-29 15:31:61'); -ERROR 22007: Incorrect datetime value: '2004-02-29 15:31:61' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-02-29 15:31:61' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('0000-00-00 15:30:00'); -ERROR 22007: Incorrect datetime value: '0000-00-00 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('0000-00-00 00:00:00'); -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`col1` at row 1 INSERT IGNORE INTO t1 VALUES('0000-00-00 00:00:00'); Warnings: Warning 1265 Data truncated for column 'col1' at row 1 INSERT INTO t1 VALUES ('59'); -ERROR 22007: Incorrect datetime value: '59' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '59' for column `test`.`t1`.`col1` at row 1 set @@sql_mode='STRICT_ALL_TABLES,ALLOW_INVALID_DATES'; INSERT INTO t1 VALUES('2004-0-31 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-0-31 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-10-0 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-10-0 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-10-32 15:30:00'); -ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-10-32 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('2004-02-30 15:30:04'); -ERROR 22007: Incorrect datetime value: '2004-02-30 15:30:04' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '2004-02-30 15:30:04' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 VALUES('0000-00-00 00:00:00'); set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_IN_DATE'; INSERT INTO t1 VALUES('0000-00-00 00:00:00'); set @@sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE'; INSERT INTO t1 VALUES('0000-00-00 00:00:00'); -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`col1` at row 1 set @@sql_mode='ansi,traditional'; SELECT * FROM t1; col1 @@ -214,11 +214,11 @@ ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_dat INSERT INTO t1 (col1) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-09-31 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2003-02-29 15:30:00' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col1) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); @@ -228,27 +228,27 @@ ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_dat INSERT INTO t1 (col2) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col2' at row 1 +ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column `test`.`t1`.`col2` at row 1 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col2' at row 1 +ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column `test`.`t1`.`col2` at row 1 INSERT INTO t1 (col2) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col2) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); ERROR HY000: Incorrect datetime value: '00.00.0000' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.10.0000 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column `test`.`t1`.`col3` at row 1 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.0.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '31.0.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('0.10.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '0.10.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('31.9.2004 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column 'col3' at row 1 +ERROR 22007: Incorrect datetime value: '2004-09-31 15:30:00' for column `test`.`t1`.`col3` at row 1 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('32.10.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '32.10.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('29.02.2003 15.30','%d.%m.%Y %H.%i')); -ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column 'col3' at row 1 +ERROR 22007: Incorrect datetime value: '2003-02-29 15:30:00' for column `test`.`t1`.`col3` at row 1 INSERT INTO t1 (col3) VALUES(STR_TO_DATE('15.13.2004 15.30','%d.%m.%Y %H.%i')); ERROR HY000: Incorrect datetime value: '15.13.2004 15.30' for function str_to_date INSERT INTO t1 (col3) VALUES(STR_TO_DATE('00.00.0000','%d.%m.%Y')); @@ -273,7 +273,7 @@ ERROR 22007: Incorrect datetime value: '2004-0-10 15:30' INSERT INTO t1 (col2) VALUES(CAST('0000-00-00' AS DATETIME)); ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col3) VALUES(CAST('0000-10-31 15:30' AS DATETIME)); -ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column `test`.`t1`.`col3` at row 1 INSERT INTO t1 (col3) VALUES(CAST('2004-10-0 15:30' AS DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-0 15:30' INSERT INTO t1 (col3) VALUES(CAST('2004-0-10 15:30' AS DATETIME)); @@ -291,7 +291,7 @@ ERROR 22007: Incorrect datetime value: '2004-10-0' INSERT INTO t1 (col1) VALUES(CONVERT('2004-0-10' , DATE)); ERROR 22007: Incorrect datetime value: '2004-0-10' INSERT INTO t1 (col1) VALUES('2004-0-10'); -ERROR 22007: Incorrect date value: '2004-0-10' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '2004-0-10' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES(CONVERT('0000-00-00',DATE)); ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col2) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); @@ -302,7 +302,7 @@ ERROR 22007: Incorrect datetime value: '2004-0-10 15:30' INSERT INTO t1 (col2) VALUES(CONVERT('0000-00-00',DATETIME)); ERROR 22007: Incorrect datetime value: '0000-00-00' INSERT INTO t1 (col3) VALUES(CONVERT('0000-10-31 15:30',DATETIME)); -ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column 'col3' at row 1 +ERROR 22007: Incorrect datetime value: '0000-10-31 15:30:00' for column `test`.`t1`.`col3` at row 1 INSERT INTO t1 (col3) VALUES(CONVERT('2004-10-0 15:30',DATETIME)); ERROR 22007: Incorrect datetime value: '2004-10-0 15:30' INSERT INTO t1 (col3) VALUES(CONVERT('2004-0-10 15:30',DATETIME)); @@ -366,9 +366,9 @@ Warnings: Warning 1365 Division by 0 Warning 1365 Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -449,9 +449,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -533,9 +533,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -617,9 +617,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -699,9 +699,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22007: Incorrect integer value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: 'a59b' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -786,9 +786,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col1= MOD(col1,0) WHERE col1 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22007: Incorrect decimal value: '' for column 'col1' at row 1 +ERROR 22007: Incorrect decimal value: '' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect decimal value: 'a59b' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -853,9 +853,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22007: Incorrect double value: '' for column 'col1' at row 1 +ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect double value: 'a59b' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -903,9 +903,9 @@ ERROR 22012: Division by 0 UPDATE t1 SET col2= MOD(col2,0) WHERE col2 > 0; ERROR 22012: Division by 0 INSERT INTO t1 (col1) VALUES (''); -ERROR 22007: Incorrect double value: '' for column 'col1' at row 1 +ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('a59b'); -ERROR 22007: Incorrect double value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect double value: 'a59b' for column `test`.`t1`.`col1` at row 1 INSERT INTO t1 (col1) VALUES ('1a'); ERROR 01000: Data truncated for column 'col1' at row 1 INSERT IGNORE INTO t1 (col1) VALUES ('2a'); @@ -1135,9 +1135,9 @@ NULL 10 drop table t1; create table t1 (col1 date, col2 datetime, col3 timestamp); insert into t1 values (0,0,0); -ERROR 22007: Incorrect date value: '0' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '0' for column `test`.`t1`.`col1` at row 1 insert into t1 values (0.0,0.0,0.0); -ERROR 22007: Incorrect date value: '0.0' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '0.0' for column `test`.`t1`.`col1` at row 1 insert into t1 (col1) values (convert('0000-00-00',date)); ERROR 22007: Incorrect datetime value: '0000-00-00' insert into t1 (col1) values (cast('0000-00-00' as date)); @@ -1160,7 +1160,7 @@ insert ignore into t1 values ('0000-00-00'); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 insert into t1 select * from t1; -ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`col1` at row 1 insert ignore into t1 values ('0000-00-00'); Warnings: Warning 1264 Out of range value for column 'col1' at row 1 @@ -1168,15 +1168,15 @@ insert ignore into t1 (col1) values (cast('0000-00-00' as date)); Warnings: Warning 1292 Incorrect datetime value: '0000-00-00' insert into t1 select * from t1; -ERROR 22007: Incorrect date value: '0000-00-00' for column 'col1' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column ``.`(temporary)`.`col1` at row 1 alter table t1 modify col1 datetime; -ERROR 22007: Incorrect datetime value: '0000-00-00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00' for column `test`.`t1`.`col1` at row 1 alter ignore table t1 modify col1 datetime; Warnings: Warning 1264 Out of range value for column 'col1' at row 1 Warning 1264 Out of range value for column 'col1' at row 2 insert into t1 select * from t1; -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'col1' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column ``.`(temporary)`.`col1` at row 1 select * from t1; col1 0000-00-00 00:00:00 @@ -1256,12 +1256,12 @@ drop table t1; set @@sql_mode='traditional'; create table t1 (d date); insert into t1 values ('2000-10-00'); -ERROR 22007: Incorrect date value: '2000-10-00' for column 'd' at row 1 +ERROR 22007: Incorrect date value: '2000-10-00' for column `test`.`t1`.`d` at row 1 insert into t1 values (1000); -ERROR 22007: Incorrect date value: '1000' for column 'd' at row 1 +ERROR 22007: Incorrect date value: '1000' for column `test`.`t1`.`d` at row 1 insert into t1 values ('2000-10-01'); update t1 set d = 1100; -ERROR 22007: Incorrect date value: '1100' for column 'd' at row 1 +ERROR 22007: Incorrect date value: '1100' for column `test`.`t1`.`d` at row 1 select * from t1; d 2000-10-01 @@ -1457,34 +1457,34 @@ col5 mediumint, col6 mediumint unsigned, col7 int, col8 int unsigned, col9 bigint, col10 bigint unsigned); insert into t1(col1) values('-'); -ERROR 22007: Incorrect integer value: '-' for column 'col1' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col1` at row 1 insert into t1(col2) values('+'); -ERROR 22007: Incorrect integer value: '+' for column 'col2' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col2` at row 1 insert into t1(col3) values('-'); -ERROR 22007: Incorrect integer value: '-' for column 'col3' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col3` at row 1 insert into t1(col4) values('+'); -ERROR 22007: Incorrect integer value: '+' for column 'col4' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col4` at row 1 insert into t1(col5) values('-'); -ERROR 22007: Incorrect integer value: '-' for column 'col5' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col5` at row 1 insert into t1(col6) values('+'); -ERROR 22007: Incorrect integer value: '+' for column 'col6' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col6` at row 1 insert into t1(col7) values('-'); -ERROR 22007: Incorrect integer value: '-' for column 'col7' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col7` at row 1 insert into t1(col8) values('+'); -ERROR 22007: Incorrect integer value: '+' for column 'col8' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col8` at row 1 insert into t1(col9) values('-'); -ERROR 22007: Incorrect integer value: '-' for column 'col9' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`col9` at row 1 insert into t1(col10) values('+'); -ERROR 22007: Incorrect integer value: '+' for column 'col10' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`col10` at row 1 drop table t1; set sql_mode='traditional'; create table t1(a year); insert into t1 values ('-'); -ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1 insert into t1 values ('+'); -ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1 insert into t1 values (''); -ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1 insert into t1 values ('2000a'); ERROR 01000: Data truncated for column 'a' at row 1 insert into t1 values ('2E3x'); diff --git a/mysql-test/main/subselect.result b/mysql-test/main/subselect.result index 404d878a9ec..5b45fa08e1e 100644 --- a/mysql-test/main/subselect.result +++ b/mysql-test/main/subselect.result @@ -344,7 +344,7 @@ patient_uq clinic_uq explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index -1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` @@ -1441,7 +1441,7 @@ a explain extended select * from t2 where t2.a in (select a from t1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1451,7 +1451,7 @@ a explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1461,8 +1461,8 @@ a explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; @@ -1630,7 +1630,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<`test`.`t explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key +2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -7019,8 +7019,8 @@ SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY eq_ref distinct_key distinct_key 4 test.t2.c 1 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; diff --git a/mysql-test/main/subselect_exists2in.result b/mysql-test/main/subselect_exists2in.result index 95fc1c19b82..029ac22a486 100644 --- a/mysql-test/main/subselect_exists2in.result +++ b/mysql-test/main/subselect_exists2in.result @@ -142,6 +142,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c); create index idx_t1_2 on t1 (a1,a2,b); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date create table t2 ( a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' ' @@ -169,6 +170,7 @@ create index idx_t2_1 on t2 (a1,a2,b,c); create index idx_t2_2 on t2 (a1,a2,b); analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date create table t3 ( a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' ' @@ -230,6 +232,7 @@ create index idx_t3_1 on t3 (a1,a2,b,c); create index idx_t3_2 on t3 (a1,a2,b); analyze table t3; Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date explain select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 @@ -330,7 +333,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 -Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and (1,1 in ( (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), (1 in on distinct_key where 1 = ``.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` +Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and (1,1 in ((1 in on distinct_key where 1 = ``.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) 1 @@ -344,7 +347,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t2.b' of SELECT #3 was resolved in SELECT #2 -Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and (1,1 in ( (/* select#3 */ select `test`.`t3`.`c` from `test`.`t3` where `test`.`t3`.`c` is not null ), (1 in on distinct_key where 1 = ``.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` +Note 1003 /* select#1 */ select (/* select#2 */ select 1 from dual where !(1 is not null and (1,1 in ((1 in on distinct_key where 1 = ``.`c`))))) AS `( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) )` from `test`.`t1` SELECT ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) FROM t1; ( SELECT b FROM t2 WHERE NOT EXISTS ( SELECT c FROM t3 WHERE c = b ) ) 1 diff --git a/mysql-test/main/subselect_exists2in_costmat.result b/mysql-test/main/subselect_exists2in_costmat.result index 98a949ece6d..1c9574aafd3 100644 --- a/mysql-test/main/subselect_exists2in_costmat.result +++ b/mysql-test/main/subselect_exists2in_costmat.result @@ -65,7 +65,7 @@ Name LIKE 'L%') AND surfacearea > 1000000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country ALL Name,SurfaceArea NULL NULL NULL 239 Using where -2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4080 Using where +2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4079 Using where SELECT Name FROM Country WHERE (EXISTS (select 1 from City where City.Population > 100000 and Code = Country) OR diff --git a/mysql-test/main/subselect_extra.result b/mysql-test/main/subselect_extra.result index a3a0f1f9a15..edae4abfb3d 100644 --- a/mysql-test/main/subselect_extra.result +++ b/mysql-test/main/subselect_extra.result @@ -132,6 +132,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c); create index idx_t1_2 on t1 (a1,a2,b); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date create table t2 ( a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' ' @@ -159,6 +160,7 @@ create index idx_t2_1 on t2 (a1,a2,b,c); create index idx_t2_2 on t2 (a1,a2,b); analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date create table t3 ( a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' ' @@ -220,6 +222,7 @@ create index idx_t3_1 on t3 (a1,a2,b,c); create index idx_t3_2 on t3 (a1,a2,b); analyze table t3; Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date explain select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 @@ -302,6 +305,7 @@ INSERT INTO t1 SELECT a + 64,b FROM t1; INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT 1 FROM t1 WHERE a IN (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2)); diff --git a/mysql-test/main/subselect_extra_no_semijoin.result b/mysql-test/main/subselect_extra_no_semijoin.result index ec9ddb0452e..8aca24b6097 100644 --- a/mysql-test/main/subselect_extra_no_semijoin.result +++ b/mysql-test/main/subselect_extra_no_semijoin.result @@ -136,6 +136,7 @@ create index idx_t1_1 on t1 (a1,a2,b,c); create index idx_t1_2 on t1 (a1,a2,b); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date create table t2 ( a1 char(64), a2 char(64) not null, b char(16), c char(16), d char(16), dummy char(64) default ' ' @@ -163,6 +164,7 @@ create index idx_t2_1 on t2 (a1,a2,b,c); create index idx_t2_2 on t2 (a1,a2,b); analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status Table is already up to date create table t3 ( a1 char(1), a2 char(1), b char(1), c char(4) not null, d char(3), dummy char(1) default ' ' @@ -224,6 +226,7 @@ create index idx_t3_1 on t3 (a1,a2,b,c); create index idx_t3_2 on t3 (a1,a2,b); analyze table t3; Table Op Msg_type Msg_text +test.t3 analyze status Engine-independent statistics collected test.t3 analyze status Table is already up to date explain select a1,a2,b,c,min(c), max(c) from t1 where exists ( select * from t2 @@ -306,6 +309,7 @@ INSERT INTO t1 SELECT a + 64,b FROM t1; INSERT INTO t1 SELECT a + 128,b FROM t1 limit 16; ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK EXPLAIN SELECT 1 FROM t1 WHERE a IN (SELECT a FROM t1 USE INDEX (i2) IGNORE INDEX (i2)); diff --git a/mysql-test/main/subselect_innodb.result b/mysql-test/main/subselect_innodb.result index ec7f2c0a3d5..799adf1d116 100644 --- a/mysql-test/main/subselect_innodb.result +++ b/mysql-test/main/subselect_innodb.result @@ -561,6 +561,7 @@ update t2 set key2=key1; alter table t2 add key(key2); analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK flush tables; # Table tsubq must use 'ref' + Using filesort (not 'index' w/o filesort) diff --git a/mysql-test/main/subselect_mat.result b/mysql-test/main/subselect_mat.result index 010ba03153b..732024bb607 100644 --- a/mysql-test/main/subselect_mat.result +++ b/mysql-test/main/subselect_mat.result @@ -1667,8 +1667,8 @@ DROP TABLE t1,t2,t3,t4,t5; CREATE TABLE t2 (a int); INSERT IGNORE INTO t2 VALUES ('a'),('a'); Warnings: -Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'a' at row 2 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`a` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`a` at row 2 CREATE TABLE t4 (a varchar(1)); INSERT INTO t4 VALUES ('m'),('o'); CREATE TABLE t3 (a varchar(1) , b varchar(1) ) ; @@ -2526,7 +2526,7 @@ select * from t1 where (a,b) in (select max(a),b from t2 group by b); show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%'; Variable_name Value Handler_read_first 0 -Handler_read_key 5000 +Handler_read_key 5004 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 diff --git a/mysql-test/main/subselect_mat_cost.result b/mysql-test/main/subselect_mat_cost.result index daf8d18534c..39ccc93936f 100644 --- a/mysql-test/main/subselect_mat_cost.result +++ b/mysql-test/main/subselect_mat_cost.result @@ -67,7 +67,7 @@ Name LIKE 'L%') AND surfacearea > 1000000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country ALL Name,SurfaceArea NULL NULL NULL 239 Using where -2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4080 Using where +2 MATERIALIZED City ALL Population,Country NULL NULL NULL 4079 Using where SELECT Name FROM Country WHERE (Code IN (select Country from City where City.Population > 100000) OR Name LIKE 'L%') AND @@ -113,7 +113,7 @@ Name LIKE 'L%') AND surfacearea > 10*1000000; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country range Name,SurfaceArea SurfaceArea 4 NULL 5 Using index condition; Using where; Rowid-ordered scan -2 DEPENDENT SUBQUERY City index_subquery Population,Country Country 3 func 18 Using where +2 DEPENDENT SUBQUERY City index_subquery Population,Country Country 3 func 17 Using where SELECT Name FROM Country WHERE (Code IN (select Country from City where City.Population > 100000) OR Name LIKE 'L%') AND @@ -135,7 +135,7 @@ Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND City.name LIKE '%Island%'); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where -1 PRIMARY City ref Country Country 3 world.Country.Code 18 Using where +1 PRIMARY City ref Country Country 3 world.Country.Code 17 Using where 2 MATERIALIZED CountryLanguage ALL Percentage,Language NULL NULL NULL 984 Using where SELECT * FROM Country, City @@ -160,7 +160,7 @@ Country.SurfaceArea < 3000 AND Country.SurfaceArea > 10 AND Country.name LIKE '%Island%'); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where -1 PRIMARY City ref Country Country 3 world.Country.Code 18 +1 PRIMARY City ref Country Country 3 world.Country.Code 17 2 DEPENDENT SUBQUERY CountryLanguage index_subquery Percentage,Language Language 30 func 2 Using where SELECT * FROM Country, City @@ -205,7 +205,7 @@ OR (select Country, Language from CountryLanguage)); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country ALL PRIMARY,SurfaceArea NULL NULL NULL 239 Using where -1 PRIMARY City ref Country Country 3 world.Country.Code 18 Using where +1 PRIMARY City ref Country Country 3 world.Country.Code 17 Using where 3 MATERIALIZED CountryLanguage index PRIMARY,Language PRIMARY 33 NULL 984 Using index 2 DEPENDENT SUBQUERY CountryLanguage unique_subquery PRIMARY,Percentage,Language PRIMARY 33 func,func 1 Using where SELECT City.Name, Country.Name @@ -234,7 +234,7 @@ select count(*) from City where City.id not in (select capital from Country where capital is not null and population < 100000); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY City index NULL PRIMARY 4 NULL 4080 Using where; Using index +1 PRIMARY City index NULL PRIMARY 4 NULL 4079 Using where; Using index 2 MATERIALIZED Country ALL NULL NULL NULL NULL 239 Using where Q2.2e: @@ -373,7 +373,7 @@ FROM City LEFT JOIN Country ON (Country = Code) HAVING City.Name LIKE "Santa%"); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY CountryLanguage index NULL PRIMARY 33 NULL 984 Using where; Using index -2 MATERIALIZED City ALL NULL NULL NULL NULL 4080 +2 MATERIALIZED City ALL NULL NULL NULL NULL 4079 2 MATERIALIZED Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using index select count(*) from CountryLanguage @@ -431,7 +431,7 @@ capital is null); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country ALL NULL NULL NULL NULL 239 Using where 1 PRIMARY City eq_ref PRIMARY PRIMARY 4 world.Country.Capital 1 Using where -2 MATERIALIZED City index NULL CityName 35 NULL 4080 Using index +2 MATERIALIZED City index NULL CityName 35 NULL 4079 Using index select * from Country, City where capital = id and (City.name in (SELECT name FROM City @@ -452,7 +452,7 @@ WHERE Country.Code NOT IN (SELECT Country FROM City GROUP BY Name HAVING COUNT(Name) = 1); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country ALL NULL NULL NULL NULL 239 Using where -2 MATERIALIZED City ALL NULL NULL NULL NULL 4080 Using temporary +2 MATERIALIZED City ALL NULL NULL NULL NULL 4079 Using temporary SELECT Name FROM Country WHERE Country.Code NOT IN @@ -515,7 +515,7 @@ GROUP BY City.Name HAVING City.Name IN (select Name from Country where population < 1000000); id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY Country index PRIMARY PRIMARY 3 NULL 239 Using index; Using temporary; Using filesort -1 PRIMARY City ref Country Country 3 world.Country.Code 18 +1 PRIMARY City ref Country Country 3 world.Country.Code 17 2 MATERIALIZED Country ALL Name NULL NULL NULL 239 Using where SELECT City.Name, City.Population FROM City JOIN Country ON City.Country = Country.Code @@ -540,7 +540,7 @@ SELECT Name, round(Population/1000) FROM City WHERE Country = "IND" AND Population < 100000); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY City ALL NULL NULL NULL NULL 4080 Using where +1 PRIMARY City ALL NULL NULL NULL NULL 4079 Using where 2 DEPENDENT SUBQUERY City ref Population,Country,CityName CityName 35 func 1 Using where 3 DEPENDENT UNION City ref Population,Country,CityName CityName 35 func 1 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL diff --git a/mysql-test/main/subselect_mat_cost_bugs.result b/mysql-test/main/subselect_mat_cost_bugs.result index 6377ae556d2..2c696ed36fd 100644 --- a/mysql-test/main/subselect_mat_cost_bugs.result +++ b/mysql-test/main/subselect_mat_cost_bugs.result @@ -310,6 +310,7 @@ create index key3 on t2 (kp2); SET @@optimizer_switch='materialization=off,semijoin=off,in_to_exists=on'; analyze table t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select c1 from t1 where c1 in (select kp1 from t2 where kp2 = 10 and c2 = 4) or c1 > 7; diff --git a/mysql-test/main/subselect_no_exists_to_in.result b/mysql-test/main/subselect_no_exists_to_in.result index 6463aa4e4e2..6f8f8716812 100644 --- a/mysql-test/main/subselect_no_exists_to_in.result +++ b/mysql-test/main/subselect_no_exists_to_in.result @@ -1445,7 +1445,7 @@ a explain extended select * from t2 where t2.a in (select a from t1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1455,7 +1455,7 @@ a explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1465,8 +1465,8 @@ a explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; @@ -1634,7 +1634,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<`test`.`t explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key +2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -7019,8 +7019,8 @@ SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY eq_ref distinct_key distinct_key 4 test.t2.c 1 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; diff --git a/mysql-test/main/subselect_no_mat.result b/mysql-test/main/subselect_no_mat.result index 0fa338ef222..01d8c0edeb3 100644 --- a/mysql-test/main/subselect_no_mat.result +++ b/mysql-test/main/subselect_no_mat.result @@ -351,7 +351,7 @@ patient_uq clinic_uq explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index -1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` @@ -1448,7 +1448,7 @@ a explain extended select * from t2 where t2.a in (select a from t1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1458,7 +1458,7 @@ a explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1468,8 +1468,8 @@ a explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; @@ -1637,7 +1637,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<`test`.`t explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key +2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!<`test`.`t1`.`s1`>((`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null))))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; diff --git a/mysql-test/main/subselect_no_opts.result b/mysql-test/main/subselect_no_opts.result index 7704667a2dc..dc397cd5451 100644 --- a/mysql-test/main/subselect_no_opts.result +++ b/mysql-test/main/subselect_no_opts.result @@ -1633,7 +1633,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(`test`. explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key +2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -7010,8 +7010,8 @@ SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY eq_ref distinct_key distinct_key 4 test.t2.c 1 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; diff --git a/mysql-test/main/subselect_no_scache.result b/mysql-test/main/subselect_no_scache.result index af1157321e2..7bd3853208c 100644 --- a/mysql-test/main/subselect_no_scache.result +++ b/mysql-test/main/subselect_no_scache.result @@ -350,7 +350,7 @@ patient_uq clinic_uq explain extended select * from t6 where exists (select * from t7 where uq = clinic_uq); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t7 index PRIMARY PRIMARY 4 NULL 2 100.00 Using index -1 PRIMARY t6 ALL i1 NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t6 ALL i1 NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) Warnings: Note 1276 Field or reference 'test.t6.clinic_uq' of SELECT #2 was resolved in SELECT #1 Note 1003 select `test`.`t6`.`patient_uq` AS `patient_uq`,`test`.`t6`.`clinic_uq` AS `clinic_uq` from `test`.`t7` join `test`.`t6` where `test`.`t6`.`clinic_uq` = `test`.`t7`.`uq` @@ -1447,7 +1447,7 @@ a explain extended select * from t2 where t2.a in (select a from t1); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 index PRIMARY PRIMARY 4 NULL 4 75.00 Using where; Using index; Using join buffer (flat, BNL join) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using index Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` select * from t2 where t2.a in (select a from t1 where t1.b <> 30); @@ -1457,7 +1457,7 @@ a explain extended select * from t2 where t2.a in (select a from t1 where t1.b <> 30); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 Using where Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a` = `test`.`t2`.`a` and `test`.`t1`.`b` <> 30 select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); @@ -1467,8 +1467,8 @@ a explain extended select * from t2 where t2.a in (select t1.a from t1,t3 where t1.b=t3.a); id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t2 index PRIMARY PRIMARY 4 NULL 4 100.00 Using index -1 PRIMARY t1 ALL PRIMARY NULL NULL NULL 4 75.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.b 1 100.00 Using index +1 PRIMARY t1 eq_ref PRIMARY PRIMARY 4 test.t2.a 1 100.00 +1 PRIMARY t3 index PRIMARY PRIMARY 4 NULL 3 100.00 Using where; Using index; Using join buffer (flat, BNL join) Warnings: Note 1003 select `test`.`t2`.`a` AS `a` from `test`.`t1` join `test`.`t3` join `test`.`t2` where `test`.`t3`.`a` = `test`.`t1`.`b` and `test`.`t1`.`a` = `test`.`t2`.`a` drop table t1, t2, t3; @@ -1636,7 +1636,7 @@ Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(`test`. explain extended select s1, s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2') from t1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 index NULL s1 6 NULL 3 100.00 Using index -2 SUBQUERY t2 index_subquery s1 s1 6 func 2 100.00 Using index; Using where; Full scan on NULL key +2 SUBQUERY t2 index_subquery s1 s1 6 func 2 50.00 Using index; Using where; Full scan on NULL key Warnings: Note 1003 /* select#1 */ select `test`.`t1`.`s1` AS `s1`,!(`test`.`t1`.`s1`,(((`test`.`t1`.`s1`) in t2 on s1 checking NULL where `test`.`t2`.`s1` < 'a2' having trigcond(`test`.`t2`.`s1` is null)))) AS `s1 NOT IN (SELECT s1 FROM t2 WHERE s1 < 'a2')` from `test`.`t1` drop table t1,t2; @@ -7025,8 +7025,8 @@ SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY eq_ref distinct_key distinct_key 4 test.t2.c 1 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; diff --git a/mysql-test/main/subselect_no_semijoin.result b/mysql-test/main/subselect_no_semijoin.result index 13f4cb8b2b5..9eccf868237 100644 --- a/mysql-test/main/subselect_no_semijoin.result +++ b/mysql-test/main/subselect_no_semijoin.result @@ -7010,8 +7010,8 @@ SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY t1 index a a 5 NULL 2 Using where; Using index -2 SUBQUERY ALL distinct_key NULL NULL NULL 1 -2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where; Using join buffer (flat, BNL join) +2 SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +2 SUBQUERY eq_ref distinct_key distinct_key 4 test.t2.c 1 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 2 SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t2 WHERE c IN (SELECT MAX(d) FROM t3)) OR a = 10; diff --git a/mysql-test/main/subselect_sj.result b/mysql-test/main/subselect_sj.result index c12bad5affa..aef3ec17c10 100644 --- a/mysql-test/main/subselect_sj.result +++ b/mysql-test/main/subselect_sj.result @@ -3095,7 +3095,9 @@ insert into t2 select b+10 from t2; insert into t2 select b+10 from t2; analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select a from t1, t2 where b between 1 and 2 and a in (select b from t2); diff --git a/mysql-test/main/subselect_sj2_mat.result b/mysql-test/main/subselect_sj2_mat.result index 884451d7dff..78df07667f9 100644 --- a/mysql-test/main/subselect_sj2_mat.result +++ b/mysql-test/main/subselect_sj2_mat.result @@ -1853,18 +1853,18 @@ AND t3.id_product IN (SELECT id_product FROM t2 t2_3 WHERE t2_3.id_t2 = 18 OR t2 AND t3.id_product IN (SELECT id_product FROM t2 t2_4 WHERE t2_4.id_t2 = 34 OR t2_4.id_t2 = 23) AND t3.id_product IN (SELECT id_product FROM t2 t2_5 WHERE t2_5.id_t2 = 29 OR t2_5.id_t2 = 28 OR t2_5.id_t2 = 26); id select_type table type possible_keys key key_len ref rows Extra -1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using index -1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t1.id_product 1 Using index +1 PRIMARY ALL distinct_key NULL NULL NULL 12 +1 PRIMARY t3 eq_ref PRIMARY PRIMARY 4 test.t2_2.id_product 1 Using where; Using index 1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where -1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t1.id_product,const 1 Using where; Using index -1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where 1 PRIMARY t5 ALL NULL NULL NULL NULL 18 Using where; Using join buffer (flat, BNL join) +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t4 eq_ref PRIMARY PRIMARY 8 test.t3.id_product,const 1 Using where; Using index +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY eq_ref distinct_key distinct_key 4 func 1 Using where +1 PRIMARY t1 index NULL PRIMARY 8 NULL 73 Using where; Using index; Using join buffer (flat, BNL join) +3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12 Using where 5 MATERIALIZED t2_4 range id_t2,id_product id_t2 5 NULL 18 Using index condition; Using where -4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 32 Using index condition; Using where -3 MATERIALIZED t2_2 ref id_t2,id_product id_t2 5 const 12 -2 MATERIALIZED t2_1 ref id_t2,id_product id_t2 5 const 50 6 MATERIALIZED t2_5 range id_t2,id_product id_t2 5 NULL 30 Using index condition; Using where +2 MATERIALIZED t2_1 ref id_t2,id_product id_t2 5 const 50 +4 MATERIALIZED t2_3 range id_t2,id_product id_t2 5 NULL 32 Using index condition; Using where drop table t1,t2,t3,t4,t5; diff --git a/mysql-test/main/subselect_sj_jcl6.result b/mysql-test/main/subselect_sj_jcl6.result index e31f4f3a1cc..cdc6f99d133 100644 --- a/mysql-test/main/subselect_sj_jcl6.result +++ b/mysql-test/main/subselect_sj_jcl6.result @@ -3109,7 +3109,9 @@ insert into t2 select b+10 from t2; insert into t2 select b+10 from t2; analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK explain select a from t1, t2 where b between 1 and 2 and a in (select b from t2); diff --git a/mysql-test/main/subselect_sj_mat.result b/mysql-test/main/subselect_sj_mat.result index 983c6c31c65..a494b9d1cf7 100644 --- a/mysql-test/main/subselect_sj_mat.result +++ b/mysql-test/main/subselect_sj_mat.result @@ -302,7 +302,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 func,func 1 100.00 1 PRIMARY eq_ref distinct_key distinct_key 16 func,func 1 100.00 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -3 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join) +3 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where Warnings: Note 1003 select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2` from `test`.`t1` semi join (`test`.`t2`) semi join (`test`.`t2i` join `test`.`t3`) where `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and `test`.`t2`.`b1` > '0' and `test`.`t3`.`c2` > '0' @@ -344,7 +344,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 func,func 1 100.00 1 PRIMARY eq_ref distinct_key distinct_key 16 func,func 1 100.00 5 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -5 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join) +5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index 2 MATERIALIZED t2 ALL NULL NULL NULL NULL 5 100.00 Using where 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where 3 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where @@ -370,7 +370,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key distinct_key 16 func,func 1 100.00 1 PRIMARY t2 ALL NULL NULL NULL NULL 5 100.00 Using where; Start temporary; End temporary; Using join buffer (flat, BNL join) 5 MATERIALIZED t3c ALL NULL NULL NULL NULL 4 100.00 Using where -5 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join) +5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3c.c1,test.t3c.c2 2 100.00 Using index 4 MATERIALIZED t3b ALL NULL NULL NULL NULL 4 100.00 Using where 3 DEPENDENT SUBQUERY t3a ALL NULL NULL NULL NULL 4 100.00 Using where Warnings: @@ -403,7 +403,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY eq_ref distinct_key # # # 1 100.00 # 1 PRIMARY eq_ref distinct_key # # # 1 100.00 # 5 MATERIALIZED t3 ALL NULL # # # 4 100.00 # -5 MATERIALIZED t2i index it2i1,it2i2,it2i3 # # # 5 80.00 # +5 MATERIALIZED t2i ref it2i1,it2i2,it2i3 # # # 2 100.00 # 2 MATERIALIZED t2 ALL NULL # # # 5 100.00 # 4 MATERIALIZED t3 ALL NULL # # # 4 100.00 # 3 MATERIALIZED t3 ALL NULL # # # 4 100.00 # @@ -438,7 +438,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 1 PRIMARY eq_ref distinct_key distinct_key 16 func,func 1 100.00 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -4 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join) +4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL @@ -459,15 +459,15 @@ where (c1, c2) in (select b1, b2 from t2i where b2 > '0')) and a1 = c1; id select_type table type possible_keys key key_len ref rows filtered Extra 1 PRIMARY t1 ALL NULL NULL NULL NULL 3 100.00 Using where +1 PRIMARY ALL distinct_key NULL NULL NULL 4 100.00 Using where 1 PRIMARY t3 ALL NULL NULL NULL NULL 4 100.00 Using where; Using join buffer (flat, BNL join) -1 PRIMARY eq_ref distinct_key distinct_key 16 func,func 1 100.00 4 MATERIALIZED t3 ALL NULL NULL NULL NULL 4 100.00 Using where -4 MATERIALIZED t2i index it2i1,it2i2,it2i3 it2i3 18 NULL 5 80.00 Using where; Using index; Using join buffer (flat, BNL join) +4 MATERIALIZED t2i ref it2i1,it2i2,it2i3 it2i3 18 test.t3.c1,test.t3.c2 2 100.00 Using index 2 DEPENDENT SUBQUERY t1 ALL NULL NULL NULL NULL 3 100.00 Using where 3 DEPENDENT UNION t2 ALL NULL NULL NULL NULL 5 100.00 Using where NULL UNION RESULT ALL NULL NULL NULL NULL NULL NULL Warnings: -Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(/* select#2 */ select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and (`test`.`t1`.`a1`) = `test`.`t1`.`a1` and (`test`.`t1`.`a2`) = `test`.`t1`.`a2` union /* select#3 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and (`test`.`t1`.`a1`) = `test`.`t2`.`b1` and (`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0' +Note 1003 /* select#1 */ select `test`.`t1`.`a1` AS `a1`,`test`.`t1`.`a2` AS `a2`,`test`.`t3`.`c1` AS `c1`,`test`.`t3`.`c2` AS `c2` from `test`.`t1` semi join (`test`.`t2i` join `test`.`t3`) join `test`.`t3` where `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b1` = `test`.`t3`.`c1` and `test`.`t3`.`c1` = `test`.`t1`.`a1` and `test`.`t2i`.`b2` = `test`.`t3`.`c2` and `test`.`t3`.`c2` = `test`.`t3`.`c2` and <`test`.`t1`.`a1`,`test`.`t1`.`a2`>(((`test`.`t1`.`a1`,`test`.`t1`.`a2`),(/* select#2 */ select `test`.`t1`.`a1`,`test`.`t1`.`a2` from `test`.`t1` where `test`.`t1`.`a1` > '0' and (`test`.`t1`.`a1`) = `test`.`t1`.`a1` and (`test`.`t1`.`a2`) = `test`.`t1`.`a2` union /* select#3 */ select `test`.`t2`.`b1`,`test`.`t2`.`b2` from `test`.`t2` where `test`.`t2`.`b1` < '9' and (`test`.`t1`.`a1`) = `test`.`t2`.`b1` and (`test`.`t1`.`a2`) = `test`.`t2`.`b2`))) and `test`.`t3`.`c2` > '0' select * from t1, t3 where (a1, a2) in (select * from t1 where a1 > '0' UNION select * from t2 where b1 < '9') and (c1, c2) in (select c1, c2 from t3 @@ -1704,8 +1704,8 @@ DROP TABLE t1,t2,t3,t4,t5; CREATE TABLE t2 (a int); INSERT IGNORE INTO t2 VALUES ('a'),('a'); Warnings: -Warning 1366 Incorrect integer value: 'a' for column 'a' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'a' at row 2 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`a` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`a` at row 2 CREATE TABLE t4 (a varchar(1)); INSERT INTO t4 VALUES ('m'),('o'); CREATE TABLE t3 (a varchar(1) , b varchar(1) ) ; @@ -2566,7 +2566,7 @@ select * from t1 where (a,b) in (select max(a),b from t2 group by b); show status where Variable_name like 'Handler_read%' or Variable_name like 'Handler_%write%'; Variable_name Value Handler_read_first 0 -Handler_read_key 5000 +Handler_read_key 5004 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 diff --git a/mysql-test/main/system_mysql_db.result b/mysql-test/main/system_mysql_db.result index a4c414888ca..e7cd9bc628b 100644 --- a/mysql-test/main/system_mysql_db.result +++ b/mysql-test/main/system_mysql_db.result @@ -6,6 +6,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -60,57 +61,8 @@ db CREATE TABLE `db` ( KEY `User` (`User`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Database privileges' show create table user; -Table Create Table -user CREATE TABLE `user` ( - `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', - `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `Password` char(41) CHARACTER SET latin1 COLLATE latin1_bin NOT NULL DEFAULT '', - `Select_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Insert_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Update_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Drop_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Reload_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Shutdown_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Process_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `File_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Grant_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `References_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Index_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_db_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Super_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tmp_table_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Lock_tables_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Execute_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Repl_slave_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Repl_client_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Show_view_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Alter_routine_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_user_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Event_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Trigger_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Create_tablespace_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `Delete_history_priv` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `ssl_type` enum('','ANY','X509','SPECIFIED') CHARACTER SET utf8 NOT NULL DEFAULT '', - `ssl_cipher` blob NOT NULL, - `x509_issuer` blob NOT NULL, - `x509_subject` blob NOT NULL, - `max_questions` int(11) unsigned NOT NULL DEFAULT 0, - `max_updates` int(11) unsigned NOT NULL DEFAULT 0, - `max_connections` int(11) unsigned NOT NULL DEFAULT 0, - `max_user_connections` int(11) NOT NULL DEFAULT 0, - `plugin` char(64) CHARACTER SET latin1 NOT NULL DEFAULT '', - `authentication_string` text COLLATE utf8_bin NOT NULL, - `password_expired` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `is_role` enum('N','Y') CHARACTER SET utf8 NOT NULL DEFAULT 'N', - `default_role` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', - `max_statement_time` decimal(12,6) NOT NULL DEFAULT 0.000000, - PRIMARY KEY (`Host`,`User`) -) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' +View Create View character_set_client collation_connection +user CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `user` AS select `global_priv`.`Host` AS `Host`,`global_priv`.`User` AS `User`,if(json_value(`global_priv`.`Priv`,'$.plugin') in ('mysql_native_password','mysql_old_password'),ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),''),'') AS `Password`,if(json_value(`global_priv`.`Priv`,'$.access') & 1,'Y','N') AS `Select_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2,'Y','N') AS `Insert_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4,'Y','N') AS `Update_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8,'Y','N') AS `Delete_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16,'Y','N') AS `Create_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32,'Y','N') AS `Drop_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 64,'Y','N') AS `Reload_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 128,'Y','N') AS `Shutdown_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 256,'Y','N') AS `Process_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 512,'Y','N') AS `File_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1024,'Y','N') AS `Grant_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2048,'Y','N') AS `References_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4096,'Y','N') AS `Index_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8192,'Y','N') AS `Alter_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16384,'Y','N') AS `Show_db_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 32768,'Y','N') AS `Super_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 65536,'Y','N') AS `Create_tmp_table_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 131072,'Y','N') AS `Lock_tables_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 262144,'Y','N') AS `Execute_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 524288,'Y','N') AS `Repl_slave_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 1048576,'Y','N') AS `Repl_client_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 2097152,'Y','N') AS `Create_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 4194304,'Y','N') AS `Show_view_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 8388608,'Y','N') AS `Create_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 16777216,'Y','N') AS `Alter_routine_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 33554432,'Y','N') AS `Create_user_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 67108864,'Y','N') AS `Event_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 134217728,'Y','N') AS `Trigger_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 268435456,'Y','N') AS `Create_tablespace_priv`,if(json_value(`global_priv`.`Priv`,'$.access') & 536870912,'Y','N') AS `Delete_history_priv`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.ssl_type'),0) + 1,'','ANY','X509','SPECIFIED') AS `ssl_type`,ifnull(json_value(`global_priv`.`Priv`,'$.ssl_cipher'),'') AS `ssl_cipher`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_issuer'),'') AS `x509_issuer`,ifnull(json_value(`global_priv`.`Priv`,'$.x509_subject'),'') AS `x509_subject`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_questions'),0) as unsigned) AS `max_questions`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_updates'),0) as unsigned) AS `max_updates`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_connections'),0) as unsigned) AS `max_connections`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_user_connections'),0) as signed) AS `max_user_connections`,ifnull(json_value(`global_priv`.`Priv`,'$.plugin'),'') AS `plugin`,ifnull(json_value(`global_priv`.`Priv`,'$.authentication_string'),'') AS `authentication_string`,'N' AS `password_expired`,elt(ifnull(json_value(`global_priv`.`Priv`,'$.is_role'),0) + 1,'N','Y') AS `is_role`,ifnull(json_value(`global_priv`.`Priv`,'$.default_role'),'') AS `default_role`,cast(ifnull(json_value(`global_priv`.`Priv`,'$.max_statement_time'),0.0) as decimal(12,6)) AS `max_statement_time` from `global_priv` latin1 latin1_swedish_ci show create table func; Table Create Table func CREATE TABLE `func` ( @@ -120,6 +72,14 @@ func CREATE TABLE `func` ( `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions' +show create table global_priv; +Table Create Table +global_priv CREATE TABLE `global_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)), + PRIMARY KEY (`Host`,`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( @@ -191,7 +151,7 @@ proc CREATE TABLE `proc` ( `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, @@ -217,7 +177,7 @@ event CREATE TABLE `event` ( `ends` datetime DEFAULT NULL, `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', diff --git a/mysql-test/main/no_password_column-mdev-11170.result b/mysql-test/main/system_mysql_db_507.result similarity index 93% rename from mysql-test/main/no_password_column-mdev-11170.result rename to mysql-test/main/system_mysql_db_507.result index 6195100436d..1fa4af66719 100644 --- a/mysql-test/main/no_password_column-mdev-11170.result +++ b/mysql-test/main/system_mysql_db_507.result @@ -3,8 +3,6 @@ # Fatal error: mysql.user table is damaged or in # unsupported 3.20 format # -create table backup_user like mysql.user; -insert into backup_user select * from mysql.user; # # Original mysql.user table # @@ -60,7 +58,12 @@ max_statement_time decimal(12,6) NO 0.000000 # # Drop the password column. # -alter table mysql.user drop column password; +alter table mysql.user drop column password, +drop column is_role, +drop column default_role, +add column password_last_changed timestamp null default null after password_expired, +add column password_lifetime smallint unsigned after password_last_changed, +add column account_locked enum('n','y') character set utf8 not null default 'n' after password_lifetime; flush privileges; # # Create users without the password column present. @@ -87,7 +90,7 @@ select user, host, select_priv, plugin, authentication_string from mysql.user where user like "%oo" order by user; user host select_priv plugin authentication_string -foo % N +foo % N mysql_native_password goo % N mysql_native_password *F3A2A51A9B0F2BE2468926B4132313728C250DBF ioo % N mysql_old_password 7a8f886d28473e85 # @@ -164,6 +167,3 @@ ioo % Y mysql_old_password 7a8f886d28473e85 # # Reset to final original state. # -drop table mysql.user; -rename table backup_user to mysql.user; -flush privileges; diff --git a/mysql-test/main/no_password_column-mdev-11170.test b/mysql-test/main/system_mysql_db_507.test similarity index 77% rename from mysql-test/main/no_password_column-mdev-11170.test rename to mysql-test/main/system_mysql_db_507.test index 2cc4ba82ee8..b57a2a09c8e 100644 --- a/mysql-test/main/no_password_column-mdev-11170.test +++ b/mysql-test/main/system_mysql_db_507.test @@ -5,9 +5,7 @@ --echo # unsupported 3.20 format --echo # - -create table backup_user like mysql.user; -insert into backup_user select * from mysql.user; +--source include/switch_to_mysql_user.inc --echo # --echo # Original mysql.user table @@ -17,7 +15,12 @@ describe mysql.user; --echo # --echo # Drop the password column. --echo # -alter table mysql.user drop column password; +alter table mysql.user drop column password, + drop column is_role, + drop column default_role, + add column password_last_changed timestamp null default null after password_expired, + add column password_lifetime smallint unsigned after password_last_changed, + add column account_locked enum('n','y') character set utf8 not null default 'n' after password_lifetime; flush privileges; --echo # @@ -85,11 +88,7 @@ select user, host, select_priv, plugin, authentication_string from mysql.user where user like "%oo" order by user; - --echo # --echo # Reset to final original state. --echo # -drop table mysql.user; -rename table backup_user to mysql.user; - -flush privileges; +--source include/switch_to_mysql_global_priv.inc diff --git a/mysql-test/main/system_mysql_db_fix40123.result b/mysql-test/main/system_mysql_db_fix40123.result index d76a2ef923e..c4c4d3df706 100644 --- a/mysql-test/main/system_mysql_db_fix40123.result +++ b/mysql-test/main/system_mysql_db_fix40123.result @@ -6,6 +6,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -121,6 +122,14 @@ func CREATE TABLE `func` ( `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions' +show create table global_priv; +Table Create Table +global_priv CREATE TABLE `global_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)), + PRIMARY KEY (`Host`,`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( @@ -192,7 +201,7 @@ proc CREATE TABLE `proc` ( `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, @@ -218,7 +227,7 @@ event CREATE TABLE `event` ( `ends` datetime DEFAULT NULL, `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', diff --git a/mysql-test/main/system_mysql_db_fix40123.test b/mysql-test/main/system_mysql_db_fix40123.test index 2d17a0964e5..3f313c4ec1f 100644 --- a/mysql-test/main/system_mysql_db_fix40123.test +++ b/mysql-test/main/system_mysql_db_fix40123.test @@ -72,7 +72,7 @@ CREATE TABLE time_zone_leap_second ( Transition_time bigint signed NOT NULL, -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv; -- enable_query_log diff --git a/mysql-test/main/system_mysql_db_fix50030.result b/mysql-test/main/system_mysql_db_fix50030.result index fdc708db313..3a79afb04f0 100644 --- a/mysql-test/main/system_mysql_db_fix50030.result +++ b/mysql-test/main/system_mysql_db_fix50030.result @@ -6,6 +6,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -121,6 +122,14 @@ func CREATE TABLE `func` ( `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions' +show create table global_priv; +Table Create Table +global_priv CREATE TABLE `global_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)), + PRIMARY KEY (`Host`,`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( @@ -192,7 +201,7 @@ proc CREATE TABLE `proc` ( `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, @@ -218,7 +227,7 @@ event CREATE TABLE `event` ( `ends` datetime DEFAULT NULL, `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', diff --git a/mysql-test/main/system_mysql_db_fix50030.test b/mysql-test/main/system_mysql_db_fix50030.test index 9506c3465e7..33dcc873615 100644 --- a/mysql-test/main/system_mysql_db_fix50030.test +++ b/mysql-test/main/system_mysql_db_fix50030.test @@ -79,7 +79,7 @@ INSERT INTO servers VALUES ('test','localhost','test','root','', 0,'','mysql','r -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv; -- enable_query_log diff --git a/mysql-test/main/system_mysql_db_fix50117.result b/mysql-test/main/system_mysql_db_fix50117.result index d76a2ef923e..c4c4d3df706 100644 --- a/mysql-test/main/system_mysql_db_fix50117.result +++ b/mysql-test/main/system_mysql_db_fix50117.result @@ -6,6 +6,7 @@ db event func general_log +global_priv gtid_slave_pos help_category help_keyword @@ -121,6 +122,14 @@ func CREATE TABLE `func` ( `type` enum('function','aggregate') CHARACTER SET utf8 NOT NULL, PRIMARY KEY (`name`) ) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='User defined functions' +show create table global_priv; +Table Create Table +global_priv CREATE TABLE `global_priv` ( + `Host` char(60) COLLATE utf8_bin NOT NULL DEFAULT '', + `User` char(80) COLLATE utf8_bin NOT NULL DEFAULT '', + `Priv` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_bin NOT NULL DEFAULT '{}' CHECK (json_valid(`Priv`)), + PRIMARY KEY (`Host`,`User`) +) ENGINE=Aria DEFAULT CHARSET=utf8 COLLATE=utf8_bin PAGE_CHECKSUM=1 TRANSACTIONAL=1 COMMENT='Users and global privileges' show create table tables_priv; Table Create Table tables_priv CREATE TABLE `tables_priv` ( @@ -192,7 +201,7 @@ proc CREATE TABLE `proc` ( `definer` char(141) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `created` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), `modified` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', `comment` text CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, `character_set_client` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, `collation_connection` char(32) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL, @@ -218,7 +227,7 @@ event CREATE TABLE `event` ( `ends` datetime DEFAULT NULL, `status` enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL DEFAULT 'ENABLED', `on_completion` enum('DROP','PRESERVE') NOT NULL DEFAULT 'DROP', - `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NOT NULL DEFAULT '', + `sql_mode` set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NOT NULL DEFAULT '', `comment` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '', `originator` int(10) unsigned NOT NULL, `time_zone` char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', diff --git a/mysql-test/main/system_mysql_db_fix50117.test b/mysql-test/main/system_mysql_db_fix50117.test index f8bef3da162..2fe6869d761 100644 --- a/mysql-test/main/system_mysql_db_fix50117.test +++ b/mysql-test/main/system_mysql_db_fix50117.test @@ -96,7 +96,7 @@ CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_b -- disable_query_log # Drop all tables created by this test -DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos; +DROP TABLE db, host, user, func, plugin, tables_priv, columns_priv, procs_priv, servers, help_category, help_keyword, help_relation, help_topic, proc, time_zone, time_zone_leap_second, time_zone_name, time_zone_transition, time_zone_transition_type, general_log, slow_log, event, proxies_priv, innodb_index_stats, innodb_table_stats, transaction_registry, table_stats, column_stats, index_stats, roles_mapping, gtid_slave_pos, global_priv; -- enable_query_log diff --git a/mysql-test/main/temp_table.result b/mysql-test/main/temp_table.result index d1bec4a2af5..5de86e47fb1 100644 --- a/mysql-test/main/temp_table.result +++ b/mysql-test/main/temp_table.result @@ -548,3 +548,27 @@ DROP TABLE nonexisting_table, t1; ERROR 42S02: Unknown table 'temp_db.nonexisting_table' # Cleanup DROP DATABASE temp_db; +USE test; +# +# MDEV-17167 - InnoDB: Failing assertion: table->get_ref_count() == 0 +# upon truncating a temporary table +# +CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB; +SELECT * FROM t1 AS t1a1, t1 AS t2a2; +a a +TRUNCATE TABLE t1; +LOCK TABLES t1 WRITE; +TRUNCATE TABLE t1; +SELECT * FROM t1; +a +UNLOCK TABLES; +LOCK TABLES t1 AS t1a1 WRITE, t1 AS t1a2 WRITE; +TRUNCATE TABLE t1; +SELECT * FROM t1 AS t1a1, t1 AS t1a2; +a a +UNLOCK TABLES; +CREATE TABLE t2(a INT) ENGINE=InnoDB; +LOCK TABLES t2 WRITE; +TRUNCATE TABLE t1; +UNLOCK TABLES; +DROP TABLE t1, t2; diff --git a/mysql-test/main/temp_table.test b/mysql-test/main/temp_table.test index fb44362b537..a528e27b890 100644 --- a/mysql-test/main/temp_table.test +++ b/mysql-test/main/temp_table.test @@ -594,4 +594,30 @@ DROP TABLE nonexisting_table, t1; --echo # Cleanup DROP DATABASE temp_db; +USE test; + +--echo # +--echo # MDEV-17167 - InnoDB: Failing assertion: table->get_ref_count() == 0 +--echo # upon truncating a temporary table +--echo # +CREATE TEMPORARY TABLE t1(a INT) ENGINE=InnoDB; +SELECT * FROM t1 AS t1a1, t1 AS t2a2; +TRUNCATE TABLE t1; + +LOCK TABLES t1 WRITE; +TRUNCATE TABLE t1; +SELECT * FROM t1; +UNLOCK TABLES; + +LOCK TABLES t1 AS t1a1 WRITE, t1 AS t1a2 WRITE; +TRUNCATE TABLE t1; +SELECT * FROM t1 AS t1a1, t1 AS t1a2; +UNLOCK TABLES; + +CREATE TABLE t2(a INT) ENGINE=InnoDB; +LOCK TABLES t2 WRITE; +TRUNCATE TABLE t1; +UNLOCK TABLES; + +DROP TABLE t1, t2; diff --git a/mysql-test/main/temp_table_frm.result b/mysql-test/main/temp_table_frm.result index 19c66380af2..a9c59ff5969 100644 --- a/mysql-test/main/temp_table_frm.result +++ b/mysql-test/main/temp_table_frm.result @@ -1,3 +1,7 @@ +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; +set @@optimizer_use_condition_selectivity=1; +set @@use_stat_tables= NEVER; set @@session.max_heap_table_size=16*1024*1024; create table t1 select * from information_schema.session_status where variable_name like 'Opened%'; create temporary table t2 (a int) engine=memory; @@ -18,4 +22,6 @@ OPENED_PLUGIN_LIBRARIES 0 OPENED_TABLE_DEFINITIONS 2 OPENED_TABLES 1 OPENED_VIEWS 0 +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; drop table t1; diff --git a/mysql-test/main/temp_table_frm.test b/mysql-test/main/temp_table_frm.test index 178bd15004b..ddc4ffa575c 100644 --- a/mysql-test/main/temp_table_frm.test +++ b/mysql-test/main/temp_table_frm.test @@ -3,6 +3,11 @@ # # Ensure we don't overflow the internal heap table size in the join +set @save_use_stat_tables= @@use_stat_tables; +set @save_optimizer_use_condition_selectivity=@@optimizer_use_condition_selectivity; + +set @@optimizer_use_condition_selectivity=1; +set @@use_stat_tables= NEVER; set @@session.max_heap_table_size=16*1024*1024; create table t1 select * from information_schema.session_status where variable_name like 'Opened%'; create temporary table t2 (a int) engine=memory; @@ -13,4 +18,6 @@ let $tmpdir= `select @@tmpdir`; truncate table t2; select variable_name, session_status.variable_value - t1.variable_value from information_schema.session_status join t1 using (variable_name); -drop table t1; +set @@use_stat_tables= @save_use_stat_tables; +set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity; +drop table t1; \ No newline at end of file diff --git a/mysql-test/main/temporal_literal.result b/mysql-test/main/temporal_literal.result index d2417d7f9eb..2197b990f3b 100644 --- a/mysql-test/main/temporal_literal.result +++ b/mysql-test/main/temporal_literal.result @@ -294,17 +294,17 @@ SELECT TIMESTAMP'2001-00-00 00:00:00.9999999'; TIMESTAMP'2001-00-00 00:00:00.9999999' 2001-00-00 00:00:00.999999 Warnings: -Note 1292 Truncated incorrect datetime value: '2001-00-00 00:00:00.9999999' +Note 1292 Truncated incorrect DATETIME value: '2001-00-00 00:00:00.9999999' SELECT TIMESTAMP'2001-00-01 00:00:00.9999999'; TIMESTAMP'2001-00-01 00:00:00.9999999' 2001-00-01 00:00:00.999999 Warnings: -Note 1292 Truncated incorrect datetime value: '2001-00-01 00:00:00.9999999' +Note 1292 Truncated incorrect DATETIME value: '2001-00-01 00:00:00.9999999' SELECT TIMESTAMP'2001-01-00 00:00:00.9999999'; TIMESTAMP'2001-01-00 00:00:00.9999999' 2001-01-00 00:00:00.999999 Warnings: -Note 1292 Truncated incorrect datetime value: '2001-01-00 00:00:00.9999999' +Note 1292 Truncated incorrect DATETIME value: '2001-01-00 00:00:00.9999999' # # String literal with bad dates and nanoseconds to DATETIME(N) # @@ -416,7 +416,7 @@ SELECT TIME'10:10:10.1234567'; TIME'10:10:10.1234567' 10:10:10.123456 Warnings: -Note 1292 Truncated incorrect time value: '10:10:10.1234567' +Note 1292 Truncated incorrect TIME value: '10:10:10.1234567' SELECT TIME('10:10:10.1234567'); TIME('10:10:10.1234567') 10:10:10.123456 @@ -440,7 +440,7 @@ SELECT TIMESTAMP'2001-01-01 10:10:10.1234567'; TIMESTAMP'2001-01-01 10:10:10.1234567' 2001-01-01 10:10:10.123456 Warnings: -Note 1292 Truncated incorrect datetime value: '2001-01-01 10:10:10.1234567' +Note 1292 Truncated incorrect DATETIME value: '2001-01-01 10:10:10.1234567' SELECT TIMESTAMP('2001-01-01 10:10:10.1234567'); TIMESTAMP('2001-01-01 10:10:10.1234567') 2001-01-01 10:10:10.123456 @@ -463,7 +463,7 @@ Warning 1292 Truncated incorrect datetime value: '2001-01-01 10:10:10.1234567xyz CREATE TABLE t1 (a TIME(6)); INSERT INTO t1 VALUES (TIME'10:20:30.1234567'); Warnings: -Note 1292 Truncated incorrect time value: '10:20:30.1234567' +Note 1292 Truncated incorrect TIME value: '10:20:30.1234567' INSERT INTO t1 VALUES (TIME('10:20:30.1234567')); Warnings: Note 1292 Truncated incorrect time value: '10:20:30.1234567' diff --git a/mysql-test/main/timezone2.result b/mysql-test/main/timezone2.result index 096e996bffb..dd137045d1a 100644 --- a/mysql-test/main/timezone2.result +++ b/mysql-test/main/timezone2.result @@ -332,3 +332,228 @@ NULL # # End of 5.3 tests # +# +# Start of 10.4 tests +# +# +# MDEV-17203 Move fractional second truncation from Item_xxx_typecast::get_date() to Time and Datetime constructors +# (an addition for the test for MDEV-4653) +SET timestamp=unix_timestamp('2001-02-03 10:20:30'); +SET old_mode=ZERO_DATE_TIME_CAST; +SELECT CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5'); +CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5') +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '00:00:00' +SELECT CONVERT_TZ(TIME('2010-01-01 00:00:00'),'+00:00','+7:5'); +CONVERT_TZ(TIME('2010-01-01 00:00:00'),'+00:00','+7:5') +NULL +Warnings: +Warning 1292 Truncated incorrect datetime value: '00:00:00' +SET old_mode=DEFAULT; +SET timestamp=DEFAULT; +# +# MDEV-13995 MAX(timestamp) returns a wrong result near DST change +# +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +SELECT a, UNIX_TIMESTAMP(a) FROM t1; +a UNIX_TIMESTAMP(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:25 1288481125 +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +a +1288481125 +CREATE TABLE t2 (a TIMESTAMP); +INSERT INTO t2 SELECT MAX(a) AS a FROM t1; +SELECT a, UNIX_TIMESTAMP(a) FROM t2; +a UNIX_TIMESTAMP(a) +2010-10-31 02:25:25 1288481125 +DROP TABLE t2; +DROP TABLE t1; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +CREATE TABLE t2 (a TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/); +INSERT INTO t2 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +SELECT UNIX_TIMESTAMP(t1.a), UNIX_TIMESTAMP(t2.a) FROM t1,t2; +UNIX_TIMESTAMP(t1.a) UNIX_TIMESTAMP(t2.a) +1288477526 1288481125 +SELECT * FROM t1,t2 WHERE t1.a < t2.a; +a a +2010-10-31 02:25:26 2010-10-31 02:25:25 +DROP TABLE t1,t2; +BEGIN NOT ATOMIC +DECLARE a,b TIMESTAMP; +SET time_zone='+00:00'; +SET a=FROM_UNIXTIME(1288477526); +SET b=FROM_UNIXTIME(1288481125); +SELECT a < b; +SET time_zone='Europe/Moscow'; +SELECT a < b; +END; +$$ +a < b +1 +a < b +1 +CREATE OR REPLACE FUNCTION f1(uts INT) RETURNS TIMESTAMP +BEGIN +DECLARE ts TIMESTAMP; +DECLARE tz VARCHAR(64) DEFAULT @@time_zone; +SET time_zone='+00:00'; +SET ts=FROM_UNIXTIME(uts); +SET time_zone=tz; +RETURN ts; +END; +$$ +SET time_zone='+00:00'; +SELECT f1(1288477526) < f1(1288481125); +f1(1288477526) < f1(1288481125) +1 +SET time_zone='Europe/Moscow'; +SELECT f1(1288477526) < f1(1288481125); +f1(1288477526) < f1(1288481125) +1 +DROP FUNCTION f1; +CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/, +FROM_UNIXTIME(1288481125) /*winter time in Moscow*/); +SELECT *, LEAST(a,b) FROM t1; +a b LEAST(a,b) +2010-10-30 22:25:26 2010-10-30 23:25:25 2010-10-30 22:25:26 +SET time_zone='Europe/Moscow'; +SELECT *, LEAST(a,b) FROM t1; +a b LEAST(a,b) +2010-10-31 02:25:26 2010-10-31 02:25:25 2010-10-31 02:25:26 +SELECT UNIX_TIMESTAMP(a), UNIX_TIMESTAMP(b), UNIX_TIMESTAMP(LEAST(a,b)) FROM t1; +UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) UNIX_TIMESTAMP(LEAST(a,b)) +1288477526 1288481125 1288477526 +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP,c TIMESTAMP); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES ( +FROM_UNIXTIME(1288477526) /*summer time in Moscow*/, +FROM_UNIXTIME(1288481125) /*winter time in Moscow*/, +FROM_UNIXTIME(1288481126) /*winter time in Moscow*/); +SELECT b BETWEEN a AND c FROM t1; +b BETWEEN a AND c +1 +SET time_zone='Europe/Moscow'; +SELECT b BETWEEN a AND c FROM t1; +b BETWEEN a AND c +1 +DROP TABLE t1; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481125) /*winter time in Moscow*/); +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +a UNIX_TIMESTAMP(a) +2010-10-30 22:25:26 1288477526 +2010-10-30 23:25:25 1288481125 +SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +a UNIX_TIMESTAMP(a) +2010-10-30 22:25:26 1288477526 +2010-10-30 23:25:25 1288481125 +SET time_zone='Europe/Moscow'; +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +a UNIX_TIMESTAMP(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:25 1288481125 +SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +a UNIX_TIMESTAMP(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:25 1288481125 +DROP TABLE t1; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481126) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +SELECT a, UNIX_TIMESTAMP(a) FROM t1 GROUP BY a; +a UNIX_TIMESTAMP(a) +2010-10-31 02:25:26 1288477526 +2010-10-31 02:25:26 1288481126 +DROP TABLE t1; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126)); +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1; +UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) x +1288477526 1288481126 ne +SET time_zone='Europe/Moscow'; +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1; +UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) x +1288477526 1288481126 ne +DROP TABLE t1; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP,c TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126),FROM_UNIXTIME(1288481127)); +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1; +UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) x +1288477526 1288481126 0 +SET time_zone='Europe/Moscow'; +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1; +UNIX_TIMESTAMP(a) UNIX_TIMESTAMP(b) x +1288477526 1288481126 0 +DROP TABLE t1; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126)); +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1); +a b +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1); +a b +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1)); +a b +SET time_zone='Europe/Moscow'; +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1); +a b +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1); +a b +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1)); +a b +DROP TABLE t1; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000000),FROM_UNIXTIME(1200000000)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000001),FROM_UNIXTIME(1200000001)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000000),FROM_UNIXTIME(1400000000)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000001),FROM_UNIXTIME(1400000001)); +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1); +a b +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1); +a b +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1)); +a b +SET time_zone='Europe/Moscow'; +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1); +a b +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1); +a b +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1)); +a b +DROP TABLE t1; +# +# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY +# +SET time_zone='+00:00'; +CREATE TABLE t1 (a INT, ts TIMESTAMP) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1, FROM_UNIXTIME(1288481126) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +CREATE TABLE t2 AS SELECT ts, COALESCE(ts) AS cts FROM t1 GROUP BY cts; +SELECT ts, cts, UNIX_TIMESTAMP(ts) AS uts, UNIX_TIMESTAMP(cts) AS ucts FROM t2; +ts cts uts ucts +2010-10-31 02:25:26 2010-10-31 02:25:26 1288481126 1288481126 +DROP TABLE t1,t2; +SET time_zone=DEFAULT; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/timezone2.test b/mysql-test/main/timezone2.test index 7a38610ad95..db515653651 100644 --- a/mysql-test/main/timezone2.test +++ b/mysql-test/main/timezone2.test @@ -308,3 +308,201 @@ SELECT CONVERT_TZ('2001-10-08 00:00:00', MAKE_SET(0,'+01:00'), '+00:00' ); --echo # --echo # End of 5.3 tests --echo # + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-17203 Move fractional second truncation from Item_xxx_typecast::get_date() to Time and Datetime constructors +--echo # (an addition for the test for MDEV-4653) + +SET timestamp=unix_timestamp('2001-02-03 10:20:30'); +SET old_mode=ZERO_DATE_TIME_CAST; +SELECT CONVERT_TZ(TIME('00:00:00'),'+00:00','+7:5'); +SELECT CONVERT_TZ(TIME('2010-01-01 00:00:00'),'+00:00','+7:5'); +SET old_mode=DEFAULT; +SET timestamp=DEFAULT; + +--echo # +--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change +--echo # + +# MAX() +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +SELECT a, UNIX_TIMESTAMP(a) FROM t1; +SELECT UNIX_TIMESTAMP(MAX(a)) AS a FROM t1; +CREATE TABLE t2 (a TIMESTAMP); +INSERT INTO t2 SELECT MAX(a) AS a FROM t1; +SELECT a, UNIX_TIMESTAMP(a) FROM t2; +DROP TABLE t2; +DROP TABLE t1; + + +# Comparison +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +CREATE TABLE t2 (a TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Moscow*/); +INSERT INTO t2 VALUES (FROM_UNIXTIME(1288477526+3599) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +SELECT UNIX_TIMESTAMP(t1.a), UNIX_TIMESTAMP(t2.a) FROM t1,t2; +SELECT * FROM t1,t2 WHERE t1.a < t2.a; +DROP TABLE t1,t2; + + +# SP variable comparison +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE a,b TIMESTAMP; + SET time_zone='+00:00'; + SET a=FROM_UNIXTIME(1288477526); + SET b=FROM_UNIXTIME(1288481125); + SELECT a < b; + SET time_zone='Europe/Moscow'; + SELECT a < b; +END; +$$ +DELIMITER ;$$ + + +# SP function comparison +DELIMITER $$; +CREATE OR REPLACE FUNCTION f1(uts INT) RETURNS TIMESTAMP +BEGIN + DECLARE ts TIMESTAMP; + DECLARE tz VARCHAR(64) DEFAULT @@time_zone; + SET time_zone='+00:00'; + SET ts=FROM_UNIXTIME(uts); + SET time_zone=tz; + RETURN ts; +END; +$$ +DELIMITER ;$$ +SET time_zone='+00:00'; +SELECT f1(1288477526) < f1(1288481125); +SET time_zone='Europe/Moscow'; +SELECT f1(1288477526) < f1(1288481125); +DROP FUNCTION f1; + + +# LEAST() +CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/, + FROM_UNIXTIME(1288481125) /*winter time in Moscow*/); +SELECT *, LEAST(a,b) FROM t1; +SET time_zone='Europe/Moscow'; +SELECT *, LEAST(a,b) FROM t1; +SELECT UNIX_TIMESTAMP(a), UNIX_TIMESTAMP(b), UNIX_TIMESTAMP(LEAST(a,b)) FROM t1; +DROP TABLE t1; + + +# BETWEEN +CREATE TABLE t1 (a TIMESTAMP,b TIMESTAMP,c TIMESTAMP); +SET time_zone='+00:00'; +INSERT INTO t1 VALUES ( + FROM_UNIXTIME(1288477526) /*summer time in Moscow*/, + FROM_UNIXTIME(1288481125) /*winter time in Moscow*/, + FROM_UNIXTIME(1288481126) /*winter time in Moscow*/); +SELECT b BETWEEN a AND c FROM t1; +SET time_zone='Europe/Moscow'; +SELECT b BETWEEN a AND c FROM t1; +DROP TABLE t1; + + +# ORDER BY +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481125) /*winter time in Moscow*/); +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +SET time_zone='Europe/Moscow'; +SELECT a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +SELECT COALESCE(a) AS a, UNIX_TIMESTAMP(a) FROM t1 ORDER BY a; +DROP TABLE t1; + + +# GROUP BY +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526) /*summer time in Mowcow*/); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288481126) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +SELECT a, UNIX_TIMESTAMP(a) FROM t1 GROUP BY a; +DROP TABLE t1; + + +# CASE +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126)); +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1; +SET time_zone='Europe/Moscow'; +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),CASE a WHEN b THEN 'eq' ELSE 'ne' END AS x FROM t1; +DROP TABLE t1; + + +# IN +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP,c TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126),FROM_UNIXTIME(1288481127)); +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1; +SET time_zone='Europe/Moscow'; +SELECT UNIX_TIMESTAMP(a),UNIX_TIMESTAMP(b),a IN (b,c) AS x FROM t1; +DROP TABLE t1; + +# Comparison and IN in combination with a subquery (with one row) + +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126)); +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1); +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1); +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1)); + +SET time_zone='Europe/Moscow'; +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1); +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1); +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1)); +DROP TABLE t1; + +# Comparison and IN in combinarion with a subquery (with multiple rows) +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000000),FROM_UNIXTIME(1200000000)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1100000001),FROM_UNIXTIME(1200000001)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1288477526),FROM_UNIXTIME(1288481126)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000000),FROM_UNIXTIME(1400000000)); +INSERT INTO t1 VALUES (FROM_UNIXTIME(1300000001),FROM_UNIXTIME(1400000001)); +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1); +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1); +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1)); + +SET time_zone='Europe/Moscow'; +SELECT * FROM t1 WHERE a = (SELECT MAX(b) FROM t1); +SELECT * FROM t1 WHERE a = (SELECT MIN(b) FROM t1); +SELECT * FROM t1 WHERE a IN ((SELECT MAX(b) FROM t1), (SELECT MIN(b) FROM t1)); +DROP TABLE t1; + +--echo # +--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY +--echo # + +SET time_zone='+00:00'; +CREATE TABLE t1 (a INT, ts TIMESTAMP) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1, FROM_UNIXTIME(1288481126) /*winter time in Moscow*/); +SET time_zone='Europe/Moscow'; +CREATE TABLE t2 AS SELECT ts, COALESCE(ts) AS cts FROM t1 GROUP BY cts; +SELECT ts, cts, UNIX_TIMESTAMP(ts) AS uts, UNIX_TIMESTAMP(cts) AS ucts FROM t2; +DROP TABLE t1,t2; +SET time_zone=DEFAULT; + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/trigger.result b/mysql-test/main/trigger.result index 72d0658386d..1adf3c68a08 100644 --- a/mysql-test/main/trigger.result +++ b/mysql-test/main/trigger.result @@ -622,7 +622,7 @@ drop table t1; set sql_mode="traditional"; create table t1 (a date); insert into t1 values ('2004-01-00'); -ERROR 22007: Incorrect date value: '2004-01-00' for column 'a' at row 1 +ERROR 22007: Incorrect date value: '2004-01-00' for column `test`.`t1`.`a` at row 1 set sql_mode=""; create trigger t1_bi before insert on t1 for each row set new.a = '2004-01-00'; set sql_mode="traditional"; @@ -2146,7 +2146,7 @@ insert into t2 values (1),(2); delete from t1 where i=1; show status like 'Opened_tables'; Variable_name Value -Opened_tables 3 +Opened_tables 6 select * from t1; i 2 diff --git a/mysql-test/main/trigger_notembedded.test b/mysql-test/main/trigger_notembedded.test index a31594826e7..051cd43f16f 100644 --- a/mysql-test/main/trigger_notembedded.test +++ b/mysql-test/main/trigger_notembedded.test @@ -907,7 +907,7 @@ connection flush; connection default; let $wait_condition= select count(*) = 1 from information_schema.processlist - where state = "Waiting for global read lock"; + where state = "Waiting for backup lock"; --source include/wait_condition.inc create trigger t1_bi before insert on t1 for each row begin end; unlock tables; diff --git a/mysql-test/main/truncate_coverage.result b/mysql-test/main/truncate_coverage.result index 078de1ef3ab..9a343832b69 100644 --- a/mysql-test/main/truncate_coverage.result +++ b/mysql-test/main/truncate_coverage.result @@ -40,7 +40,7 @@ TRUNCATE TABLE m1; connection con2; SET DEBUG_SYNC= 'now WAIT_FOR opened'; # Sending: -FLUSH TABLES; +FLUSH TABLES m1; connection default; # Waiting for FLUSH TABLES to be blocked. SET DEBUG_SYNC= 'now SIGNAL dropped'; diff --git a/mysql-test/main/truncate_coverage.test b/mysql-test/main/truncate_coverage.test index 3351ce84232..1b793c6638c 100644 --- a/mysql-test/main/truncate_coverage.test +++ b/mysql-test/main/truncate_coverage.test @@ -81,12 +81,12 @@ SET DEBUG_SYNC= 'open_tables_after_open_and_process_table SIGNAL opened WAIT_FOR connection con2; SET DEBUG_SYNC= 'now WAIT_FOR opened'; --echo # Sending: ---send FLUSH TABLES +--send FLUSH TABLES m1 connection default; --echo # Waiting for FLUSH TABLES to be blocked. let $wait_condition= SELECT COUNT(*)=1 FROM information_schema.processlist - WHERE state= 'Waiting for table flush' AND info= 'FLUSH TABLES'; + WHERE state= 'Waiting for table metadata lock' AND info= 'FLUSH TABLES m1'; --source include/wait_condition.inc SET DEBUG_SYNC= 'now SIGNAL dropped'; diff --git a/mysql-test/main/type_date.result b/mysql-test/main/type_date.result index 897f42a2ec4..fb117d40dd7 100644 --- a/mysql-test/main/type_date.result +++ b/mysql-test/main/type_date.result @@ -108,7 +108,7 @@ DROP TABLE t1, t2, t3; CREATE TABLE t1 (y YEAR); INSERT IGNORE INTO t1 VALUES ('abc'); Warnings: -Warning 1366 Incorrect integer value: 'abc' for column 'y' at row 1 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`y` at row 1 SELECT * FROM t1; y 0000 @@ -221,7 +221,7 @@ a 0000-00-00 0000-00-00 INSERT INTO t1 VALUES ('0000-00-00'); -ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`a` at row 1 SET SQL_MODE=DEFAULT; DROP TABLE t1,t2; CREATE TABLE t1 (a DATE); @@ -250,7 +250,7 @@ a 1000-00-00 1000-00-00 INSERT INTO t1 VALUES ('1000-00-00'); -ERROR 22007: Incorrect date value: '1000-00-00' for column 'a' at row 1 +ERROR 22007: Incorrect date value: '1000-00-00' for column `test`.`t1`.`a` at row 1 SET SQL_MODE=DEFAULT; DROP TABLE t1,t2; CREATE TABLE t1 SELECT curdate() AS f1; @@ -504,7 +504,7 @@ SET sql_mode=DEFAULT; CREATE TABLE t1 (a DATE DEFAULT '0000-00-00'); SET sql_mode=TRADITIONAL; INSERT INTO t1 VALUES ('0000-00-00'); -ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t1`.`a` at row 1 INSERT INTO t1 VALUES (); ERROR 22007: Incorrect default value '0000-00-00' for column 'a' INSERT INTO t1 VALUES (DEFAULT); @@ -545,7 +545,7 @@ CREATE TABLE t1 (a DATE);; INSERT INTO t1 VALUES (0); SET sql_mode='TRADITIONAL'; CREATE TABLE t2 AS SELECT * FROM t1; -ERROR 22007: Incorrect date value: '0000-00-00' for column 'a' at row 1 +ERROR 22007: Incorrect date value: '0000-00-00' for column `test`.`t2`.`a` at row 1 DROP TABLE t1; # # End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field @@ -621,7 +621,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=11+RAND() AND a=' garbage '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Warning 1292 Incorrect datetime value: ' garbage ' +Warning 1292 Truncated incorrect datetime value: ' garbage ' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'0000-00-00' and (octet_length(DATE'0000-00-00')) = 11 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATE); @@ -819,9 +819,9 @@ DATE(a) DATE(b) DATE(c) NULL NULL NULL 2001-01-01 2001-01-01 2001-01-01 Warnings: -Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1 -Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1 -Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1 +Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`a` at row 1 +Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`b` at row 1 +Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`c` at row 1 SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1; DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c)) NULL NULL NULL @@ -839,9 +839,9 @@ DATE(a) DATE(b) DATE(c) NULL NULL NULL 2001-01-01 2001-01-01 2001-01-01 Warnings: -Warning 1292 Incorrect datetime value: '1' for column 'a' at row 1 -Warning 1292 Incorrect datetime value: '1' for column 'b' at row 1 -Warning 1292 Incorrect datetime value: '1' for column 'c' at row 1 +Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`a` at row 1 +Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`b` at row 1 +Warning 1292 Incorrect datetime value: '1' for column `test`.`t1`.`c` at row 1 SELECT DATE(COALESCE(a)), DATE(COALESCE(b)), DATE(COALESCE(c)) FROM t1; DATE(COALESCE(a)) DATE(COALESCE(b)) DATE(COALESCE(c)) NULL NULL NULL @@ -962,5 +962,41 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where coalesce((DATE'2001-01-02'),`test`.`t1`.`a`) <=> coalesce(DATE'2001-01-01',`test`.`t1`.`a`) DROP TABLE t1; # +# MDEV-15406 NO_ZERO_IN_DATE erroneously affects how CAST(AS DATE) warns about fractional digit truncation +# +SET sql_mode=''; +CREATE TABLE t1 (a DATE); +SELECT CAST(20061108.01 AS DATE); +CAST(20061108.01 AS DATE) +2006-11-08 +Warnings: +Note 1292 Truncated incorrect date value: '20061108.01' +INSERT INTO t1 VALUES (20061108.01); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +SET sql_mode=NO_ZERO_IN_DATE; +SELECT CAST(20061108.01 AS DATE); +CAST(20061108.01 AS DATE) +2006-11-08 +Warnings: +Note 1292 Truncated incorrect date value: '20061108.01' +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES (20061108.01); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-17216 Assertion `!dt->fraction_remainder(decimals())' failed in Field_temporal_with_date::store_TIME_with_warning +# +SET sql_mode=''; +CREATE TABLE t1 (i1 date ); +CREATE TABLE t2 (i2 int unsigned ); +INSERT INTO t2 VALUES (0); +INSERT INTO t1 SELECT * FROM t2; +DROP TABLE t1,t2; +SET sql_mode=DEFAULT; +# # End of 10.4 tests # diff --git a/mysql-test/main/type_date.test b/mysql-test/main/type_date.test index cbd6cc846aa..75bbfb3b916 100644 --- a/mysql-test/main/type_date.test +++ b/mysql-test/main/type_date.test @@ -646,6 +646,37 @@ EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE COALESCE(?,a)<=>COALE DROP TABLE t1; + +--echo # +--echo # MDEV-15406 NO_ZERO_IN_DATE erroneously affects how CAST(AS DATE) warns about fractional digit truncation +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (a DATE); +SELECT CAST(20061108.01 AS DATE); +INSERT INTO t1 VALUES (20061108.01); +DROP TABLE t1; + +SET sql_mode=NO_ZERO_IN_DATE; +SELECT CAST(20061108.01 AS DATE); +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES (20061108.01); +DROP TABLE t1; +SET sql_mode=DEFAULT; + + +--echo # +--echo # MDEV-17216 Assertion `!dt->fraction_remainder(decimals())' failed in Field_temporal_with_date::store_TIME_with_warning +--echo # +SET sql_mode=''; +CREATE TABLE t1 (i1 date ); +CREATE TABLE t2 (i2 int unsigned ); +INSERT INTO t2 VALUES (0); +INSERT INTO t1 SELECT * FROM t2; +DROP TABLE t1,t2; +SET sql_mode=DEFAULT; + + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/type_date_round.result b/mysql-test/main/type_date_round.result new file mode 100644 index 00000000000..0da78c6afe5 --- /dev/null +++ b/mysql-test/main/type_date_round.result @@ -0,0 +1,174 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; +# +# DATE: SET +# +CREATE TABLE t1 (a DATE, b DATETIME(4)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +UPDATE t1 SET a=b; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +SELECT a FROM t1; +a +2000-12-31 +DROP TABLE t1; +CREATE TABLE t1 (a DATE, b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999'); +UPDATE t1 SET a=b; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1265 Data truncated for column 'a' at row 2 +SELECT a FROM t1; +a +2000-12-31 +2000-12-31 +DROP TABLE t1; +CREATE TABLE t1 (a DATE, b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,20001231235959.9999); +INSERT INTO t1 VALUES(NULL,20001231235959.9999999); +UPDATE t1 SET a=b; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1265 Data truncated for column 'a' at row 2 +SELECT a FROM t1; +a +2000-12-31 +2000-12-31 +DROP TABLE t1; +# +# DATE: ALTER +# +CREATE TABLE t1 (a DATETIME(4)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +ALTER TABLE t1 MODIFY a DATE; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +SELECT a FROM t1; +a +2000-12-31 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +ALTER TABLE t1 MODIFY a DATE; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +Note 1265 Data truncated for column 'a' at row 2 +SELECT a FROM t1; +a +2000-12-31 +2000-12-31 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +ALTER TABLE t1 MODIFY a DATE; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +Note 1265 Data truncated for column 'a' at row 2 +SELECT a FROM t1; +a +2000-12-31 +2000-12-31 +DROP TABLE t1; +# +# DATE: CAST +# +CREATE TABLE t1 (a DATETIME(4)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +SELECT a, CAST(a AS DATE) FROM t1; +a CAST(a AS DATE) +2000-12-31 23:59:59.9999 2000-12-31 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +SELECT a, CAST(a AS DATE) FROM t1; +a CAST(a AS DATE) +2000-12-31 23:59:59.9999 2000-12-31 +2000-12-31 23:59:59.9999999 2000-12-31 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +SELECT a, CAST(a AS DATE) FROM t1; +a CAST(a AS DATE) +20001231235959.9999000000 2000-12-31 +20001231235959.9999999000 2000-12-31 +DROP TABLE t1; +# +# Equal field propagation +# +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES (20010101); +INSERT INTO t1 VALUES (20010102); +SELECT * FROM t1 WHERE a= 20010101235959.9999999; +a +2001-01-02 +SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999'; +a +2001-01-02 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999'; +a +2001-01-02 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02'; +a +2001-01-02 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-02' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = DATE'2001-01-02' +DROP TABLE t1; +# +# Comparing non-temporal to DATE +# +# Although conversion from non-temporal to DATE (e.g. on SET) does not round, +# comparison between non-temporal to DATE is performed as DATETIME. +# So rounding does happen here. +CREATE TABLE t1 (a VARCHAR(64)); +INSERT t1 VALUES ('2001-01-01 23:59:59.9999999'); +SELECT * FROM t1 WHERE a=DATE'2001-01-02'; +a +2001-01-01 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +SELECT * FROM t1 WHERE CONCAT(a)=DATE'2001-01-02'; +a +2001-01-01 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-02'; +a +2001-01-01 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(32,7)); +INSERT t1 VALUES (20010101235959.9999999); +SELECT * FROM t1 WHERE a=DATE'2001-01-02'; +a +20010101235959.9999999 +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-02'; +a +20010101235959.9999999 +DROP TABLE t1; diff --git a/mysql-test/main/type_date_round.test b/mysql-test/main/type_date_round.test new file mode 100644 index 00000000000..61e1d0a401c --- /dev/null +++ b/mysql-test/main/type_date_round.test @@ -0,0 +1,113 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; + +--echo # +--echo # DATE: SET +--echo # + +CREATE TABLE t1 (a DATE, b DATETIME(4)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DATE, b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DATE, b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,20001231235959.9999); +INSERT INTO t1 VALUES(NULL,20001231235959.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +--echo # +--echo # DATE: ALTER +--echo # + +CREATE TABLE t1 (a DATETIME(4)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +ALTER TABLE t1 MODIFY a DATE; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +ALTER TABLE t1 MODIFY a DATE; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +ALTER TABLE t1 MODIFY a DATE; +SELECT a FROM t1; +DROP TABLE t1; + +--echo # +--echo # DATE: CAST +--echo # + +CREATE TABLE t1 (a DATETIME(4)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +SELECT a, CAST(a AS DATE) FROM t1; +DROP TABLE t1; + +# This truncates microseconds but rounds nanoseconds (MySQL Bug #92475) +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +SELECT a, CAST(a AS DATE) FROM t1; +DROP TABLE t1; + +# This truncates microseconds but rounds nanoseconds (MySQL Bug #92475) +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +SELECT a, CAST(a AS DATE) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Equal field propagation +--echo # + +CREATE TABLE t1 (a DATE); +INSERT INTO t1 VALUES (20010101); +INSERT INTO t1 VALUES (20010102); +# DATE is compared to non-temporal as DATETIME +# In the below queries nanoseconds should round to microseconds +SELECT * FROM t1 WHERE a= 20010101235959.9999999; +SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999'; +SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999'; +SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND a>='2001-01-01 23:59:59.9999999'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='2001-01-01 23:59:59.9999999' AND CONCAT(a)='2001-01-02'; +DROP TABLE t1; + + +--echo # +--echo # Comparing non-temporal to DATE +--echo # + +--echo # Although conversion from non-temporal to DATE (e.g. on SET) does not round, +--echo # comparison between non-temporal to DATE is performed as DATETIME. +--echo # So rounding does happen here. + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT t1 VALUES ('2001-01-01 23:59:59.9999999'); +SELECT * FROM t1 WHERE a=DATE'2001-01-02'; +SELECT * FROM t1 WHERE CONCAT(a)=DATE'2001-01-02'; +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-02'; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(32,7)); +INSERT t1 VALUES (20010101235959.9999999); +SELECT * FROM t1 WHERE a=DATE'2001-01-02'; +SELECT * FROM t1 WHERE COALESCE(a)=DATE'2001-01-02'; +DROP TABLE t1; diff --git a/mysql-test/main/type_datetime.result b/mysql-test/main/type_datetime.result index 86dddc93a70..6f2aa386276 100644 --- a/mysql-test/main/type_datetime.result +++ b/mysql-test/main/type_datetime.result @@ -216,7 +216,7 @@ insert into t1 set dt='2007-03-23 13:49:38',da=dt; Warnings: Note 1265 Data truncated for column 'da' at row 1 insert into t1 values ('2007-03-32','2007-03-23 13:49:38'); -ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1 +ERROR 22007: Incorrect date value: '2007-03-32' for column `test`.`t1`.`da` at row 1 select * from t1; da dt 1962-03-03 1962-03-03 00:00:00 @@ -361,7 +361,7 @@ greatest(cast('01-01-01' as date), '01-01-02') + 0 20010102 select least(cast('01-01-01' as datetime), '01-01-02') + 0; least(cast('01-01-01' as datetime), '01-01-02') + 0 -20010101000000.000000 +20010101000000 select cast(least(cast('01-01-01' as datetime), '01-01-02') as signed); cast(least(cast('01-01-01' as datetime), '01-01-02') as signed) 20010101000000 @@ -399,7 +399,7 @@ if(@bug28261 = f1, '', @bug28261:= f1) 2001-01-01 2002-02-02 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' select if(@bug28261 = f1, '', @bug28261:= f1) from t1; if(@bug28261 = f1, '', @bug28261:= f1) 2001-01-01 @@ -423,11 +423,11 @@ f1 2001-01-01 00:00:00 2002-02-02 00:00:00 Warnings: -Warning 1292 Incorrect datetime value: '2002010' +Warning 1292 Truncated incorrect datetime value: '2002010' select * from t1 where f1 between 20020101 and 2007010100000; f1 Warnings: -Warning 1292 Incorrect datetime value: '2007010100000' +Warning 1292 Truncated incorrect datetime value: '2007010100000' drop table t1; # # Bug#27216: functions with parameters of different date types may @@ -498,7 +498,7 @@ f1 45:44:44 15:44:44 Warnings: -Warning 1292 Incorrect datetime value: '1' +Warning 1292 Truncated incorrect datetime value: '1' drop table t1; create table t1 (a tinyint); insert into t1 values (), (), (); @@ -575,18 +575,18 @@ CAST('NULL' AS DATE) < CAST('NULL' AS DATE) n9; n1 n2 n3 n4 n5 n6 n7 n8 n9 0 0 1 1 1 0 1 0 0 Warnings: -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' -Warning 1292 Incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' +Warning 1292 Truncated incorrect datetime value: 'NULL' End of 5.0 tests set @org_mode=@@sql_mode; create table t1 (da date default '1962-03-03 23:33:34', dt datetime default '1962-03-03'); @@ -610,7 +610,7 @@ insert into t1 set dt='2007-03-23 13:49:38',da=dt; Warnings: Note 1265 Data truncated for column 'da' at row 1 insert into t1 values ('2007-03-32','2007-03-23 13:49:38'); -ERROR 22007: Incorrect date value: '2007-03-32' for column 'da' at row 1 +ERROR 22007: Incorrect date value: '2007-03-32' for column `test`.`t1`.`da` at row 1 select * from t1; da dt 1962-03-03 1962-03-03 00:00:00 @@ -854,7 +854,7 @@ SET sql_mode=DEFAULT; CREATE TABLE t1 (a DATETIME DEFAULT '0000-00-00 00:00:00'); SET sql_mode=TRADITIONAL; INSERT INTO t1 VALUES ('0000-00-00 00:00:00'); -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`a` at row 1 INSERT INTO t1 VALUES (); ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a' INSERT INTO t1 VALUES (DEFAULT); @@ -895,7 +895,7 @@ CREATE TABLE t1 (a DATETIME);; INSERT INTO t1 VALUES (0); SET sql_mode='TRADITIONAL'; CREATE TABLE t2 AS SELECT * FROM t1; -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t2`.`a` at row 1 DROP TABLE t1; # # End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field @@ -917,7 +917,7 @@ CREATE TABLE t1 (a DATETIME); INSERT INTO t1 VALUES ('0000-00-00 10:20:30'); SELECT a, LEAST(a,'2001-01-01 10:20:30') FROM t1; a LEAST(a,'2001-01-01 10:20:30') -0000-00-00 10:20:30 0000-00-00 10:20:30.000000 +0000-00-00 10:20:30 0000-00-00 10:20:30 DROP TABLE t1; CREATE TABLE t1 (a DATETIME(6)); INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000001'); @@ -1012,7 +1012,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Warning 1292 Incorrect datetime value: ' garbage ' +Warning 1292 Truncated incorrect datetime value: ' garbage ' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00' and (octet_length(TIMESTAMP'0000-00-00 00:00:00')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a DATETIME);; @@ -1131,11 +1131,11 @@ INSERT INTO t1 VALUES ('00:00:00'),('00:01:00'); SELECT 1 FROM t1 WHERE 2016 > SOME (SELECT CAST(a AS DATETIME) FROM t1); 1 Warnings: -Warning 1292 Incorrect datetime value: '2016' +Warning 1292 Truncated incorrect datetime value: '2016' SELECT * FROM t1 WHERE 2016 > CAST(a AS DATETIME); a Warnings: -Warning 1292 Incorrect datetime value: '2016' +Warning 1292 Truncated incorrect datetime value: '2016' SELECT 1 FROM t1 WHERE 20160101 > SOME (SELECT CAST(a AS DATETIME) FROM t1); 1 1 @@ -1400,5 +1400,39 @@ Warnings: Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where octet_length(coalesce(TIME'00:00:00.0',`test`.`t1`.`a`)) <=> octet_length(coalesce((TIMESTAMP'2001-01-01 00:00:00.00'),`test`.`t1`.`a`)) DROP TABLE t1; # +# MDEV-17216 Assertion `!dt->fraction_remainder(decimals())' failed in Field_temporal_with_date::store_TIME_with_warning +# +CREATE TABLE t1 (b BIT(20)); +CREATE TABLE t2 (t DATETIME); +INSERT IGNORE INTO t1 VALUES (b'000001001100000'); +INSERT INTO t2 SELECT * FROM t1; +DROP TABLE t1, t2; +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 SELECT CAST(20010101 AS UNSIGNED); +DROP TABLE t1; +# +# MDEV-17563 Different results using table or view when comparing values of time type +# +CREATE TABLE t1 (pk int, x1 datetime, x2 varchar(1)); +INSERT INTO t1 VALUES (17,'2001-01-01 09:16:37',''); +INSERT INTO t1 VALUES (18,'2001-01-01 09:16:37','k'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT pk FROM t1 WHERE x1 >x2; +pk +17 +18 +Warnings: +Warning 1292 Truncated incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: 'k' +SELECT pk FROM v1 WHERE x1 >x2; +pk +17 +18 +Warnings: +Warning 1292 Truncated incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: 'k' +DROP VIEW v1; +DROP TABLE t1; +# # End of 10.4 tests # diff --git a/mysql-test/main/type_datetime.test b/mysql-test/main/type_datetime.test index 3c8287f8793..7bd7883f469 100644 --- a/mysql-test/main/type_datetime.test +++ b/mysql-test/main/type_datetime.test @@ -175,12 +175,12 @@ set @@sql_mode= @org_mode; ## ( Bug#29290 type_datetime.test failure in 5.1 ) ## Therefore we sleep a bit if we are too close to midnight. ## The complete test itself needs around 1 second. -## Therefore a time_distance to midnight of 5 seconds should be sufficient. -if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 5)`) +## Therefore a time_distance to midnight of 10 seconds should be sufficient. +if (`SELECT CURTIME() > SEC_TO_TIME(24 * 3600 - 10)`) { - # We are here when CURTIME() is between '23:59:56' and '23:59:59'. - # So a sleep time of 5 seconds brings us between '00:00:01' and '00:00:04'. - --real_sleep 5 + # We are here when CURTIME() is between '23:59:51' and '23:59:59'. + # So a sleep time of 10 seconds brings us between '00:00:01' and '00:00:09'. + --real_sleep 10 } create table t1 (f1 date, f2 datetime, f3 timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP); insert into t1(f1) values(curdate()); @@ -898,6 +898,35 @@ EXECUTE IMMEDIATE 'EXPLAIN EXTENDED SELECT * FROM t1 WHERE LENGTH(COALESCE(TIME' DROP TABLE t1; +--echo # +--echo # MDEV-17216 Assertion `!dt->fraction_remainder(decimals())' failed in Field_temporal_with_date::store_TIME_with_warning +--echo # + +CREATE TABLE t1 (b BIT(20)); +CREATE TABLE t2 (t DATETIME); +INSERT IGNORE INTO t1 VALUES (b'000001001100000'); +INSERT INTO t2 SELECT * FROM t1; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a DATETIME); +INSERT INTO t1 SELECT CAST(20010101 AS UNSIGNED); +DROP TABLE t1; + + +--echo # +--echo # MDEV-17563 Different results using table or view when comparing values of time type +--echo # + +CREATE TABLE t1 (pk int, x1 datetime, x2 varchar(1)); +INSERT INTO t1 VALUES (17,'2001-01-01 09:16:37',''); +INSERT INTO t1 VALUES (18,'2001-01-01 09:16:37','k'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT pk FROM t1 WHERE x1 >x2; +SELECT pk FROM v1 WHERE x1 >x2; +DROP VIEW v1; +DROP TABLE t1; + + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/type_datetime_round.result b/mysql-test/main/type_datetime_round.result new file mode 100644 index 00000000000..c6584223268 --- /dev/null +++ b/mysql-test/main/type_datetime_round.result @@ -0,0 +1,205 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; +# +# DATETIME: SET +# +CREATE TABLE t1 (a DATETIME(3), b DATETIME(4)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME(3), b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999'); +UPDATE t1 SET a=b; +Warnings: +Note 1265 Data truncated for column 'a' at row 2 +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a DATETIME(3), b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,20001231235959.9999); +INSERT INTO t1 VALUES(NULL,20001231235959.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +2001-01-01 00:00:00.000 +DROP TABLE t1; +# +# DATETIME: ALTER +# +CREATE TABLE t1 (a DATETIME(4)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +ALTER TABLE t1 MODIFY a DATETIME(3); +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +ALTER TABLE t1 MODIFY a DATETIME(3); +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +ALTER TABLE t1 MODIFY a DATETIME(3); +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +2001-01-01 00:00:00.000 +DROP TABLE t1; +# +# Corner case: +# ALTER DATETIME to a shorter DATETIME +# All values round, maximum possible value truncates. +# +SET time_zone='+00:00'; +CREATE TABLE t1 (ID INT, a DATETIME(6), comment VARCHAR(64)); +INSERT INTO t1 VALUES (0, '9999-12-30 23:59:58.999999', 'Should round'); +INSERT INTO t1 VALUES (1, '9999-12-31 22:59:59.999999', 'Should round'); +INSERT INTO t1 VALUES (2, '9999-12-31 23:59:58.999999', 'Should round'); +INSERT INTO t1 VALUES (3, '9999-12-31 23:59:59.999999', 'Should truncate'); +ALTER TABLE t1 MODIFY a DATETIME(5); +Warnings: +Warning 1264 Out of range value for column 'a' at row 4 +SELECT * FROM t1; +ID a comment +0 9999-12-30 23:59:59.00000 Should round +1 9999-12-31 23:00:00.00000 Should round +2 9999-12-31 23:59:59.00000 Should round +3 9999-12-31 23:59:59.99999 Should truncate +DROP TABLE t1; +SET time_zone=DEFAULT; +# +# NOW +# +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999'); +CREATE OR REPLACE TABLE t1 (id SERIAL, a DATETIME(4)); +INSERT INTO t1 (a) VALUES (now(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIME(6)); +SELECT * FROM t1; +id a +1 2011-01-01 00:00:00.0000 +2 2011-01-01 00:00:00.0000 +3 2011-01-01 00:00:00.0000 +DROP TABLE t1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; +# +# DATETIME: CAST +# +CREATE TABLE t1 (a DATETIME(4)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +SELECT a, CAST(a AS DATETIME(3)) FROM t1; +a CAST(a AS DATETIME(3)) +2000-12-31 23:59:59.9999 2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +SELECT a, CAST(a AS DATETIME(3)) FROM t1; +a CAST(a AS DATETIME(3)) +2000-12-31 23:59:59.9999 2001-01-01 00:00:00.000 +2000-12-31 23:59:59.9999999 2001-01-01 00:00:00.000 +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +SELECT a, CAST(a AS DATETIME(3)) FROM t1; +a CAST(a AS DATETIME(3)) +20001231235959.9999000000 2001-01-01 00:00:00.000 +20001231235959.9999999000 2001-01-01 00:00:00.000 +DROP TABLE t1; +# +# Equal field propagation +# +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES (20010101235959.999999); +INSERT INTO t1 VALUES (20010101235959.9999999); +SELECT * FROM t1 WHERE a=20010101235959.9999999; +a +2001-01-02 00:00:00.000000 +SELECT * FROM t1 WHERE a='20010101235959.9999999'; +a +2001-01-02 00:00:00.000000 +Warnings: +Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' +SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999'; +a +2001-01-02 00:00:00.000000 +Warnings: +Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' +Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' +SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000'; +a +2001-01-02 00:00:00.000000 +Warnings: +Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' +Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-02 00:00:00' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1292 Truncated incorrect datetime value: '20010101235959.9999999' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'2001-01-02 00:00:00' +DROP TABLE t1; +# +# Comparing non-temporal to DATETIME +# +CREATE TABLE t1 (a VARCHAR(64)); +INSERT t1 VALUES ('2001-01-01 23:59:59.9999999'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-02 00:00:00'; +a +2001-01-01 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +SELECT * FROM t1 WHERE CONCAT(a)=TIMESTAMP'2001-01-02 00:00:00'; +a +2001-01-01 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-02 00:00:00'; +a +2001-01-01 23:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(32,7)); +INSERT t1 VALUES (20010101235959.9999999); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-02 00:00:00'; +a +20010101235959.9999999 +SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-02 00:00:00'; +a +20010101235959.9999999 +DROP TABLE t1; +# +# Literal corner case +# +SELECT TIMESTAMP'9999-12-31 23:59:59.999999'; +TIMESTAMP'9999-12-31 23:59:59.999999' +9999-12-31 23:59:59.999999 +SELECT TIME'9999-12-31 23:59:59.9999999'; +ERROR HY000: Incorrect TIME value: '9999-12-31 23:59:59.9999999' diff --git a/mysql-test/main/type_datetime_round.test b/mysql-test/main/type_datetime_round.test new file mode 100644 index 00000000000..15aec2cf4e0 --- /dev/null +++ b/mysql-test/main/type_datetime_round.test @@ -0,0 +1,147 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; + +--echo # +--echo # DATETIME: SET +--echo # + +CREATE TABLE t1 (a DATETIME(3), b DATETIME(4)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DATETIME(3), b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DATETIME(3), b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,20001231235959.9999); +INSERT INTO t1 VALUES(NULL,20001231235959.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +--echo # +--echo # DATETIME: ALTER +--echo # + +CREATE TABLE t1 (a DATETIME(4)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +ALTER TABLE t1 MODIFY a DATETIME(3); +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +ALTER TABLE t1 MODIFY a DATETIME(3); +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +ALTER TABLE t1 MODIFY a DATETIME(3); +SELECT a FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Corner case: +--echo # ALTER DATETIME to a shorter DATETIME +--echo # All values round, maximum possible value truncates. +--echo # + +SET time_zone='+00:00'; +CREATE TABLE t1 (ID INT, a DATETIME(6), comment VARCHAR(64)); +INSERT INTO t1 VALUES (0, '9999-12-30 23:59:58.999999', 'Should round'); +INSERT INTO t1 VALUES (1, '9999-12-31 22:59:59.999999', 'Should round'); +INSERT INTO t1 VALUES (2, '9999-12-31 23:59:58.999999', 'Should round'); +INSERT INTO t1 VALUES (3, '9999-12-31 23:59:59.999999', 'Should truncate'); +ALTER TABLE t1 MODIFY a DATETIME(5); +SELECT * FROM t1; +DROP TABLE t1; +SET time_zone=DEFAULT; + + +--echo # +--echo # NOW +--echo # + +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999'); +CREATE OR REPLACE TABLE t1 (id SERIAL, a DATETIME(4)); +INSERT INTO t1 (a) VALUES (now(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIME(6)); +SELECT * FROM t1; +DROP TABLE t1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; + + +--echo # +--echo # DATETIME: CAST +--echo # + +CREATE TABLE t1 (a DATETIME(4)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +SELECT a, CAST(a AS DATETIME(3)) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +SELECT a, CAST(a AS DATETIME(3)) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +SELECT a, CAST(a AS DATETIME(3)) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Equal field propagation +--echo # + +CREATE TABLE t1 (a DATETIME(6)); +INSERT INTO t1 VALUES (20010101235959.999999); +INSERT INTO t1 VALUES (20010101235959.9999999); +SELECT * FROM t1 WHERE a=20010101235959.9999999; +SELECT * FROM t1 WHERE a='20010101235959.9999999'; +SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999'; +SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND a>='20010101235959.9999999'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='20010101235959.9999999' AND CONCAT(a)='2001-01-02 00:00:00.000000'; +DROP TABLE t1; + +--echo # +--echo # Comparing non-temporal to DATETIME +--echo # + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT t1 VALUES ('2001-01-01 23:59:59.9999999'); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-02 00:00:00'; +SELECT * FROM t1 WHERE CONCAT(a)=TIMESTAMP'2001-01-02 00:00:00'; +SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-02 00:00:00'; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(32,7)); +INSERT t1 VALUES (20010101235959.9999999); +SELECT * FROM t1 WHERE a=TIMESTAMP'2001-01-02 00:00:00'; +SELECT * FROM t1 WHERE COALESCE(a)=TIMESTAMP'2001-01-02 00:00:00'; +DROP TABLE t1; + +--echo # +--echo # Literal corner case +--echo # + +SELECT TIMESTAMP'9999-12-31 23:59:59.999999'; +--error ER_WRONG_VALUE +SELECT TIME'9999-12-31 23:59:59.9999999'; diff --git a/mysql-test/main/type_decimal.result b/mysql-test/main/type_decimal.result index dadaa5a4b77..769c59b197d 100644 --- a/mysql-test/main/type_decimal.result +++ b/mysql-test/main/type_decimal.result @@ -176,9 +176,9 @@ Note 1265 Data truncated for column 'a' at row 2 insert ignore into t1 values ("1e+18446744073709551615"),("1e+18446744073709551616"),("1e-9223372036854775807"),("1e-9223372036854775809"); Warnings: Warning 1264 Out of range value for column 'a' at row 1 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'a' at row 2 +Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t1`.`a` at row 2 Note 1265 Data truncated for column 'a' at row 3 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'a' at row 4 +Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t1`.`a` at row 4 insert ignore into t1 values ("123.4e"),("123.4e+2"),("123.4e-2"),("123e1"),("123e+0"); Warnings: Warning 1265 Data truncated for column 'a' at row 1 diff --git a/mysql-test/main/type_float.result b/mysql-test/main/type_float.result index 0ac018379d1..0ce54c0126c 100644 --- a/mysql-test/main/type_float.result +++ b/mysql-test/main/type_float.result @@ -448,6 +448,46 @@ select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; foo 0 # +# MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result +# +SELECT LEFT('a',EXP(50)); +LEFT('a',EXP(50)) +a +SELECT LEFT('a', COALESCE(1e30)); +LEFT('a', COALESCE(1e30)) +a +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (1e30); +SELECT LEFT('a',a), LEFT('a',1e30) FROM t1; +LEFT('a',a) LEFT('a',1e30) +a a +DROP TABLE t1; +PREPARE stmt FROM 'SELECT LEFT(111,?)'; +SET @a=1e30; +EXECUTE stmt USING @a; +LEFT(111,?) +111 +DEALLOCATE PREPARE stmt; +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1)); +LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1)) +a +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (1e30),(0); +SELECT LEFT('a', SUM(a)) FROM t1; +LEFT('a', SUM(a)) +a +Warnings: +Warning 1916 Got overflow when converting '1e30' to INT. Value truncated +SELECT LEFT('a', AVG(a)) FROM t1; +LEFT('a', AVG(a)) +a +Warnings: +Warning 1916 Got overflow when converting '5e29' to INT. Value truncated +DROP TABLE t1; +# # Bug #13500371 63704: CONVERSION OF '1.' TO A NUMBER GIVES ERROR 1265 # (WARN_DATA_TRUNCATED) # @@ -458,7 +498,7 @@ Warnings: Warning 1265 Data truncated for column 'f' at row 1 INSERT IGNORE INTO t1 VALUES ('.'); Warnings: -Warning 1366 Incorrect double value: '.' for column 'f' at row 1 +Warning 1366 Incorrect double value: '.' for column `test`.`t1`.`f` at row 1 SELECT * FROM t1 ORDER BY f; f 0 diff --git a/mysql-test/main/type_float.test b/mysql-test/main/type_float.test index 3d0131b3bb0..f42d3445e2a 100644 --- a/mysql-test/main/type_float.test +++ b/mysql-test/main/type_float.test @@ -332,6 +332,36 @@ eval select concat((truncate((-1.7976931348623157E+307),(0x1e))), select format(truncate('1.7976931348623157E+308',-12),1,'fr_BE') as foo; + +--echo # +--echo # MDEV-17249 MAKETIME(-1e50,0,0) returns a wrong result +--echo # + +SELECT LEFT('a',EXP(50)); +SELECT LEFT('a', COALESCE(1e30)); + +CREATE TABLE t1 (a FLOAT); +INSERT INTO t1 VALUES (1e30); +SELECT LEFT('a',a), LEFT('a',1e30) FROM t1; +DROP TABLE t1; + +PREPARE stmt FROM 'SELECT LEFT(111,?)'; +SET @a=1e30; +EXECUTE stmt USING @a; +DEALLOCATE PREPARE stmt; + +CREATE TABLE t1 (a INT); +INSERT INTO t1 VALUES (1),(2),(3); +SELECT LEFT('a',(SELECT 1e30 FROM t1 LIMIT 1)); +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES (1e30),(0); +SELECT LEFT('a', SUM(a)) FROM t1; +SELECT LEFT('a', AVG(a)) FROM t1; +DROP TABLE t1; + + --echo # --echo # Bug #13500371 63704: CONVERSION OF '1.' TO A NUMBER GIVES ERROR 1265 --echo # (WARN_DATA_TRUNCATED) diff --git a/mysql-test/main/type_interval.result b/mysql-test/main/type_interval.result new file mode 100644 index 00000000000..65c84022210 --- /dev/null +++ b/mysql-test/main/type_interval.result @@ -0,0 +1,83 @@ +# +# Start of 10.4 tests +# +# +# MDEV-17776 CAST(x AS INTERVAL DAY_SECOND(N)) +# +CREATE TABLE t1 (a VARCHAR(128)); +INSERT INTO t1 VALUES +('00:00:00'), +('+00:00:01'), +('-00:00:01'), +('838:59:59'), +('839:00:00'), +('2018:01:02'), +('87649415:59:59'), +('3652058 23:59:59'), +('87649416:00:00'), +('3652059 00:00:00'); +SELECT +EXTRACT(DAY FROM a) AS d, +EXTRACT(HOUR FROM a) AS h, +a, +CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds +FROM t1; +d h a cast_itds +0 0 00:00:00 00:00:00.000000 +0 0 +00:00:01 00:00:01.000000 +0 0 -00:00:01 -00:00:01.000000 +34 22 838:59:59 34 22:59:59.000000 +34 23 839:00:00 34 23:00:00.000000 +84 2 2018:01:02 84 02:01:02.000000 +3652058 23 87649415:59:59 3652058 23:59:59.000000 +3652058 23 3652058 23:59:59 3652058 23:59:59.000000 +NULL NULL 87649416:00:00 NULL +NULL NULL 3652059 00:00:00 NULL +Warnings: +Warning 1292 Incorrect interval value: '87649416:00:00' +Warning 1292 Incorrect interval value: '87649416:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '87649416:00:00' +Warning 1292 Incorrect interval value: '3652059 00:00:00' +Warning 1292 Incorrect interval value: '3652059 00:00:00' +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '3652059 00:00:00' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(32,9)); +INSERT INTO t1 VALUES +(0), +(1), +(-1), +(8385959), +(8390000), +(20180102), +(876494155959), +(876494160000); +SELECT +EXTRACT(DAY FROM a) AS d, +EXTRACT(HOUR FROM a) AS h, +a, +CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds +FROM t1; +d h a cast_itds +0 0 0.000000000 00:00:00.000000 +0 0 1.000000000 00:00:01.000000 +0 0 -1.000000000 -00:00:01.000000 +34 22 8385959.000000000 34 22:59:59.000000 +34 23 8390000.000000000 34 23:00:00.000000 +84 2 20180102.000000000 84 02:01:02.000000 +3652058 23 876494155959.000000000 3652058 23:59:59.000000 +NULL NULL 876494160000.000000000 NULL +Warnings: +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '0.000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '1.000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '-1.000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8385959.000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '8390000.000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '20180102.000000000' +Note 1292 Truncated incorrect INTERVAL DAY TO SECOND value: '876494155959.000000000' +Warning 1292 Incorrect interval value: '876494160000.000000000' for column `test`.`t1`.`a` at row 8 +Warning 1292 Incorrect interval value: '876494160000.000000000' for column `test`.`t1`.`a` at row 8 +Warning 1292 Incorrect INTERVAL DAY TO SECOND value: '876494160000.000000000' +DROP TABLE t1; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/type_interval.test b/mysql-test/main/type_interval.test new file mode 100644 index 00000000000..15999dc609d --- /dev/null +++ b/mysql-test/main/type_interval.test @@ -0,0 +1,54 @@ +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-17776 CAST(x AS INTERVAL DAY_SECOND(N)) +--echo # + +CREATE TABLE t1 (a VARCHAR(128)); +INSERT INTO t1 VALUES +('00:00:00'), +('+00:00:01'), +('-00:00:01'), +('838:59:59'), +('839:00:00'), +('2018:01:02'), +('87649415:59:59'), +('3652058 23:59:59'), +('87649416:00:00'), +('3652059 00:00:00'); + +SELECT + EXTRACT(DAY FROM a) AS d, + EXTRACT(HOUR FROM a) AS h, + a, + CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds +FROM t1; + +DROP TABLE t1; + + +CREATE TABLE t1 (a DECIMAL(32,9)); +INSERT INTO t1 VALUES +(0), +(1), +(-1), +(8385959), +(8390000), +(20180102), +(876494155959), +(876494160000); + +SELECT + EXTRACT(DAY FROM a) AS d, + EXTRACT(HOUR FROM a) AS h, + a, + CAST(a AS INTERVAL DAY_SECOND(6)) AS cast_itds +FROM t1; + +DROP TABLE t1; + +--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 ba84ff50504..44f200c229b 100644 --- a/mysql-test/main/type_newdecimal.result +++ b/mysql-test/main/type_newdecimal.result @@ -825,7 +825,7 @@ Warning 1365 Division by 0 Warning 1365 Division by 0 Warning 1365 Division by 0 INSERT INTO Sow6_2f VALUES ('a59b'); -ERROR 22007: Incorrect decimal value: 'a59b' for column 'col1' at row 1 +ERROR 22007: Incorrect decimal value: 'a59b' for column `test`.`Sow6_2f`.`col1` at row 1 drop table Sow6_2f; select 10.3330000000000/12.34500000; 10.3330000000000/12.34500000 @@ -1995,8 +1995,50 @@ select 0.0000000001 mod 1; select 0.01 mod 1; 0.01 mod 1 0.01 +CREATE TABLE t1 ( +`FLD1` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD2` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD3` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD4` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD5` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD6` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD7` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD8` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD9` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD10` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD11` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD12` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD13` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD14` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD15` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD16` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD17` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD18` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD19` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD20` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD21` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD22` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, +`FLD23` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000 +); +INSERT INTO t1 VALUES (001.0760,000.9500,001.0000,001.0000,001.0000, +001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.5949,001.0194, +001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.9220,001.1890,001.2130,327.2690); +select FLD1*FLD2*FLD3*FLD4*FLD5*FLD6*FLD7*FLD8*FLD9*FLD10*FLD11*FLD12*FLD13*FLD14*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD23 as calc1 from t1; +calc1 +269.77575757644053032218703200000000000000 +select FLD23*FLD2*FLD1*FLD4*FLD5*FLD11*FLD12*FLD13*FLD3*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD14*FLD6*FLD7*FLD8*FLD9*FLD10 as calc2 from t1; +calc2 +269.77575757644053032218703200000000000000 +DROP TABLE t1; +CREATE TABLE t1 AS SELECT 1.0 * 2.000; +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `1.0 * 2.000` decimal(6,4) NOT NULL +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +DROP TABLE t1; # -# Start of 10.0 tests +# End of 5.5 tests # # # MDEV-6950 Bad results with joins comparing DATE and INT/ENUM/VARCHAR columns diff --git a/mysql-test/main/type_newdecimal.test b/mysql-test/main/type_newdecimal.test index dd5311e4be3..56273a47b44 100644 --- a/mysql-test/main/type_newdecimal.test +++ b/mysql-test/main/type_newdecimal.test @@ -837,6 +837,7 @@ UPDATE Sow6_2f SET col1 = col1 / 0 WHERE col1 > 0; #-- should return SQLSTATE 22012 division by zero SELECT MOD(col1,0) FROM Sow6_2f; #-- should return SQLSTATE 22012 division by zero +--replace_result sow Sow -- error 1366 INSERT INTO Sow6_2f VALUES ('a59b'); #-- should return SQLSTATE 22018 invalid character value for cast @@ -1583,8 +1584,51 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1; select 0.0000000001 mod 1; select 0.01 mod 1; +# +# MDEV-17256 Decimal field multiplication bug +# + +CREATE TABLE t1 ( + `FLD1` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD2` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD3` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD4` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD5` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD6` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD7` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD8` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD9` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD10` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD11` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD12` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD13` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD14` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD15` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD16` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD17` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD18` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD19` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD20` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD21` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD22` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000, + `FLD23` decimal(7,4) unsigned zerofill NOT NULL DEFAULT 001.0000 +); + +INSERT INTO t1 VALUES (001.0760,000.9500,001.0000,001.0000,001.0000, + 001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.5949,001.0194, + 001.0000,001.0000,001.0000,001.0000,001.0000,001.0000,000.9220,001.1890,001.2130,327.2690); + +select FLD1*FLD2*FLD3*FLD4*FLD5*FLD6*FLD7*FLD8*FLD9*FLD10*FLD11*FLD12*FLD13*FLD14*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD23 as calc1 from t1; +select FLD23*FLD2*FLD1*FLD4*FLD5*FLD11*FLD12*FLD13*FLD3*FLD15*FLD16*FLD17*FLD18*FLD19*FLD20*FLD21*FLD22*FLD14*FLD6*FLD7*FLD8*FLD9*FLD10 as calc2 from t1; + +DROP TABLE t1; + +CREATE TABLE t1 AS SELECT 1.0 * 2.000; +SHOW CREATE TABLE t1; +DROP TABLE t1; + --echo # ---echo # Start of 10.0 tests +--echo # End of 5.5 tests --echo # --echo # diff --git a/mysql-test/main/type_num.result b/mysql-test/main/type_num.result index 966d94ee385..2dadb4f1f8d 100644 --- a/mysql-test/main/type_num.result +++ b/mysql-test/main/type_num.result @@ -42,171 +42,171 @@ Note 1265 Data truncated for column 'a' at row 1 DROP TABLE t1; CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES (''); -ERROR 22007: Incorrect double value: '' for column 'a' at row 1 +ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES (''); -ERROR 22007: Incorrect double value: '' for column 'a' at row 1 +ERROR 22007: Incorrect double value: '' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a TINYINT); INSERT INTO t1 VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a SMALLINT); INSERT INTO t1 VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES (''); -ERROR 22007: Incorrect integer value: '' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DECIMAL); INSERT INTO t1 VALUES (''); -ERROR 22007: Incorrect decimal value: '' for column 'a' at row 1 +ERROR 22007: Incorrect decimal value: '' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES ('x'); -ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1 +ERROR 22007: Incorrect double value: 'x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES ('x'); -ERROR 22007: Incorrect double value: 'x' for column 'a' at row 1 +ERROR 22007: Incorrect double value: 'x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a TINYINT); INSERT INTO t1 VALUES ('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a SMALLINT); INSERT INTO t1 VALUES ('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES ('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES ('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DECIMAL); INSERT INTO t1 VALUES ('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'a' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES (' x'); -ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1 +ERROR 22007: Incorrect double value: ' x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES (' x'); -ERROR 22007: Incorrect double value: ' x' for column 'a' at row 1 +ERROR 22007: Incorrect double value: ' x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a TINYINT); INSERT INTO t1 VALUES (' x'); -ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: ' x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a SMALLINT); INSERT INTO t1 VALUES (' x'); -ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: ' x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES (' x'); -ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: ' x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES (' x'); -ERROR 22007: Incorrect integer value: ' x' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: ' x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DECIMAL); INSERT INTO t1 VALUES (' x'); -ERROR 22007: Incorrect decimal value: ' x' for column 'a' at row 1 +ERROR 22007: Incorrect decimal value: ' x' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES ('.'); -ERROR 22007: Incorrect double value: '.' for column 'a' at row 1 +ERROR 22007: Incorrect double value: '.' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES ('.'); -ERROR 22007: Incorrect double value: '.' for column 'a' at row 1 +ERROR 22007: Incorrect double value: '.' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a TINYINT); INSERT INTO t1 VALUES ('.'); -ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '.' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a SMALLINT); INSERT INTO t1 VALUES ('.'); -ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '.' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES ('.'); -ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '.' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES ('.'); -ERROR 22007: Incorrect integer value: '.' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '.' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DECIMAL); INSERT INTO t1 VALUES ('.'); -ERROR 22007: Incorrect decimal value: '.' for column 'a' at row 1 +ERROR 22007: Incorrect decimal value: '.' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES ('-'); -ERROR 22007: Incorrect double value: '-' for column 'a' at row 1 +ERROR 22007: Incorrect double value: '-' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES ('-'); -ERROR 22007: Incorrect double value: '-' for column 'a' at row 1 +ERROR 22007: Incorrect double value: '-' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a TINYINT); INSERT INTO t1 VALUES ('-'); -ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a SMALLINT); INSERT INTO t1 VALUES ('-'); -ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES ('-'); -ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES ('-'); -ERROR 22007: Incorrect integer value: '-' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '-' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DECIMAL); INSERT INTO t1 VALUES ('-'); -ERROR 22007: Incorrect decimal value: '-' for column 'a' at row 1 +ERROR 22007: Incorrect decimal value: '-' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES ('+'); -ERROR 22007: Incorrect double value: '+' for column 'a' at row 1 +ERROR 22007: Incorrect double value: '+' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DOUBLE); INSERT INTO t1 VALUES ('+'); -ERROR 22007: Incorrect double value: '+' for column 'a' at row 1 +ERROR 22007: Incorrect double value: '+' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a TINYINT); INSERT INTO t1 VALUES ('+'); -ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a SMALLINT); INSERT INTO t1 VALUES ('+'); -ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a INT); INSERT INTO t1 VALUES ('+'); -ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES ('+'); -ERROR 22007: Incorrect integer value: '+' for column 'a' at row 1 +ERROR 22007: Incorrect integer value: '+' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a DECIMAL); INSERT INTO t1 VALUES ('+'); -ERROR 22007: Incorrect decimal value: '+' for column 'a' at row 1 +ERROR 22007: Incorrect decimal value: '+' for column `test`.`t1`.`a` at row 1 DROP TABLE t1; CREATE TABLE t1 (a FLOAT); INSERT INTO t1 VALUES ('1x'); @@ -425,58 +425,58 @@ Note 1265 Data truncated for column 'i8' at row 1 Note 1265 Data truncated for column 'd' at row 1 INSERT IGNORE INTO t1 VALUES ('','','','','','',''); Warnings: -Warning 1366 Incorrect double value: '' for column 'f4' at row 1 -Warning 1366 Incorrect double value: '' for column 'f8' at row 1 -Warning 1366 Incorrect integer value: '' for column 'i1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'i2' at row 1 -Warning 1366 Incorrect integer value: '' for column 'i4' at row 1 -Warning 1366 Incorrect integer value: '' for column 'i8' at row 1 -Warning 1366 Incorrect decimal value: '' for column 'd' at row 1 +Warning 1366 Incorrect double value: '' for column `test`.`t1`.`f4` at row 1 +Warning 1366 Incorrect double value: '' for column `test`.`t1`.`f8` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`i1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`i2` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`i4` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`i8` at row 1 +Warning 1366 Incorrect decimal value: '' for column `test`.`t1`.`d` at row 1 INSERT IGNORE INTO t1 VALUES ('x','x','x','x','x','x','x'); Warnings: -Warning 1366 Incorrect double value: 'x' for column 'f4' at row 1 -Warning 1366 Incorrect double value: 'x' for column 'f8' at row 1 -Warning 1366 Incorrect integer value: 'x' for column 'i1' at row 1 -Warning 1366 Incorrect integer value: 'x' for column 'i2' at row 1 -Warning 1366 Incorrect integer value: 'x' for column 'i4' at row 1 -Warning 1366 Incorrect integer value: 'x' for column 'i8' at row 1 -Warning 1366 Incorrect decimal value: 'x' for column 'd' at row 1 +Warning 1366 Incorrect double value: 'x' for column `test`.`t1`.`f4` at row 1 +Warning 1366 Incorrect double value: 'x' for column `test`.`t1`.`f8` at row 1 +Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`i1` at row 1 +Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`i2` at row 1 +Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`i4` at row 1 +Warning 1366 Incorrect integer value: 'x' for column `test`.`t1`.`i8` at row 1 +Warning 1366 Incorrect decimal value: 'x' for column `test`.`t1`.`d` at row 1 INSERT IGNORE INTO t1 VALUES (' x',' x',' x',' x',' x',' x',' x'); Warnings: -Warning 1366 Incorrect double value: ' x' for column 'f4' at row 1 -Warning 1366 Incorrect double value: ' x' for column 'f8' at row 1 -Warning 1366 Incorrect integer value: ' x' for column 'i1' at row 1 -Warning 1366 Incorrect integer value: ' x' for column 'i2' at row 1 -Warning 1366 Incorrect integer value: ' x' for column 'i4' at row 1 -Warning 1366 Incorrect integer value: ' x' for column 'i8' at row 1 -Warning 1366 Incorrect decimal value: ' x' for column 'd' at row 1 +Warning 1366 Incorrect double value: ' x' for column `test`.`t1`.`f4` at row 1 +Warning 1366 Incorrect double value: ' x' for column `test`.`t1`.`f8` at row 1 +Warning 1366 Incorrect integer value: ' x' for column `test`.`t1`.`i1` at row 1 +Warning 1366 Incorrect integer value: ' x' for column `test`.`t1`.`i2` at row 1 +Warning 1366 Incorrect integer value: ' x' for column `test`.`t1`.`i4` at row 1 +Warning 1366 Incorrect integer value: ' x' for column `test`.`t1`.`i8` at row 1 +Warning 1366 Incorrect decimal value: ' x' for column `test`.`t1`.`d` at row 1 INSERT IGNORE INTO t1 VALUES ('.','.','.','.','.','.','.'); Warnings: -Warning 1366 Incorrect double value: '.' for column 'f4' at row 1 -Warning 1366 Incorrect double value: '.' for column 'f8' at row 1 -Warning 1366 Incorrect integer value: '.' for column 'i1' at row 1 -Warning 1366 Incorrect integer value: '.' for column 'i2' at row 1 -Warning 1366 Incorrect integer value: '.' for column 'i4' at row 1 -Warning 1366 Incorrect integer value: '.' for column 'i8' at row 1 -Warning 1366 Incorrect decimal value: '.' for column 'd' at row 1 +Warning 1366 Incorrect double value: '.' for column `test`.`t1`.`f4` at row 1 +Warning 1366 Incorrect double value: '.' for column `test`.`t1`.`f8` at row 1 +Warning 1366 Incorrect integer value: '.' for column `test`.`t1`.`i1` at row 1 +Warning 1366 Incorrect integer value: '.' for column `test`.`t1`.`i2` at row 1 +Warning 1366 Incorrect integer value: '.' for column `test`.`t1`.`i4` at row 1 +Warning 1366 Incorrect integer value: '.' for column `test`.`t1`.`i8` at row 1 +Warning 1366 Incorrect decimal value: '.' for column `test`.`t1`.`d` at row 1 INSERT IGNORE INTO t1 VALUES ('-','-','-','-','-','-','-'); Warnings: -Warning 1366 Incorrect double value: '-' for column 'f4' at row 1 -Warning 1366 Incorrect double value: '-' for column 'f8' at row 1 -Warning 1366 Incorrect integer value: '-' for column 'i1' at row 1 -Warning 1366 Incorrect integer value: '-' for column 'i2' at row 1 -Warning 1366 Incorrect integer value: '-' for column 'i4' at row 1 -Warning 1366 Incorrect integer value: '-' for column 'i8' at row 1 -Warning 1366 Incorrect decimal value: '-' for column 'd' at row 1 +Warning 1366 Incorrect double value: '-' for column `test`.`t1`.`f4` at row 1 +Warning 1366 Incorrect double value: '-' for column `test`.`t1`.`f8` at row 1 +Warning 1366 Incorrect integer value: '-' for column `test`.`t1`.`i1` at row 1 +Warning 1366 Incorrect integer value: '-' for column `test`.`t1`.`i2` at row 1 +Warning 1366 Incorrect integer value: '-' for column `test`.`t1`.`i4` at row 1 +Warning 1366 Incorrect integer value: '-' for column `test`.`t1`.`i8` at row 1 +Warning 1366 Incorrect decimal value: '-' for column `test`.`t1`.`d` at row 1 INSERT IGNORE INTO t1 VALUES ('+','+','+','+','+','+','+'); Warnings: -Warning 1366 Incorrect double value: '+' for column 'f4' at row 1 -Warning 1366 Incorrect double value: '+' for column 'f8' at row 1 -Warning 1366 Incorrect integer value: '+' for column 'i1' at row 1 -Warning 1366 Incorrect integer value: '+' for column 'i2' at row 1 -Warning 1366 Incorrect integer value: '+' for column 'i4' at row 1 -Warning 1366 Incorrect integer value: '+' for column 'i8' at row 1 -Warning 1366 Incorrect decimal value: '+' for column 'd' at row 1 +Warning 1366 Incorrect double value: '+' for column `test`.`t1`.`f4` at row 1 +Warning 1366 Incorrect double value: '+' for column `test`.`t1`.`f8` at row 1 +Warning 1366 Incorrect integer value: '+' for column `test`.`t1`.`i1` at row 1 +Warning 1366 Incorrect integer value: '+' for column `test`.`t1`.`i2` at row 1 +Warning 1366 Incorrect integer value: '+' for column `test`.`t1`.`i4` at row 1 +Warning 1366 Incorrect integer value: '+' for column `test`.`t1`.`i8` at row 1 +Warning 1366 Incorrect decimal value: '+' for column `test`.`t1`.`d` at row 1 INSERT IGNORE INTO t1 VALUES ('1x','1x','1x','1x','1x','1x','1x'); Warnings: Warning 1265 Data truncated for column 'f4' at row 1 diff --git a/mysql-test/main/type_temporal_innodb.result b/mysql-test/main/type_temporal_innodb.result index b869822722d..f8d8bc018bd 100644 --- a/mysql-test/main/type_temporal_innodb.result +++ b/mysql-test/main/type_temporal_innodb.result @@ -56,7 +56,7 @@ SELECT DATE'0000-00-00'=''; DATE'0000-00-00'='' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' CREATE TABLE t1 (a ENUM('a'), b DATE, c INT, KEY(b)) ENGINE=InnoDB; INSERT IGNORE INTO t1 VALUES ('','0000-00-00',0); Warnings: @@ -65,49 +65,49 @@ SELECT * FROM t1 WHERE b=''; a b c 0000-00-00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; a b c 0000-00-00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT * FROM t1 WHERE a=b; a b c 0000-00-00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; 1 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' ALTER TABLE t1 ENGINE=MyISAM; SELECT * FROM t1 WHERE b=''; a b c 0000-00-00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; a b c 0000-00-00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT * FROM t1 WHERE a=b; a b c 0000-00-00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; 1 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' DROP TABLE t1; SELECT TIMESTAMP'0000-00-00 00:00:00'=''; TIMESTAMP'0000-00-00 00:00:00'='' 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' CREATE TABLE t1 (a ENUM('a'), b DATETIME, c INT, KEY(b)) ENGINE=InnoDB; INSERT IGNORE INTO t1 VALUES ('','0000-00-00 00:00:00',0); Warnings: @@ -116,43 +116,43 @@ SELECT * FROM t1 WHERE b=''; a b c 0000-00-00 00:00:00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; a b c 0000-00-00 00:00:00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT * FROM t1 WHERE a=b; a b c 0000-00-00 00:00:00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; 1 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' ALTER TABLE t1 ENGINE=MyISAM; SELECT * FROM t1 WHERE b=''; a b c 0000-00-00 00:00:00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT * FROM t1 IGNORE KEY (b) WHERE b=''; a b c 0000-00-00 00:00:00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT * FROM t1 WHERE a=b; a b c 0000-00-00 00:00:00 0 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' SELECT 1 FROM t1 WHERE (SELECT a FROM t1 group by c) = b; 1 1 Warnings: -Warning 1292 Incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' DROP TABLE t1; CREATE TABLE t1 (d DATE) ENGINE=InnoDB; INSERT INTO t1 VALUES ('2012-12-21'); diff --git a/mysql-test/main/type_time.result b/mysql-test/main/type_time.result index 6d26ee1fdaa..725b25f4f42 100644 --- a/mysql-test/main/type_time.result +++ b/mysql-test/main/type_time.result @@ -320,7 +320,7 @@ DROP TABLE t2,t1; SET sql_mode=traditional; CREATE TABLE t1 (a TIME(6)); INSERT INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED)); -ERROR 22007: Incorrect time value: '18446744069414584320' for column 'a' at row 1 +ERROR 22007: Incorrect time value: '18446744069414584320' for column `test`.`t1`.`a` at row 1 SET sql_mode=DEFAULT; INSERT IGNORE INTO t1 VALUES (CAST(0xFFFFFFFF00000000 AS UNSIGNED)); Warnings: @@ -1179,7 +1179,7 @@ SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1; CAST(a AS TIME) CAST(-9223372036854775808 AS TIME) -838:59:59 -838:59:59 Warnings: -Warning 1292 Incorrect time value: '-9223372036854775808' for column 'a' at row 1 +Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1`.`a` at row 1 Warning 1292 Truncated incorrect time value: '-9223372036854775808' DROP TABLE t1; CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE); @@ -1196,12 +1196,12 @@ a TIME(a) TIME(b) TIME(c) 9 00:00:09 00:00:09 00:00:09.000000 9000000 838:59:59 838:59:59 838:59:59.999999 Warnings: -Warning 1292 Incorrect time value: '-9000000' for column 'a' at row 1 -Warning 1292 Incorrect time value: '-9000000' for column 'b' at row 1 -Warning 1292 Incorrect time value: '-9000000' for column 'c' at row 1 -Warning 1292 Incorrect time value: '9000000' for column 'a' at row 6 -Warning 1292 Incorrect time value: '9000000' for column 'b' at row 6 -Warning 1292 Incorrect time value: '9000000' for column 'c' at row 6 +Warning 1292 Incorrect time value: '-9000000' for column `test`.`t1`.`a` at row 1 +Warning 1292 Incorrect time value: '-9000000' for column `test`.`t1`.`b` at row 1 +Warning 1292 Incorrect time value: '-9000000' for column `test`.`t1`.`c` at row 1 +Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`a` at row 6 +Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`b` at row 6 +Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`c` at row 6 DROP TABLE t1; CREATE TABLE t1 (a INT, b DECIMAL, c DOUBLE); INSERT INTO t1 VALUES (0,0,0),(1,1,1),(9,9,9); @@ -1213,9 +1213,9 @@ a TIME(a) TIME(b) TIME(c) 9 00:00:09 00:00:09 00:00:09.000000 9000000 838:59:59 838:59:59 838:59:59.999999 Warnings: -Warning 1292 Incorrect time value: '9000000' for column 'a' at row 4 -Warning 1292 Incorrect time value: '9000000' for column 'b' at row 4 -Warning 1292 Incorrect time value: '9000000' for column 'c' at row 4 +Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`a` at row 4 +Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`b` at row 4 +Warning 1292 Incorrect time value: '9000000' for column `test`.`t1`.`c` at row 4 DROP TABLE t1; # # MDEV-8862 Wrong field type for MAX(COALESCE(datetime_column)) @@ -1463,9 +1463,9 @@ GREATEST('2010-01-01 10:10:10',TIME('-20:20:20')) AS gt_minus20_implicit, GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-20:20:20')) AS gt_minis20_explicit, GREATEST('2010-01-01 10:10:10',TIME('20:20:20')) AS gt_plus20_implicit, GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('20:20:20')) AS gt_plus20_explicit; -gt_minus20_implicit 10:10:10.000000 +gt_minus20_implicit 10:10:10 gt_minis20_explicit 10:10:10.000000 -gt_plus20_implicit 20:20:20.000000 +gt_plus20_implicit 20:20:20 gt_plus20_explicit 20:20:20.000000 SELECT HOUR(GREATEST('2010-01-01 10:10:10',TIME('-20:20:20'))) AS gt_minus20_implicit, @@ -1481,9 +1481,9 @@ LEAST('2010-01-01 10:10:10',TIME('-20:20:20')) AS lt_minus20_implicit, LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-20:20:20')) AS lt_minus20_explicit, LEAST('2010-01-01 10:10:10',TIME('20:20:20')) AS lt_plus20_implicit, LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('20:20:20')) AS lt_plus20_explicit; -lt_minus20_implicit -20:20:20.000000 +lt_minus20_implicit -20:20:20 lt_minus20_explicit -20:20:20.000000 -lt_plus20_implicit 10:10:10.000000 +lt_plus20_implicit 10:10:10 lt_plus20_explicit 10:10:10.000000 SELECT HOUR(LEAST('2010-01-01 10:10:10',TIME('-20:20:20'))) AS lt_minus20_implicit, @@ -1499,9 +1499,9 @@ GREATEST('2010-01-01 10:10:10',TIME('-200:20:20')) AS gt_minus200_implicit, GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-200:20:20')) AS gt_minus200_explictit, GREATEST('2010-01-01 10:10:10',TIME('200:20:20')) AS gt_plus200_implicit, GREATEST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('200:20:20')) AS gt_plus200_explicit; -gt_minus200_implicit 10:10:10.000000 +gt_minus200_implicit 10:10:10 gt_minus200_explictit 10:10:10.000000 -gt_plus200_implicit 200:20:20.000000 +gt_plus200_implicit 200:20:20 gt_plus200_explicit 200:20:20.000000 SELECT HOUR(GREATEST('2010-01-01 10:10:10',TIME('-200:20:20'))) AS gt_minus200_implicit, @@ -1517,9 +1517,9 @@ LEAST('2010-01-01 10:10:10',TIME('-200:20:20')) AS lt_minus200_implicit, LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('-200:20:20')) AS lt_minus200_explictit, LEAST('2010-01-01 10:10:10',TIME('200:20:20')) AS lt_plus200_implicit, LEAST(CAST('2010-01-01 10:10:10' AS TIME(6)),TIME('200:20:20')) AS lt_plus200_explicit; -lt_minus200_implicit -200:20:20.000000 +lt_minus200_implicit -200:20:20 lt_minus200_explictit -200:20:20.000000 -lt_plus200_implicit 10:10:10.000000 +lt_plus200_implicit 10:10:10 lt_plus200_explicit 10:10:10.000000 SELECT HOUR(LEAST('2010-01-01 10:10:10',TIME('-200:20:20'))) AS lt_minus200_implicit, @@ -2076,5 +2076,115 @@ d1 t1 d1 UPDATE (t1 JOIN t2 ON (t2.d1 = t1.t1)) SET t1.d1 = '2018-07-07' WHERE (t1.d1 > 70 ); DROP TABLE t1,t2; # +# MDEV-17219 Assertion `!t->fraction_remainder(decimals())' failed in Field_time::store_TIME_with_warning +# +SET optimizer_use_condition_selectivity=3; +CREATE TABLE t1 (it TIME NOT NULL); +INSERT INTO t1 VALUES ('07:25:13'),('05:15:55'),('09:58:01'),('04:23:57'),('19:37:28'),('01:38:05'),('20:50:52'); +SELECT 1 FROM t1 WHERE it < -7487797330456870912; +1 +Warnings: +Warning 1292 Truncated incorrect time value: '-7487797330456870912' +DROP TABLE t1; +SET optimizer_use_condition_selectivity=DEFAULT; +# +# MDEV-17417 TIME(99991231235959) returns 838:59:59 instead of 23:59:58 +# +SELECT TIME(99991231235957), TIME(99991231235958), TIME(99991231235959); +TIME(99991231235957) TIME(99991231235958) TIME(99991231235959) +23:59:57 23:59:58 23:59:59 +# +# MDEV-17634 Regression: TIME(0)=TIME('z') returns NULL vs 1 +# +SELECT +TIMESTAMP(0)=TIMESTAMP('z') AS ts, +DATE(0)=DATE('z') AS d, +TIME(0)=TIME('z') AS t; +ts d t +1 1 1 +Warnings: +Warning 1292 Truncated incorrect datetime value: 'z' +Warning 1292 Truncated incorrect datetime value: 'z' +Warning 1292 Truncated incorrect time value: 'z' +SELECT +TIMESTAMP(0)=TIMESTAMP('') AS ts, +DATE(0)=DATE('') AS d, +TIME(0)=TIME('') AS t; +ts d t +1 1 1 +Warnings: +Warning 1292 Truncated incorrect datetime value: '' +Warning 1292 Truncated incorrect datetime value: '' +Warning 1292 Truncated incorrect time value: '' +# +# MDEV-17563 Different results using table or view when comparing values of time type +# +CREATE TABLE t1 (pk int, x1 time, x2 varchar(1)); +INSERT INTO t1 VALUES (17,'09:16:37','k'),(70,'19:44:22','k'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT pk FROM t1 WHERE x1 >x2; +pk +17 +70 +Warnings: +Warning 1292 Truncated incorrect time value: 'k' +Warning 1292 Truncated incorrect time value: 'k' +SELECT pk FROM v1 WHERE x1 >x2; +pk +17 +70 +Warnings: +Warning 1292 Truncated incorrect time value: 'k' +Warning 1292 Truncated incorrect time value: 'k' +DROP VIEW v1; +DROP TABLE t1; +CREATE TABLE t1 (pk int, x1 time, x2 varchar(1)); +INSERT INTO t1 VALUES (17,'09:16:37',''),(70,'19:44:22','k'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT pk FROM t1 WHERE x1 >x2; +pk +17 +70 +Warnings: +Warning 1292 Truncated incorrect time value: '' +Warning 1292 Truncated incorrect time value: 'k' +SELECT pk FROM v1 WHERE x1 >x2; +pk +17 +70 +Warnings: +Warning 1292 Truncated incorrect time value: '' +Warning 1292 Truncated incorrect time value: 'k' +DROP VIEW IF EXISTS v1; +DROP TABLE IF EXISTS t1; +# +# MDEV-17625 Different warnings when comparing a garbage to DATETIME vs TIME +# +SELECT TIMESTAMP(0)='z', DATE(0)='z', TIME(0)='z'; +TIMESTAMP(0)='z' DATE(0)='z' TIME(0)='z' +1 1 1 +Warnings: +Warning 1292 Truncated incorrect datetime value: 'z' +Warning 1292 Truncated incorrect datetime value: 'z' +Warning 1292 Truncated incorrect time value: 'z' +# +# MDEV-17319 Assertion `ts_type != MYSQL_TIMESTAMP_TIME' failed upon inserting into TIME field +# +CREATE TABLE t1 (t TIME); +SET SESSION SQL_MODE='TRADITIONAL'; +INSERT INTO t1 VALUES ('0000-00-00 00:00:00'),('0000-00-00 00:00:00'); +ERROR 22007: Incorrect time value: '0000-00-00 00:00:00' for column `test`.`t1`.`t` at row 1 +SET sql_mode=DEFAULT; +DROP TABLE t1; +# +# MDEV-18070 Assertion `nanoseconds <= 1000000000' failed in Temporal::add_nanoseconds_ssff with TIME_ROUND_FRACTIONAL +# +CREATE TABLE t1 (t TIME); +SET SQL_MODE= 'TIME_ROUND_FRACTIONAL'; +INSERT INTO t1 VALUES (3e19); +Warnings: +Warning 1264 Out of range value for column 't' at row 1 +DROP TABLE t1; +# # End of 10.4 tests # diff --git a/mysql-test/main/type_time.test b/mysql-test/main/type_time.test index 6a3f6984583..7eb75b95af2 100644 --- a/mysql-test/main/type_time.test +++ b/mysql-test/main/type_time.test @@ -1351,6 +1351,85 @@ SELECT * FROM (t1 JOIN t2 ON (t2.d1 = t1.t1)) WHERE (t1.d1 > 70 ); UPDATE (t1 JOIN t2 ON (t2.d1 = t1.t1)) SET t1.d1 = '2018-07-07' WHERE (t1.d1 > 70 ); DROP TABLE t1,t2; +--echo # +--echo # MDEV-17219 Assertion `!t->fraction_remainder(decimals())' failed in Field_time::store_TIME_with_warning +--echo # +SET optimizer_use_condition_selectivity=3; +CREATE TABLE t1 (it TIME NOT NULL); +INSERT INTO t1 VALUES ('07:25:13'),('05:15:55'),('09:58:01'),('04:23:57'),('19:37:28'),('01:38:05'),('20:50:52'); +SELECT 1 FROM t1 WHERE it < -7487797330456870912; +DROP TABLE t1; +SET optimizer_use_condition_selectivity=DEFAULT; + +--echo # +--echo # MDEV-17417 TIME(99991231235959) returns 838:59:59 instead of 23:59:58 +--echo # +SELECT TIME(99991231235957), TIME(99991231235958), TIME(99991231235959); + +--echo # +--echo # MDEV-17634 Regression: TIME(0)=TIME('z') returns NULL vs 1 +--echo # +SELECT + TIMESTAMP(0)=TIMESTAMP('z') AS ts, + DATE(0)=DATE('z') AS d, + TIME(0)=TIME('z') AS t; + +SELECT + TIMESTAMP(0)=TIMESTAMP('') AS ts, + DATE(0)=DATE('') AS d, + TIME(0)=TIME('') AS t; + + +--echo # +--echo # MDEV-17563 Different results using table or view when comparing values of time type +--echo # + +CREATE TABLE t1 (pk int, x1 time, x2 varchar(1)); +INSERT INTO t1 VALUES (17,'09:16:37','k'),(70,'19:44:22','k'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT pk FROM t1 WHERE x1 >x2; +SELECT pk FROM v1 WHERE x1 >x2; +DROP VIEW v1; +DROP TABLE t1; + + +CREATE TABLE t1 (pk int, x1 time, x2 varchar(1)); +INSERT INTO t1 VALUES (17,'09:16:37',''),(70,'19:44:22','k'); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT pk FROM t1 WHERE x1 >x2; +SELECT pk FROM v1 WHERE x1 >x2; +DROP VIEW IF EXISTS v1; +DROP TABLE IF EXISTS t1; + + +--echo # +--echo # MDEV-17625 Different warnings when comparing a garbage to DATETIME vs TIME +--echo # + +SELECT TIMESTAMP(0)='z', DATE(0)='z', TIME(0)='z'; + + +--echo # +--echo # MDEV-17319 Assertion `ts_type != MYSQL_TIMESTAMP_TIME' failed upon inserting into TIME field +--echo # + +CREATE TABLE t1 (t TIME); +SET SESSION SQL_MODE='TRADITIONAL'; +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('0000-00-00 00:00:00'),('0000-00-00 00:00:00'); +SET sql_mode=DEFAULT; +DROP TABLE t1; + +--echo # +--echo # MDEV-18070 Assertion `nanoseconds <= 1000000000' failed in Temporal::add_nanoseconds_ssff with TIME_ROUND_FRACTIONAL +--echo # + +CREATE TABLE t1 (t TIME); +SET SQL_MODE= 'TIME_ROUND_FRACTIONAL'; +INSERT INTO t1 VALUES (3e19); +DROP TABLE t1; + + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/type_time_round.result b/mysql-test/main/type_time_round.result new file mode 100644 index 00000000000..31e97c888db --- /dev/null +++ b/mysql-test/main/type_time_round.result @@ -0,0 +1,260 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; +# +# TIME: SET +# +CREATE TABLE t1 (a TIME(3), b TIME(4)); +INSERT INTO t1 VALUES(NULL,'00:00:00.9999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a TIME(3), b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'00:00:00.9999'); +INSERT INTO t1 VALUES(NULL,'00:00:00.9999999'); +UPDATE t1 SET a=b; +Warnings: +Note 1265 Data truncated for column 'a' at row 2 +SELECT a FROM t1; +a +00:00:01.000 +00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a TIME(3), b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,0.9999); +INSERT INTO t1 VALUES(NULL,0.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +00:00:01.000 +00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a TIME(3), b DOUBLE); +INSERT INTO t1 VALUES(NULL,0.9999); +INSERT INTO t1 VALUES(NULL,0.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +00:00:01.000 +00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a TIME(6), b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'00:00:00.9999999'); +UPDATE t1 SET a=b; +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +SELECT a FROM t1; +a +00:00:01.000000 +DROP TABLE t1; +CREATE TABLE t1 (a TIME(6), b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,0.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +00:00:01.000000 +DROP TABLE t1; +CREATE TABLE t1 (a TIME(6), b DOUBLE); +INSERT INTO t1 VALUES(NULL,0.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +00:00:01.000000 +DROP TABLE t1; +# +# TIME: ALTER +# +CREATE TABLE t1 (a TIME(4)); +INSERT INTO t1 VALUES('00:00:00.9999'); +ALTER TABLE t1 MODIFY a TIME(3); +SELECT a FROM t1; +a +00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('00:00:00.9999'); +INSERT INTO t1 VALUES('00:00:00.9999999'); +ALTER TABLE t1 MODIFY a TIME(3); +Warnings: +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +SELECT a FROM t1; +a +00:00:01.000 +00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(0.9999); +INSERT INTO t1 VALUES(0.9999999); +ALTER TABLE t1 MODIFY a TIME(3); +SELECT a FROM t1; +a +00:00:01.000 +00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES(0.9999); +INSERT INTO t1 VALUES(0.9999999); +ALTER TABLE t1 MODIFY a TIME(3); +Warnings: +Note 1265 Data truncated for column 'a' at row 2 +SELECT a FROM t1; +a +00:00:01.000 +00:00:01.000 +DROP TABLE t1; +# +# TIME: CAST +# +CREATE TABLE t1 (a TIME(4)); +INSERT INTO t1 VALUES('00:00:00.9999'); +SELECT a, CAST(a AS TIME(3)) FROM t1; +a CAST(a AS TIME(3)) +00:00:00.9999 00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('00:00:00.9999'); +INSERT INTO t1 VALUES('00:00:00.9999999'); +SELECT a, CAST(a AS TIME(3)) FROM t1; +a CAST(a AS TIME(3)) +00:00:00.9999 00:00:01.000 +00:00:00.9999999 00:00:01.000 +Warnings: +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(0.9999); +INSERT INTO t1 VALUES(0.9999999); +SELECT a, CAST(a AS TIME(3)) FROM t1; +a CAST(a AS TIME(3)) +0.9999000000 00:00:01.000 +0.9999999000 00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES(0.9999); +INSERT INTO t1 VALUES(0.9999999); +SELECT a, CAST(a AS TIME(3)) FROM t1; +a CAST(a AS TIME(3)) +0.9999 00:00:01.000 +0.9999999 00:00:01.000 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('00:00:00.9999999'); +SELECT a, CAST(a AS TIME(6)) FROM t1; +a CAST(a AS TIME(6)) +00:00:00.9999999 00:00:01.000000 +Warnings: +Note 1292 Truncated incorrect time value: '00:00:00.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(0.9999999); +SELECT a, CAST(a AS TIME(6)) FROM t1; +a CAST(a AS TIME(6)) +0.9999999000 00:00:01.000000 +DROP TABLE t1; +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES(0.9999999); +SELECT a, CAST(a AS TIME(6)) FROM t1; +a CAST(a AS TIME(6)) +0.9999999 00:00:01.000000 +DROP TABLE t1; +# +# NOW +# +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999'); +CREATE OR REPLACE TABLE t1 (id SERIAL, a TIME(4)); +INSERT INTO t1 (a) VALUES (now(6)); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6)); +Warnings: +Note 1265 Data truncated for column 'a' at row 1 +INSERT INTO t1 (a) VALUES (CURRENT_TIME(6)); +SELECT * FROM t1; +id a +1 24:00:00.0000 +2 24:00:00.0000 +3 24:00:00.0000 +DROP TABLE t1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; +# +# Equal field propagation +# +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES (0.999999); +INSERT INTO t1 VALUES (0.9999999); +SELECT * FROM t1 WHERE a=0.9999999; +a +00:00:01.000000 +SELECT * FROM t1 WHERE a='0.9999999'; +a +00:00:01.000000 +Warnings: +Note 1292 Truncated incorrect time value: '0.9999999' +SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999'; +a +00:00:01.000000 +Warnings: +Note 1292 Truncated incorrect time value: '0.9999999' +Note 1292 Truncated incorrect time value: '0.9999999' +SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000'; +a +00:00:01.000000 +Warnings: +Note 1292 Truncated incorrect time value: '0.9999999' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1292 Truncated incorrect time value: '0.9999999' +Note 1292 Truncated incorrect time value: '0.9999999' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:01' +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where +Warnings: +Note 1292 Truncated incorrect time value: '0.9999999' +Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIME'00:00:01' +DROP TABLE t1; +# +# Comparing non-temporal to TIME +# +CREATE TABLE t1 (a VARCHAR(64)); +INSERT t1 VALUES ('22:59:59.9999999'); +SELECT * FROM t1 WHERE a=TIME'23:00:00'; +a +22:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect time value: '22:59:59.9999999' +SELECT * FROM t1 WHERE CONCAT(a)=TIME'23:00:00'; +a +22:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect time value: '22:59:59.9999999' +SELECT * FROM t1 WHERE COALESCE(a)=TIME'23:00:00'; +a +22:59:59.9999999 +Warnings: +Note 1292 Truncated incorrect time value: '22:59:59.9999999' +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(32,7)); +INSERT t1 VALUES (225959.9999999); +SELECT * FROM t1 WHERE a=TIME'23:00:00'; +a +225959.9999999 +SELECT * FROM t1 WHERE COALESCE(a)=TIME'23:00:00'; +a +225959.9999999 +DROP TABLE t1; +# +# Literal corner case +# +SELECT TIME'838:59:59.999999'; +TIME'838:59:59.999999' +838:59:59.999999 +SELECT TIME'838:59:59.9999999'; +ERROR HY000: Incorrect TIME value: '838:59:59.9999999' +SELECT TIME'839:00:00'; +ERROR HY000: Incorrect TIME value: '839:00:00' diff --git a/mysql-test/main/type_time_round.test b/mysql-test/main/type_time_round.test new file mode 100644 index 00000000000..6d4b2d8947a --- /dev/null +++ b/mysql-test/main/type_time_round.test @@ -0,0 +1,184 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; + +--echo # +--echo # TIME: SET +--echo # + +CREATE TABLE t1 (a TIME(3), b TIME(4)); +INSERT INTO t1 VALUES(NULL,'00:00:00.9999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIME(3), b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'00:00:00.9999'); +INSERT INTO t1 VALUES(NULL,'00:00:00.9999999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIME(3), b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,0.9999); +INSERT INTO t1 VALUES(NULL,0.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIME(3), b DOUBLE); +INSERT INTO t1 VALUES(NULL,0.9999); +INSERT INTO t1 VALUES(NULL,0.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIME(6), b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'00:00:00.9999999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIME(6), b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,0.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIME(6), b DOUBLE); +INSERT INTO t1 VALUES(NULL,0.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +--echo # +--echo # TIME: ALTER +--echo # + +CREATE TABLE t1 (a TIME(4)); +INSERT INTO t1 VALUES('00:00:00.9999'); +ALTER TABLE t1 MODIFY a TIME(3); +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('00:00:00.9999'); +INSERT INTO t1 VALUES('00:00:00.9999999'); +ALTER TABLE t1 MODIFY a TIME(3); +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(0.9999); +INSERT INTO t1 VALUES(0.9999999); +ALTER TABLE t1 MODIFY a TIME(3); +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES(0.9999); +INSERT INTO t1 VALUES(0.9999999); +ALTER TABLE t1 MODIFY a TIME(3); +SELECT a FROM t1; +DROP TABLE t1; + +--echo # +--echo # TIME: CAST +--echo # + +CREATE TABLE t1 (a TIME(4)); +INSERT INTO t1 VALUES('00:00:00.9999'); +SELECT a, CAST(a AS TIME(3)) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('00:00:00.9999'); +INSERT INTO t1 VALUES('00:00:00.9999999'); +SELECT a, CAST(a AS TIME(3)) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(0.9999); +INSERT INTO t1 VALUES(0.9999999); +SELECT a, CAST(a AS TIME(3)) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES(0.9999); +INSERT INTO t1 VALUES(0.9999999); +SELECT a, CAST(a AS TIME(3)) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('00:00:00.9999999'); +SELECT a, CAST(a AS TIME(6)) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(0.9999999); +SELECT a, CAST(a AS TIME(6)) FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DOUBLE); +INSERT INTO t1 VALUES(0.9999999); +SELECT a, CAST(a AS TIME(6)) FROM t1; +DROP TABLE t1; + + +--echo # +--echo # NOW +--echo # + +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999'); +CREATE OR REPLACE TABLE t1 (id SERIAL, a TIME(4)); +INSERT INTO t1 (a) VALUES (now(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIME(6)); +SELECT * FROM t1; +DROP TABLE t1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; + + +--echo # +--echo # Equal field propagation +--echo # + +CREATE TABLE t1 (a TIME(6)); +INSERT INTO t1 VALUES (0.999999); +INSERT INTO t1 VALUES (0.9999999); +SELECT * FROM t1 WHERE a=0.9999999; +SELECT * FROM t1 WHERE a='0.9999999'; +SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999'; +SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND a>='0.9999999'; +EXPLAIN EXTENDED SELECT * FROM t1 WHERE a='0.9999999' AND CONCAT(a)='00:00:01.000000'; +DROP TABLE t1; + + +--echo # +--echo # Comparing non-temporal to TIME +--echo # + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT t1 VALUES ('22:59:59.9999999'); +SELECT * FROM t1 WHERE a=TIME'23:00:00'; +SELECT * FROM t1 WHERE CONCAT(a)=TIME'23:00:00'; +SELECT * FROM t1 WHERE COALESCE(a)=TIME'23:00:00'; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(32,7)); +INSERT t1 VALUES (225959.9999999); +SELECT * FROM t1 WHERE a=TIME'23:00:00'; +SELECT * FROM t1 WHERE COALESCE(a)=TIME'23:00:00'; +DROP TABLE t1; + +--echo # +--echo # Literal corner case +--echo # + +SELECT TIME'838:59:59.999999'; +--error ER_WRONG_VALUE +SELECT TIME'838:59:59.9999999'; +--error ER_WRONG_VALUE +SELECT TIME'839:00:00'; diff --git a/mysql-test/main/type_timestamp.result b/mysql-test/main/type_timestamp.result index 6fcc802b91a..c2af8952f4f 100644 --- a/mysql-test/main/type_timestamp.result +++ b/mysql-test/main/type_timestamp.result @@ -766,7 +766,7 @@ SET sql_mode=DEFAULT; CREATE TABLE t1 (a TIMESTAMP DEFAULT '0000-00-00 00:00:00'); SET sql_mode=TRADITIONAL; INSERT INTO t1 VALUES ('0000-00-00 00:00:00'); -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`a` at row 1 INSERT INTO t1 VALUES (); ERROR 22007: Incorrect default value '0000-00-00 00:00:00' for column 'a' INSERT INTO t1 VALUES (DEFAULT); @@ -807,7 +807,7 @@ CREATE TABLE t1 (a TIMESTAMP);; INSERT INTO t1 VALUES (0); SET sql_mode='TRADITIONAL'; CREATE TABLE t2 AS SELECT * FROM t1; -ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column 'a' at row 1 +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t2`.`a` at row 1 DROP TABLE t1; # # End of MDEV-8373 Zero date can be inserted in strict no-zero mode through CREATE TABLE AS SELECT timestamp_field @@ -872,7 +872,7 @@ SELECT * FROM t1 WHERE LENGTH(a)=30+RAND() AND a=' garbage '; id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE t1 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: -Warning 1292 Incorrect datetime value: ' garbage ' +Warning 1292 Truncated incorrect datetime value: ' garbage ' Note 1003 select `test`.`t1`.`a` AS `a` from `test`.`t1` where `test`.`t1`.`a` = TIMESTAMP'0000-00-00 00:00:00' and (octet_length(TIMESTAMP'0000-00-00 00:00:00')) = 30 + rand() DROP TABLE t1; CREATE TABLE t1 (a TIMESTAMP);; @@ -1018,3 +1018,151 @@ DROP TABLE t1; # # End of 10.3 tests # +# +# Start of 10.4 tests +# +# +# MDEV-17216 Assertion `!dt->fraction_remainder(decimals())' failed in Field_temporal_with_date::store_TIME_with_warning +# +CREATE TABLE t1 (b BIT(20)); +CREATE TABLE t2 (t TIMESTAMP); +INSERT IGNORE INTO t1 VALUES (b'000001001100000'); +INSERT INTO t2 SELECT * FROM t1; +DROP TABLE t1, t2; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 SELECT CAST(20010101 AS UNSIGNED); +DROP TABLE t1; +# +# MDEV-17928 Conversion from TIMESTAMP to VARCHAR SP variables does not work well on fractional digits +# +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456'); +CREATE PROCEDURE p1() +BEGIN +DECLARE ts10 TIMESTAMP(1) DEFAULT NOW(); +DECLARE ts16 TIMESTAMP(1) DEFAULT NOW(6); +DECLARE dt10 DATETIME(1) DEFAULT NOW(); +DECLARE dt16 DATETIME(1) DEFAULT NOW(6); +DECLARE vts10 VARCHAR(32) DEFAULT ts10; +DECLARE vts16 VARCHAR(32) DEFAULT ts16; +DECLARE vdt10 VARCHAR(32) DEFAULT dt10; +DECLARE vdt16 VARCHAR(32) DEFAULT dt16; +DECLARE tts10 TEXT(32) DEFAULT ts10; +DECLARE tts16 TEXT(32) DEFAULT ts16; +DECLARE tdt10 TEXT(32) DEFAULT dt10; +DECLARE tdt16 TEXT(32) DEFAULT dt16; +SELECT vts10, vts16, vdt10, vdt16; +SELECT tts10, tts16, tdt10, tdt16; +END; +$$ +CALL p1; +vts10 2001-01-01 10:20:30.0 +vts16 2001-01-01 10:20:30.1 +vdt10 2001-01-01 10:20:30.0 +vdt16 2001-01-01 10:20:30.1 +tts10 2001-01-01 10:20:30.0 +tts16 2001-01-01 10:20:30.1 +tdt10 2001-01-01 10:20:30.0 +tdt16 2001-01-01 10:20:30.1 +DROP PROCEDURE p1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; +# +# MDEV-13995 MAX(timestamp) returns a wrong result near DST change +# +# Testing Item_func_rollup_const::val_native() +# There is a bug in the below output (MDEV-16612) +# Please remove this comment when MDEV-16612 is fixed and results are re-recorded +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2); +BEGIN NOT ATOMIC +DECLARE v TIMESTAMP DEFAULT '2001-01-01 10:20:30'; -- "v" will be wrapped into Item_func_rollup_const +SELECT id, v AS v, COUNT(*) FROM t1 GROUP BY id,v WITH ROLLUP; +END; +$$ +id v COUNT(*) +1 2001-01-01 10:20:30 1 +1 2001-01-01 10:20:30 1 +2 2001-01-01 10:20:30 1 +2 2001-01-01 10:20:30 1 +NULL 2001-01-01 10:20:30 2 +DROP TABLE t1; +# +# Testing Type_handler_timestamp_common::Item_save_in_field() +# "txt" is expected to have three fractional digits +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456'); +CREATE TABLE t1 (ts1 TIMESTAMP(1) NOT NULL, ts2 TIMESTAMP(3) NOT NULL, txt TEXT); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00', '0000-00-00 00:00:00',COALESCE(ts1,ts2)); +INSERT INTO t1 VALUES (NOW(),NOW(),COALESCE(ts1,ts2)); +INSERT INTO t1 VALUES (NOW(1),NOW(3),COALESCE(ts1,ts2)); +SELECT * FROM t1; +ts1 ts2 txt +0000-00-00 00:00:00.0 0000-00-00 00:00:00.000 0000-00-00 00:00:00.000 +2001-01-01 10:20:30.0 2001-01-01 10:20:30.000 2001-01-01 10:20:30.000 +2001-01-01 10:20:30.1 2001-01-01 10:20:30.123 2001-01-01 10:20:30.100 +DROP TABLE t1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; +# +# Testing Field_timestamp::store_native +# +SET sql_mode=''; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00','0000-00-00 00:00:00'); +SET sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE'; +UPDATE t1 SET a=b; +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`a` at row 1 +UPDATE t1 SET a=COALESCE(b); +ERROR 22007: Incorrect datetime value: '0000-00-00 00:00:00' for column `test`.`t1`.`a` at row 1 +DROP TABLE t1; +SET sql_mode=DEFAULT; +# +# MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY +# +CREATE TABLE t1 (a INT, b TIMESTAMP) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'2018-06-19 00:00:00'); +SELECT NULLIF(b, 'N/A') AS f, MAX(a) FROM t1 GROUP BY f; +f MAX(a) +2018-06-19 00:00:00 1 +Warnings: +Warning 1292 Truncated incorrect datetime value: 'N/A' +DROP TABLE t1; +# +# MDEV-17972 Assertion `is_valid_value_slow()' failed in Datetime::Datetime +# +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP(6)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +FLUSH TABLES; +MYD +FF77777777FFFFFF +SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1; +a dt0 dt6 +2033-07-07 03:01:11.999999 2033-07-07 03:01:11 2033-07-07 03:01:11.999999 +DROP TABLE t1; +SET time_zone=DEFAULT; +# +# MDEV-18072 Assertion `is_null() == item->null_value || conv' failed in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null upon query with GROUP BY +# +CREATE TABLE t1 (t TIMESTAMP); +INSERT INTO t1 () VALUES (),(); +SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo'; +f +NULL +DROP TABLE t1; +# +# MDEV-18145 Assertion `0' failed in Item::val_native upon SELECT subquery with timestamp +# +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t3 (pk INT PRIMARY KEY, b TIMESTAMP) ENGINE=MyISAM; +SELECT ( SELECT b FROM t1 LIMIT 1 ) AS sq FROM t2 LEFT JOIN t3 USING (pk); +sq +NULL +NULL +DROP TABLE t1, t2, t3; +# +# End of 10.4 tests +# diff --git a/mysql-test/main/type_timestamp.test b/mysql-test/main/type_timestamp.test index 6d81a86331a..8b64fe0bfc3 100644 --- a/mysql-test/main/type_timestamp.test +++ b/mysql-test/main/type_timestamp.test @@ -606,3 +606,161 @@ DROP TABLE t1; --echo # --echo # End of 10.3 tests --echo # + +--echo # +--echo # Start of 10.4 tests +--echo # + +--echo # +--echo # MDEV-17216 Assertion `!dt->fraction_remainder(decimals())' failed in Field_temporal_with_date::store_TIME_with_warning +--echo # + +CREATE TABLE t1 (b BIT(20)); +CREATE TABLE t2 (t TIMESTAMP); +INSERT IGNORE INTO t1 VALUES (b'000001001100000'); +INSERT INTO t2 SELECT * FROM t1; +DROP TABLE t1, t2; + +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 SELECT CAST(20010101 AS UNSIGNED); +DROP TABLE t1; + + +--echo # +--echo # MDEV-17928 Conversion from TIMESTAMP to VARCHAR SP variables does not work well on fractional digits +--echo # + +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456'); +DELIMITER $$; +CREATE PROCEDURE p1() +BEGIN + DECLARE ts10 TIMESTAMP(1) DEFAULT NOW(); + DECLARE ts16 TIMESTAMP(1) DEFAULT NOW(6); + DECLARE dt10 DATETIME(1) DEFAULT NOW(); + DECLARE dt16 DATETIME(1) DEFAULT NOW(6); + DECLARE vts10 VARCHAR(32) DEFAULT ts10; + DECLARE vts16 VARCHAR(32) DEFAULT ts16; + DECLARE vdt10 VARCHAR(32) DEFAULT dt10; + DECLARE vdt16 VARCHAR(32) DEFAULT dt16; + DECLARE tts10 TEXT(32) DEFAULT ts10; + DECLARE tts16 TEXT(32) DEFAULT ts16; + DECLARE tdt10 TEXT(32) DEFAULT dt10; + DECLARE tdt16 TEXT(32) DEFAULT dt16; + + SELECT vts10, vts16, vdt10, vdt16; + SELECT tts10, tts16, tdt10, tdt16; +END; +$$ +DELIMITER ;$$ +--vertical_results +CALL p1; +--horizontal_results +DROP PROCEDURE p1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; + +--echo # +--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change +--echo # + +--echo # Testing Item_func_rollup_const::val_native() + +--echo # There is a bug in the below output (MDEV-16612) +--echo # Please remove this comment when MDEV-16612 is fixed and results are re-recorded + +CREATE TABLE t1 (id INT); +INSERT INTO t1 VALUES (1),(2); +DELIMITER $$; +BEGIN NOT ATOMIC + DECLARE v TIMESTAMP DEFAULT '2001-01-01 10:20:30'; -- "v" will be wrapped into Item_func_rollup_const + SELECT id, v AS v, COUNT(*) FROM t1 GROUP BY id,v WITH ROLLUP; +END; +$$ +DELIMITER ;$$ +DROP TABLE t1; + +--echo # +--echo # Testing Type_handler_timestamp_common::Item_save_in_field() +--echo # "txt" is expected to have three fractional digits +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2001-01-01 10:20:30.123456'); +CREATE TABLE t1 (ts1 TIMESTAMP(1) NOT NULL, ts2 TIMESTAMP(3) NOT NULL, txt TEXT); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00', '0000-00-00 00:00:00',COALESCE(ts1,ts2)); +INSERT INTO t1 VALUES (NOW(),NOW(),COALESCE(ts1,ts2)); +INSERT INTO t1 VALUES (NOW(1),NOW(3),COALESCE(ts1,ts2)); +SELECT * FROM t1; +DROP TABLE t1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; + +--echo # +--echo # Testing Field_timestamp::store_native +--echo # + +SET sql_mode=''; +CREATE TABLE t1 (a TIMESTAMP, b TIMESTAMP); +INSERT INTO t1 VALUES ('0000-00-00 00:00:00','0000-00-00 00:00:00'); +SET sql_mode='STRICT_ALL_TABLES,NO_ZERO_DATE'; +--error ER_TRUNCATED_WRONG_VALUE +UPDATE t1 SET a=b; +--error ER_TRUNCATED_WRONG_VALUE +UPDATE t1 SET a=COALESCE(b); +DROP TABLE t1; +SET sql_mode=DEFAULT; + +--echo # +--echo # MDEV-17979 Assertion `0' failed in Item::val_native upon SELECT with timestamp, NULLIF, GROUP BY +--echo # + +CREATE TABLE t1 (a INT, b TIMESTAMP) ENGINE=MyISAM; +INSERT INTO t1 VALUES (1,'2018-06-19 00:00:00'); +SELECT NULLIF(b, 'N/A') AS f, MAX(a) FROM t1 GROUP BY f; +DROP TABLE t1; + +--echo # +--echo # MDEV-17972 Assertion `is_valid_value_slow()' failed in Datetime::Datetime +--echo # + +let $MYSQLD_DATADIR= `select @@datadir`; +SET time_zone='+00:00'; +CREATE TABLE t1 (a TIMESTAMP(6)) ENGINE=MyISAM; +INSERT INTO t1 VALUES ('2001-01-01 10:20:30'); +FLUSH TABLES; +--remove_file $MYSQLD_DATADIR/test/t1.MYD +--disable_query_log +# Write a data file with one record: +# 0xFF - record flags +# 0x77777777 - TIMESTAMP integer part +# 0xFFFFFF - TIMESTAMP bad fractional part +--eval SELECT CONCAT(0xFF,0x77777777,0xFFFFFF) INTO OUTFILE '$MYSQLD_DATADIR/test/t1.MYD' FIELDS TERMINATED BY '' ESCAPED BY '' LINES TERMINATED BY '' +--eval SELECT HEX(LOAD_FILE('$MYSQLD_DATADIR/test/t1.MYD')) AS MYD +--enable_query_log +SELECT a, CAST(a AS DATETIME) AS dt0, CAST(a AS DATETIME(6)) AS dt6 FROM t1; +DROP TABLE t1; +SET time_zone=DEFAULT; + +--echo # +--echo # MDEV-18072 Assertion `is_null() == item->null_value || conv' failed in Timestamp_or_zero_datetime_native_null::Timestamp_or_zero_datetime_native_null upon query with GROUP BY +--echo # + +CREATE TABLE t1 (t TIMESTAMP); +INSERT INTO t1 () VALUES (),(); +SELECT IF(0,t,NULL) AS f FROM t1 GROUP BY 'foo'; +DROP TABLE t1; + +--echo # +--echo # MDEV-18145 Assertion `0' failed in Item::val_native upon SELECT subquery with timestamp +--echo # + +CREATE TABLE t1 (a INT) ENGINE=MyISAM; +CREATE TABLE t2 (pk INT PRIMARY KEY) ENGINE=MyISAM; +INSERT INTO t2 VALUES (1),(2); +CREATE TABLE t3 (pk INT PRIMARY KEY, b TIMESTAMP) ENGINE=MyISAM; +SELECT ( SELECT b FROM t1 LIMIT 1 ) AS sq FROM t2 LEFT JOIN t3 USING (pk); +DROP TABLE t1, t2, t3; + + +--echo # +--echo # End of 10.4 tests +--echo # diff --git a/mysql-test/main/type_timestamp_round.result b/mysql-test/main/type_timestamp_round.result new file mode 100644 index 00000000000..7931aa0ff5b --- /dev/null +++ b/mysql-test/main/type_timestamp_round.result @@ -0,0 +1,191 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; +# +# TIMESTAMP: SET +# +CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b TIMESTAMP(4) NULL DEFAULT NULL); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999'); +UPDATE t1 SET a=b; +Warnings: +Note 1265 Data truncated for column 'a' at row 2 +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,20001231235959.9999); +INSERT INTO t1 VALUES(NULL,20001231235959.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +2001-01-01 00:00:00.000 +DROP TABLE t1; +# +# TIMESTAMP: ALTER +# +CREATE TABLE t1 (a TIMESTAMP(4) NULL DEFAULT NULL); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL; +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL; +Warnings: +Note 1292 Truncated incorrect datetime value: '2000-12-31 23:59:59.9999999' +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +2001-01-01 00:00:00.000 +DROP TABLE t1; +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL; +SELECT a FROM t1; +a +2001-01-01 00:00:00.000 +2001-01-01 00:00:00.000 +DROP TABLE t1; +# +# Corner case: +# ALTER TIMESTAMP to a shorter TIMESTAMP +# All values round, maximum possible value truncates. +# +SET time_zone='+00:00'; +CREATE TABLE t1 (ID INT, a TIMESTAMP(6), comment VARCHAR(64)); +INSERT INTO t1 VALUES (0, '2038-01-18 23:59:59.999999', 'Should round'); +INSERT INTO t1 VALUES (1, '2038-01-19 03:14:06.999999', 'Should round'); +INSERT INTO t1 VALUES (2, '2038-01-19 03:14:07.999999', 'Should truncate'); +ALTER TABLE t1 MODIFY a TIMESTAMP(5); +Warnings: +Warning 1264 Out of range value for column 'a' at row 3 +SELECT * FROM t1; +ID a comment +0 2038-01-19 00:00:00.00000 Should round +1 2038-01-19 03:14:07.00000 Should round +2 2038-01-19 03:14:07.99999 Should truncate +DROP TABLE t1; +SET time_zone=DEFAULT; +# +# NOW +# +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999'); +CREATE OR REPLACE TABLE t1 (id SERIAL, a TIMESTAMP(4)); +INSERT INTO t1 (a) VALUES (now(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIME(6)); +SELECT * FROM t1; +id a +1 2011-01-01 00:00:00.0000 +2 2011-01-01 00:00:00.0000 +3 2011-01-01 00:00:00.0000 +DROP TABLE t1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; +# +# DATETIME to TIMESTAMP conversion with DST change +# +SET sql_mode=IF(@@version LIKE '%MariaDB%', +'STRICT_ALL_TABLES,TIME_ROUND_FRACTIONAL', +'STRICT_ALL_TABLES'); +SET time_zone='Europe/Moscow'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('2010-03-28 01:59:59.0' /* Winter time */); +INSERT INTO t1 VALUES ('2010-03-28 01:59:59.9' /* Rounds to the DST gap */); +ERROR 22007: Incorrect datetime value: '2010-03-28 01:59:59.9' for column `test`.`t1`.`a` at row 1 +SELECT * FROM t1; +a +2010-03-28 01:59:59 +DROP TABLE t1; +SET time_zone=DEFAULT; +SET sql_mode=@default_sql_mode; +SET sql_mode=IF(@@version LIKE '%MariaDB%','TIME_ROUND_FRACTIONAL',''); +SET time_zone='Europe/Moscow'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('2010-03-28 01:59:59.0' /* Winter time */); +INSERT INTO t1 VALUES ('2010-03-28 01:59:59.9' /* Rounds to the DST gap, then gets fixed to the first second of the summer time */); +Warnings: +Warning 1299 Invalid TIMESTAMP value in column 'a' at row 1 +SELECT a, UNIX_TIMESTAMP(a) FROM t1; +a UNIX_TIMESTAMP(a) +2010-03-28 01:59:59 1269730799 +2010-03-28 03:00:00 1269730800 +DROP TABLE t1; +SET time_zone=DEFAULT; +SET sql_mode=@default_sql_mode; +# +# Comparing non-temporal to TIMESTAMP +# +CREATE TABLE t1 (a VARCHAR(64)); +INSERT t1 VALUES ('2001-01-01 23:59:59.9999999'); +CREATE TABLE t2 (a TIMESTAMP); +INSERT INTO t2 VALUES ('2001-01-02 00:00:00'); +SELECT * FROM t1,t2 WHERE t1.a=t2.a; +a a +2001-01-01 23:59:59.9999999 2001-01-02 00:00:00 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +SELECT * FROM t1,t2 WHERE CONCAT(t1.a)=t2.a; +a a +2001-01-01 23:59:59.9999999 2001-01-02 00:00:00 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +SELECT * FROM t1,t2 WHERE COALESCE(t1.a)=t2.a; +a a +2001-01-01 23:59:59.9999999 2001-01-02 00:00:00 +Warnings: +Note 1292 Truncated incorrect datetime value: '2001-01-01 23:59:59.9999999' +DROP TABLE t1,t2; +CREATE TABLE t1 (a DECIMAL(32,7)); +INSERT t1 VALUES (20010101235959.9999999); +CREATE TABLE t2 (a TIMESTAMP); +INSERT INTO t2 VALUES ('2001-01-02 00:00:00'); +SELECT * FROM t1,t2 WHERE t1.a=t2.a; +a a +20010101235959.9999999 2001-01-02 00:00:00 +SELECT * FROM t1,t2 WHERE COALESCE(t1.a)=t2.a; +a a +20010101235959.9999999 2001-01-02 00:00:00 +DROP TABLE t1,t2; +# +# MDEV-13995 MAX(timestamp) returns a wrong result near DST change +# +# Test Field_timestamp::store_native() +# +SET sql_mode=@default_sql_mode; +SET time_zone='+00:00'; +CREATE TABLE t1 (ts0 TIMESTAMP, ts1 TIMESTAMP(1)); +INSERT INTO t1 VALUES ('2001-01-01 10:20:30', '2001-01-01 10:20:30.9'); +SELECT * FROM t1; +ts0 ts1 +2001-01-01 10:20:30 2001-01-01 10:20:30.9 +# This should round +UPDATE t1 SET ts0=COALESCE(ts1); +SELECT * FROM t1; +ts0 ts1 +2001-01-01 10:20:31 2001-01-01 10:20:30.9 +# Corner case +UPDATE t1 SET ts1=FROM_UNIXTIME(2147483647.9); +UPDATE t1 SET ts0=COALESCE(ts1); +Warnings: +Warning 1264 Out of range value for column 'ts0' at row 1 +SELECT * FROM t1; +ts0 ts1 +2038-01-19 03:14:07 2038-01-19 03:14:07.9 +DROP TABLE t1; +SET time_zone=DEFAULT; diff --git a/mysql-test/main/type_timestamp_round.test b/mysql-test/main/type_timestamp_round.test new file mode 100644 index 00000000000..19e0ea86da5 --- /dev/null +++ b/mysql-test/main/type_timestamp_round.test @@ -0,0 +1,160 @@ +SET sql_mode=IF(@@version LIKE '%MariaDB%', 'TIME_ROUND_FRACTIONAL', ''); +SET @default_sql_mode=@@sql_mode; + +--echo # +--echo # TIMESTAMP: SET +--echo # + +CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b TIMESTAMP(4) NULL DEFAULT NULL); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b VARCHAR(64)); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES(NULL,'2000-12-31 23:59:59.9999999'); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a TIMESTAMP(3) NULL DEFAULT NULL, b DECIMAL(38,10)); +INSERT INTO t1 VALUES(NULL,20001231235959.9999); +INSERT INTO t1 VALUES(NULL,20001231235959.9999999); +UPDATE t1 SET a=b; +SELECT a FROM t1; +DROP TABLE t1; + +--echo # +--echo # TIMESTAMP: ALTER +--echo # + +CREATE TABLE t1 (a TIMESTAMP(4) NULL DEFAULT NULL); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999'); +INSERT INTO t1 VALUES('2000-12-31 23:59:59.9999999'); +ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL; +SELECT a FROM t1; +DROP TABLE t1; + +CREATE TABLE t1 (a DECIMAL(38,10)); +INSERT INTO t1 VALUES(20001231235959.9999); +INSERT INTO t1 VALUES(20001231235959.9999999); +ALTER TABLE t1 MODIFY a TIMESTAMP(3) NULL DEFAULT NULL; +SELECT a FROM t1; +DROP TABLE t1; + + +--echo # +--echo # Corner case: +--echo # ALTER TIMESTAMP to a shorter TIMESTAMP +--echo # All values round, maximum possible value truncates. +--echo # + +SET time_zone='+00:00'; +CREATE TABLE t1 (ID INT, a TIMESTAMP(6), comment VARCHAR(64)); +INSERT INTO t1 VALUES (0, '2038-01-18 23:59:59.999999', 'Should round'); +INSERT INTO t1 VALUES (1, '2038-01-19 03:14:06.999999', 'Should round'); +INSERT INTO t1 VALUES (2, '2038-01-19 03:14:07.999999', 'Should truncate'); +ALTER TABLE t1 MODIFY a TIMESTAMP(5); +SELECT * FROM t1; +DROP TABLE t1; +SET time_zone=DEFAULT; + +--echo # +--echo # NOW +--echo # + +SET time_zone='+00:00'; +SET timestamp=UNIX_TIMESTAMP('2010-12-31 23:59:59.999999'); +CREATE OR REPLACE TABLE t1 (id SERIAL, a TIMESTAMP(4)); +INSERT INTO t1 (a) VALUES (now(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIMESTAMP(6)); +INSERT INTO t1 (a) VALUES (CURRENT_TIME(6)); +SELECT * FROM t1; +DROP TABLE t1; +SET timestamp=DEFAULT; +SET time_zone=DEFAULT; + + +--echo # +--echo # DATETIME to TIMESTAMP conversion with DST change +--echo # + +--disable_warnings +SET sql_mode=IF(@@version LIKE '%MariaDB%', + 'STRICT_ALL_TABLES,TIME_ROUND_FRACTIONAL', + 'STRICT_ALL_TABLES'); +--enable_warnings +SET time_zone='Europe/Moscow'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('2010-03-28 01:59:59.0' /* Winter time */); +--error ER_TRUNCATED_WRONG_VALUE +INSERT INTO t1 VALUES ('2010-03-28 01:59:59.9' /* Rounds to the DST gap */); +SELECT * FROM t1; +DROP TABLE t1; +SET time_zone=DEFAULT; +--disable_warnings +SET sql_mode=@default_sql_mode; +--enable_warnings + +SET sql_mode=IF(@@version LIKE '%MariaDB%','TIME_ROUND_FRACTIONAL',''); +SET time_zone='Europe/Moscow'; +CREATE TABLE t1 (a TIMESTAMP); +INSERT INTO t1 VALUES ('2010-03-28 01:59:59.0' /* Winter time */); +INSERT INTO t1 VALUES ('2010-03-28 01:59:59.9' /* Rounds to the DST gap, then gets fixed to the first second of the summer time */); +SELECT a, UNIX_TIMESTAMP(a) FROM t1; +DROP TABLE t1; +SET time_zone=DEFAULT; +--disable_warnings +SET sql_mode=@default_sql_mode; +--enable_warnings + + +--echo # +--echo # Comparing non-temporal to TIMESTAMP +--echo # + +CREATE TABLE t1 (a VARCHAR(64)); +INSERT t1 VALUES ('2001-01-01 23:59:59.9999999'); +CREATE TABLE t2 (a TIMESTAMP); +INSERT INTO t2 VALUES ('2001-01-02 00:00:00'); +SELECT * FROM t1,t2 WHERE t1.a=t2.a; +SELECT * FROM t1,t2 WHERE CONCAT(t1.a)=t2.a; +SELECT * FROM t1,t2 WHERE COALESCE(t1.a)=t2.a; +DROP TABLE t1,t2; + +CREATE TABLE t1 (a DECIMAL(32,7)); +INSERT t1 VALUES (20010101235959.9999999); +CREATE TABLE t2 (a TIMESTAMP); +INSERT INTO t2 VALUES ('2001-01-02 00:00:00'); +SELECT * FROM t1,t2 WHERE t1.a=t2.a; +SELECT * FROM t1,t2 WHERE COALESCE(t1.a)=t2.a; +DROP TABLE t1,t2; + + +--echo # +--echo # MDEV-13995 MAX(timestamp) returns a wrong result near DST change +--echo # +--echo # Test Field_timestamp::store_native() +--echo # + +SET sql_mode=@default_sql_mode; +SET time_zone='+00:00'; +CREATE TABLE t1 (ts0 TIMESTAMP, ts1 TIMESTAMP(1)); +INSERT INTO t1 VALUES ('2001-01-01 10:20:30', '2001-01-01 10:20:30.9'); +SELECT * FROM t1; +--echo # This should round +UPDATE t1 SET ts0=COALESCE(ts1); +SELECT * FROM t1; +--echo # Corner case +UPDATE t1 SET ts1=FROM_UNIXTIME(2147483647.9); +UPDATE t1 SET ts0=COALESCE(ts1); +SELECT * FROM t1; +DROP TABLE t1; +SET time_zone=DEFAULT; diff --git a/mysql-test/main/type_year.result b/mysql-test/main/type_year.result index 6485a825f5b..3f589f38267 100644 --- a/mysql-test/main/type_year.result +++ b/mysql-test/main/type_year.result @@ -396,7 +396,14 @@ a drop table t1; drop function y2k; # -# Start of 10.1 tests +# MDEV-17257 Server crashes in Item::field_type_for_temporal_comparison or in get_datetime_value on SELECT with YEAR field and IN +# +CREATE TABLE t1 (y YEAR); +SELECT * FROM t1 WHERE y IN ( CAST( '1993-03-26 10:14:20' AS DATE ), NULL ); +y +DROP TABLE t1; +# +# End of 10.0 tests # # # MDEV-8741 Equal field propagation leaves some remainders after simplifying WHERE zerofill_column=2010 AND zerofill_column>=2010 @@ -560,5 +567,14 @@ SELECT MAKEDATE(18446744073709551615, 1); MAKEDATE(18446744073709551615, 1) NULL # +# MDEV-17607 DATE(COALESCE(year_column)) returns a wrong result +# +CREATE TABLE t1 (a YEAR); +INSERT INTO t1 VALUES (NULL); +SELECT COALESCE(a), DATE(COALESCE(a)) FROM t1; +COALESCE(a) DATE(COALESCE(a)) +NULL NULL +DROP TABLE t1; +# # End of 10.4 tests # diff --git a/mysql-test/main/type_year.test b/mysql-test/main/type_year.test index cc02acd8fbb..ea7514898cd 100644 --- a/mysql-test/main/type_year.test +++ b/mysql-test/main/type_year.test @@ -187,9 +187,16 @@ select a from t1 where a=b; # not a constant drop table t1; drop function y2k; +--echo # +--echo # MDEV-17257 Server crashes in Item::field_type_for_temporal_comparison or in get_datetime_value on SELECT with YEAR field and IN +--echo # + +CREATE TABLE t1 (y YEAR); +SELECT * FROM t1 WHERE y IN ( CAST( '1993-03-26 10:14:20' AS DATE ), NULL ); +DROP TABLE t1; --echo # ---echo # Start of 10.1 tests +--echo # End of 10.0 tests --echo # --echo # @@ -299,6 +306,15 @@ DROP TABLE t1; --echo # SELECT MAKEDATE(18446744073709551615, 1); +--echo # +--echo # MDEV-17607 DATE(COALESCE(year_column)) returns a wrong result +--echo # + +CREATE TABLE t1 (a YEAR); +INSERT INTO t1 VALUES (NULL); +SELECT COALESCE(a), DATE(COALESCE(a)) FROM t1; +DROP TABLE t1; + --echo # --echo # End of 10.4 tests --echo # diff --git a/mysql-test/main/udf.result b/mysql-test/main/udf.result index 6af6b167511..6655982a38f 100644 --- a/mysql-test/main/udf.result +++ b/mysql-test/main/udf.result @@ -465,3 +465,122 @@ a b Hello HL DROP FUNCTION METAPHON; DROP TABLE t1; +# +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "UDF_EXAMPLE_LIB"; +create table t1(a int , b int); +insert into t1 values(100, 54), (200, 199); +create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1; +select * from v1; +myfunc_int(max(a) over (order by b) , b) +154 +399 +drop view v1; +drop function myfunc_int; +drop table t1; + +MDEV-15073: Generic UDAF parser code in server for windows functions + +CREATE AGGREGATE FUNCTION avgcost +RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +CREATE AGGREGATE FUNCTION avg2 +RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +CREATE FUNCTION myfunc_double RETURNS REAL SONAME "UDF_EXAMPLE_LIB"; +create table t1(pk int primary key, +a int, +sum int, +price float(24)); +insert into t1 values +(1, 1, 100, 50.00), +(2, 1, 100, 100.00), +(3, 1, 100, 50.00), +(4, 1, 100, 50.00), +(5, 1, 100, 50.00), +(6, 1, 100, NULL), +(7, 1, NULL, NULL), +(8, 2, 2, 2), +(9, 2, 4, 4); +select pk, a, sum, price, avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +from t1; +pk a sum price avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +1 1 100 50 75.0000 +2 1 100 100 66.6667 +3 1 100 50 66.6667 +4 1 100 50 50.0000 +5 1 100 50 50.0000 +6 1 100 NULL 50.0000 +7 1 NULL NULL 0.0000 +8 2 2 2 3.3333 +9 2 4 4 3.3333 +select pk, a, sum, price, avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; +pk a sum price avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +1 1 100 50 50.0000 +2 1 100 100 75.0000 +3 1 100 50 75.0000 +4 1 100 50 50.0000 +5 1 100 50 50.0000 +6 1 100 NULL 50.0000 +7 1 NULL NULL 0.0000 +8 2 2 2 2.0000 +9 2 4 4 3.3333 +select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +from t1; +pk a sum price avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +1 1 100 50 0.7500 +2 1 100 100 0.6667 +3 1 100 50 0.6667 +4 1 100 50 0.5000 +5 1 100 50 0.5000 +6 1 100 NULL 0.5000 +7 1 NULL NULL 0.0000 +8 2 2 2 1.0000 +9 2 4 4 1.0000 +select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; +pk a sum price avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +1 1 100 50 0.5000 +2 1 100 100 0.7500 +3 1 100 50 0.7500 +4 1 100 50 0.5000 +5 1 100 50 0.5000 +6 1 100 NULL 0.5000 +7 1 NULL NULL 0.0000 +8 2 2 2 1.0000 +9 2 4 4 1.0000 +select pk, a, sum, price, tttttttt(sprice,sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +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 'over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from ' at line 1 +select pk, a, sum, price, myfunc_double(sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +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 'over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from ' at line 1 +select pk, a, sum, price, round(sprice,sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +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 'over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from ' at line 1 +select pk, a, sum, price, myfunc_double(sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +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 'over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from ' at line 1 +set @save_sql_mode = @@sql_mode; +set sql_mode="oracle"; +select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; +pk a sum price avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +1 1 100 50 0.5000 +2 1 100 100 0.7500 +3 1 100 50 0.7500 +4 1 100 50 0.5000 +5 1 100 50 0.5000 +6 1 100 NULL 0.5000 +7 1 NULL NULL 0.0000 +8 2 2 2 1.0000 +9 2 4 4 1.0000 +set sql_mode= @save_sql_mode; +drop table t1; +DROP FUNCTION avgcost; +DROP FUNCTION avg2; +DROP FUNCTION myfunc_double; diff --git a/mysql-test/main/udf.test b/mysql-test/main/udf.test index c3a25c6bcce..bb8493135aa 100644 --- a/mysql-test/main/udf.test +++ b/mysql-test/main/udf.test @@ -528,3 +528,82 @@ DROP FUNCTION METAPHON; #INSERT INTO t1 (a) VALUES ('Hello'); #SELECT * FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_int RETURNS INTEGER SONAME "$UDF_EXAMPLE_SO"; +create table t1(a int , b int); +insert into t1 values(100, 54), (200, 199); +create view v1 as select myfunc_int(max(a) over (order by b) , b) from t1; +select * from v1; +drop view v1; +drop function myfunc_int; +drop table t1; + +--echo +--echo MDEV-15073: Generic UDAF parser code in server for windows functions +--echo + +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE AGGREGATE FUNCTION avgcost + RETURNS REAL SONAME "$UDF_EXAMPLE_SO"; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE AGGREGATE FUNCTION avg2 + RETURNS REAL SONAME "$UDF_EXAMPLE_SO"; +--replace_result $UDF_EXAMPLE_SO UDF_EXAMPLE_LIB +eval CREATE FUNCTION myfunc_double RETURNS REAL SONAME "$UDF_EXAMPLE_SO"; + +create table t1(pk int primary key, + a int, + sum int, + price float(24)); +insert into t1 values + (1, 1, 100, 50.00), + (2, 1, 100, 100.00), + (3, 1, 100, 50.00), + (4, 1, 100, 50.00), + (5, 1, 100, 50.00), + (6, 1, 100, NULL), + (7, 1, NULL, NULL), + (8, 2, 2, 2), + (9, 2, 4, 4); + +--sorted_result +select pk, a, sum, price, avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +from t1; +--sorted_result +select pk, a, sum, price, avgcost(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; + +--sorted_result +select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 1 FOLLOWING) +from t1; +--sorted_result +select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; +--error ER_PARSE_ERROR +select pk, a, sum, price, tttttttt(sprice,sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; +--error ER_PARSE_ERROR +select pk, a, sum, price, myfunc_double(sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; +--error ER_PARSE_ERROR +select pk, a, sum, price, round(sprice,sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; +--error ER_PARSE_ERROR +select pk, a, sum, price, myfunc_double(sum) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; + +set @save_sql_mode = @@sql_mode; +set sql_mode="oracle"; +--sorted_result +select pk, a, sum, price, avg2(sum, price) over (partition by a order by pk ROWS BETWEEN 1 PRECEDING AND 0 FOLLOWING) +from t1; +set sql_mode= @save_sql_mode; + +drop table t1; +DROP FUNCTION avgcost; +DROP FUNCTION avg2; +DROP FUNCTION myfunc_double; diff --git a/mysql-test/main/union.result b/mysql-test/main/union.result index 0c6ddd3675a..7ad588114b6 100644 --- a/mysql-test/main/union.result +++ b/mysql-test/main/union.result @@ -564,7 +564,7 @@ explain (select * from t1 where a=1 and b=10) union (select straight_join t1.a,t id select_type table type possible_keys key key_len ref rows Extra 1 PRIMARY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables 2 UNION t1 index PRIMARY PRIMARY 4 NULL 4 Using index -2 UNION t2 index PRIMARY PRIMARY 4 NULL 4 Using where; Using index; Using join buffer (flat, BNL join) +2 UNION t2 eq_ref PRIMARY PRIMARY 4 test.t1.a 1 Using index NULL UNION RESULT ALL NULL NULL NULL NULL NULL explain (select * from t1 where a=1) union (select * from t1 where b=1); id select_type table type possible_keys key key_len ref rows Extra @@ -2165,6 +2165,44 @@ select @advertAcctId as a from dual union all select 1.0 from dual; a 1000003.0 1.0 +# +# MDEV-13784: query causes seg fault +# +CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL); +INSERT INTO t1 VALUES (45199,1184); +CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`)); +INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582); +CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64)); +CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255)); +INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo'); +CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64)); +explain select +( +select login_name from t4 where userId = ( +select userid from t2 where product_id = t1.product_id +union +select userid from t2 where product_id = ( +select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) +) as x from t1 where (t1.bug_id=45199); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 system PRIMARY NULL NULL NULL 1 +2 SUBQUERY t4 eq_ref PRIMARY PRIMARY 4 func 1 Using where +3 SUBQUERY t2 ref PRIMARY PRIMARY 4 const 3 Using index +4 UNION t2 ref PRIMARY PRIMARY 4 func 1 Using where; Using index +5 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +6 SUBQUERY NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +NULL UNION RESULT ALL NULL NULL NULL NULL NULL +select +( +select login_name from t4 where userId = ( +select userid from t2 where product_id = t1.product_id +union +select userid from t2 where product_id = ( +select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) +) as x from t1 where (t1.bug_id=45199); +x +foo +drop table t1, t2, t3, t4, t5; End of 5.5 tests # # WL#1763 Avoid creating temporary table in UNION ALL diff --git a/mysql-test/main/union.test b/mysql-test/main/union.test index ca14731600e..dc9a4617fb3 100644 --- a/mysql-test/main/union.test +++ b/mysql-test/main/union.test @@ -1495,6 +1495,41 @@ eval SET NAMES $old_charset; SET @advertAcctId = 1000003; select @advertAcctId as a from dual union all select 1.0 from dual; +--echo # +--echo # MDEV-13784: query causes seg fault +--echo # + +CREATE TABLE t1 (`bug_id` int NOT NULL PRIMARY KEY, `product_id` int NOT NULL); +INSERT INTO t1 VALUES (45199,1184); + +CREATE TABLE t2 (`product_id` int NOT NULL,`userid` int NOT NULL, PRIMARY KEY (`product_id`,`userid`)); +INSERT INTO t2 VALUES (1184,103),(1184,624),(1184,1577),(1184,1582); + +CREATE TABLE t3 (`id` int NOT NULL PRIMARY KEY,`name` varchar(64)); + + +CREATE TABLE t4 ( `userid` int NOT NULL PRIMARY KEY, `login_name` varchar(255)); +INSERT INTO t4 VALUES (103,'foo'),(624,'foo'),(1577,'foo'),(1582,'foo'); +CREATE TABLE t5 (`id` int NOT NULL PRIMARY KEY, `name` varchar(64)); + +explain select +( + select login_name from t4 where userId = ( + select userid from t2 where product_id = t1.product_id + union + select userid from t2 where product_id = ( + select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) +) as x from t1 where (t1.bug_id=45199); +select +( + select login_name from t4 where userId = ( + select userid from t2 where product_id = t1.product_id + union + select userid from t2 where product_id = ( + select id from t5 where name = (select name from t3 where id = t1.product_id)) limit 1 ) +) as x from t1 where (t1.bug_id=45199); +drop table t1, t2, t3, t4, t5; + --echo End of 5.5 tests --echo # diff --git a/mysql-test/main/update.result b/mysql-test/main/update.result index ccf2f4451ea..ab6596e8bf1 100644 --- a/mysql-test/main/update.result +++ b/mysql-test/main/update.result @@ -234,7 +234,9 @@ insert into t2 values ( 1, 'abcd1e'); insert into t2 values ( 2, 'abcd2e'); analyze table t1,t2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK update t1, t2 set t1.a = t2.a where t2.b = t1.b; show warnings; @@ -326,7 +328,7 @@ delete from t1 order by a limit 1; show status like 'handler_read%'; Variable_name Value Handler_read_first 0 -Handler_read_key 0 +Handler_read_key 4 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 diff --git a/mysql-test/main/update_use_source.result b/mysql-test/main/update_use_source.result index e5585fcee5d..9e43b54d81c 100644 --- a/mysql-test/main/update_use_source.result +++ b/mysql-test/main/update_use_source.result @@ -1177,6 +1177,7 @@ insert t1 (c1,c2,c3) select 3,seq,seq%10 from seq_1_to_200; create index t1_idx1 on t1(c3); analyze table t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status Table is already up to date update t1 set c1=2 where exists (select 'x' from t1); select count(*) from t1 where c1=2; diff --git a/mysql-test/main/userstat.result b/mysql-test/main/userstat.result index 2c8a3d3e97d..0067149691a 100644 --- a/mysql-test/main/userstat.result +++ b/mysql-test/main/userstat.result @@ -119,7 +119,7 @@ Handler_mrr_key_refills 0 Handler_mrr_rowid_refills 0 Handler_prepare 18 Handler_read_first 0 -Handler_read_key 9 +Handler_read_key 17 Handler_read_last 0 Handler_read_next 0 Handler_read_prev 0 @@ -137,7 +137,7 @@ Handler_update 5 Handler_write 7 select variable_value - @global_read_key as "handler_read_key" from information_schema.global_status where variable_name="handler_read_key"; handler_read_key -9 +17 disconnect ssl_con; set @@global.userstat=0; select * from information_schema.index_statistics; diff --git a/mysql-test/main/view.result b/mysql-test/main/view.result index fcd3fc202e0..54afdb555e7 100644 --- a/mysql-test/main/view.result +++ b/mysql-test/main/view.result @@ -615,6 +615,7 @@ select is_updatable from information_schema.views; is_updatable YES YES +YES select * from t1; col1 col2 5 Hello, view world @@ -1279,10 +1280,10 @@ load data infile '../../std_data/loaddata3.dat' ignore into table v1 fields term Warnings: Note 1265 Data truncated for column 'a' at row 1 Note 1265 Data truncated for column 'a' at row 2 -Warning 1366 Incorrect integer value: 'error ' for column 'a' at row 3 +Warning 1366 Incorrect integer value: 'error ' for column `test`.`t1`.`a` at row 3 Warning 1369 CHECK OPTION failed `test`.`v1` Note 1265 Data truncated for column 'a' at row 3 -Warning 1366 Incorrect integer value: 'wrong end ' for column 'a' at row 4 +Warning 1366 Incorrect integer value: 'wrong end ' for column `test`.`t1`.`a` at row 4 Warning 1369 CHECK OPTION failed `test`.`v1` select * from t1 order by a,b; a b @@ -4623,7 +4624,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'test.t1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<10,`test`.`t1`.`a`>((10,(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond((10) = NULL or (NULL is null)) having trigcond(NULL is null)))) +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<10,`test`.`t1`.`a`>((10,(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond((10) = NULL or 1) having trigcond(NULL is null)))) SELECT * FROM t1, t2 WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t4.a >= t1.a); @@ -4639,7 +4640,7 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 2 DEPENDENT SUBQUERY t4 ALL NULL NULL NULL NULL 2 100.00 Using where Warnings: Note 1276 Field or reference 'v1.a' of SELECT #2 was resolved in SELECT #1 -Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<10,`test`.`t1`.`a`>((10,(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond((10) = NULL or (NULL is null)) having trigcond(NULL is null)))) +Note 1003 /* select#1 */ select `test`.`t1`.`a` AS `a`,10 AS `a` from `test`.`t1` where !<10,`test`.`t1`.`a`>((10,(/* select#2 */ select NULL from `test`.`t4` where `test`.`t4`.`a` >= `test`.`t1`.`a` and trigcond((10) = NULL or 1) having trigcond(NULL is null)))) SELECT * FROM v1, t2 WHERE t2.a NOT IN (SELECT t3.b FROM t3 RIGHT JOIN t4 ON (t4.a = t3.a) WHERE t4.a >= v1.a); diff --git a/mysql-test/main/view_grant.result b/mysql-test/main/view_grant.result index eeb507ecad2..df1429eaa4d 100644 --- a/mysql-test/main/view_grant.result +++ b/mysql-test/main/view_grant.result @@ -562,11 +562,6 @@ use test; REVOKE ALL PRIVILEGES, GRANT OPTION FROM mysqltest_1@localhost; drop user mysqltest_1@localhost; drop database mysqltest; -drop view if exists v1; -drop table if exists t1; -create table t1 as select * from mysql.user where user=''; -delete from mysql.user where user=''; -flush privileges; create user 'test14256'@'%'; grant all on test.* to 'test14256'@'%'; connect test14256,localhost,test14256,,test; @@ -592,9 +587,6 @@ test14256@% test14256@% 1 connection root; disconnect test14256; drop user test14256; -insert into mysql.user select * from t1; -flush privileges; -drop table t1; connection root; create database mysqltest; use mysqltest; diff --git a/mysql-test/main/view_grant.test b/mysql-test/main/view_grant.test index a70241138aa..65757e95fb3 100644 --- a/mysql-test/main/view_grant.test +++ b/mysql-test/main/view_grant.test @@ -669,16 +669,6 @@ drop database mysqltest; # # Bug#14256 definer in view definition is not fully qualified # ---disable_warnings -drop view if exists v1; -drop table if exists t1; ---enable_warnings - -# Backup anonymous users and remove them. (They get in the way of -# the one we test with here otherwise.) -create table t1 as select * from mysql.user where user=''; -delete from mysql.user where user=''; -flush privileges; # Create the test user create user 'test14256'@'%'; @@ -708,12 +698,6 @@ connection root; disconnect test14256; drop user test14256; -# Restore the anonymous users. -insert into mysql.user select * from t1; -flush privileges; - -drop table t1; - # # Bug#14726 freeing stack variable in case of an error of opening a view when # we have locked tables with LOCK TABLES statement. diff --git a/mysql-test/main/warnings.result b/mysql-test/main/warnings.result index 7c7e049ff2d..db3ef5f17d2 100644 --- a/mysql-test/main/warnings.result +++ b/mysql-test/main/warnings.result @@ -31,19 +31,19 @@ Error 1064 You have an error in your SQL syntax; check the manual that correspon insert into t1 values (1); insert ignore into t1 values ("hej"); Warnings: -Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1 +Warning 1366 Incorrect integer value: 'hej' for column `test`.`t1`.`a` at row 1 insert ignore into t1 values ("hej"),("d"); Warnings: -Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1 -Warning 1366 Incorrect integer value: 'd' for column 'a' at row 2 +Warning 1366 Incorrect integer value: 'hej' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect integer value: 'd' for column `test`.`t1`.`a` at row 2 set SQL_WARNINGS=1; insert ignore into t1 values ("hej"); Warnings: -Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1 +Warning 1366 Incorrect integer value: 'hej' for column `test`.`t1`.`a` at row 1 insert ignore into t1 values ("hej"),("d"); Warnings: -Warning 1366 Incorrect integer value: 'hej' for column 'a' at row 1 -Warning 1366 Incorrect integer value: 'd' for column 'a' at row 2 +Warning 1366 Incorrect integer value: 'hej' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect integer value: 'd' for column `test`.`t1`.`a` at row 2 drop table t1; set SQL_WARNINGS=0; drop temporary table if exists not_exists; @@ -171,44 +171,44 @@ create table t1 (a int); insert into t1 (a) values (1), (2), (3), (4), (5), (6), (7), (8), (9), (10); update ignore t1 set a='abc'; Warnings: -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 1 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 2 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 3 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 4 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 5 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 6 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 7 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 8 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 9 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 10 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 10 show warnings limit 2, 1; Level Code Message -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 3 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 3 show warnings limit 0, 10; Level Code Message -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 1 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 2 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 3 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 4 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 5 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 6 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 7 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 8 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 9 -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 10 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 1 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 2 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 3 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 4 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 5 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 6 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 7 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 8 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 9 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 10 show warnings limit 9, 1; Level Code Message -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 10 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 10 show warnings limit 10, 1; Level Code Message show warnings limit 9, 2; Level Code Message -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 10 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 10 show warnings limit 0, 0; Level Code Message show warnings limit 1; Level Code Message -Warning 1366 Incorrect integer value: 'abc' for column 'a' at row 1 +Warning 1366 Incorrect integer value: 'abc' for column `test`.`t1`.`a` at row 1 show warnings limit 0; Level Code Message show warnings limit 1, 0; @@ -254,13 +254,13 @@ SELECT f1 INTO x FROM t3 LIMIT 1; END// CALL sp1(); Warnings: -Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1 +Warning 1366 Incorrect decimal value: 'a`' for column ``.``.`x` at row 1 CALL sp2(); Warnings: -Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1 +Warning 1366 Incorrect decimal value: 'a`' for column ``.``.`x` at row 1 CALL sp3(); Warnings: -Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1 +Warning 1366 Incorrect decimal value: 'a`' for column ``.``.`x` at row 1 SET sql_mode = DEFAULT; DROP PROCEDURE IF EXISTS sp1; SET sql_mode = ''; @@ -271,7 +271,7 @@ SELECT f1 into x from t2 limit 1; END// CALL sp1(); Warnings: -Warning 1366 Incorrect decimal value: 'a`' for column 'x' at row 1 +Warning 1366 Incorrect decimal value: 'a`' for column ``.``.`x` at row 1 SET sql_mode = DEFAULT; DROP TABLE t1; DROP TABLE t2; diff --git a/mysql-test/main/win.result b/mysql-test/main/win.result index 97801b5e285..279404968bf 100644 --- a/mysql-test/main/win.result +++ b/mysql-test/main/win.result @@ -38,10 +38,10 @@ a row_number() over (partition by a order by b) select a, b, x, row_number() over (partition by a order by x) from t1; a b x row_number() over (partition by a order by x) 2 10 xx 1 -2 10 zz 3 2 20 yy 2 -3 10 xxx 2 +2 10 zz 3 3 20 vvv 1 +3 10 xxx 2 drop table t1; create table t1 (pk int primary key, a int, b int); insert into t1 values @@ -54,13 +54,14 @@ select pk, a, b, row_number() over (order by a), row_number() over (order by b) -from t1; +from t1 +order by b; pk a b row_number() over (order by a) row_number() over (order by b) -1 10 22 1 5 -2 11 21 2 4 -3 12 20 3 3 -4 13 19 4 2 5 14 18 5 1 +4 13 19 4 2 +3 12 20 3 3 +2 11 21 2 4 +1 10 22 1 5 drop table t1; # # Try RANK() function @@ -228,16 +229,16 @@ count(*) over (partition by c order by pk desc rows between 2 preceding and 2 following) as CNT from t1; pk c CNT -1 1 3 -2 1 4 -3 1 4 4 1 3 -5 2 3 -6 2 4 -7 2 5 -8 2 5 -9 2 4 +3 1 4 +2 1 4 +1 1 3 10 2 3 +9 2 4 +8 2 5 +7 2 5 +6 2 4 +5 2 3 drop table t0,t1; # # Resolution of window names @@ -535,42 +536,40 @@ insert into t3 values (5, 2), (6, 2); select -pk, val, count(val) over (order by val range between current row and current row) as CNT from t3; -pk val CNT -0 1 3 -1 1 3 -2 1 3 -3 2 4 -4 2 4 -5 2 4 -6 2 4 +val CNT +1 3 +1 3 +1 3 +2 4 +2 4 +2 4 +2 4 insert into t3 values (7, 3), (8, 3); select -pk, val, count(val) over (order by val range between current row and current row) as CNT from t3; -pk val CNT -0 1 3 -1 1 3 -2 1 3 -3 2 4 -4 2 4 -5 2 4 -6 2 4 -7 3 2 -8 3 2 +val CNT +1 3 +1 3 +1 3 +2 4 +2 4 +2 4 +2 4 +3 2 +3 2 drop table t3; # Now, check with PARTITION BY create table t4 ( @@ -599,7 +598,6 @@ insert into t4 values (5678, 208, 3); select part_id, -pk, val, count(val) over (partition by part_id order by val @@ -607,31 +605,30 @@ range between current row and current row) as CNT from t4; -part_id pk val CNT -1234 100 1 3 -1234 101 1 3 -1234 102 1 3 -1234 103 2 4 -1234 104 2 4 -1234 105 2 4 -1234 106 2 4 -1234 107 3 2 -1234 108 3 2 -5678 200 1 3 -5678 201 1 3 -5678 202 1 3 -5678 203 2 4 -5678 204 2 4 -5678 205 2 4 -5678 206 2 4 -5678 207 3 2 -5678 208 3 2 +part_id val CNT +1234 1 3 +1234 1 3 +1234 1 3 +1234 2 4 +1234 2 4 +1234 2 4 +1234 2 4 +1234 3 2 +1234 3 2 +5678 1 3 +5678 1 3 +5678 1 3 +5678 2 4 +5678 2 4 +5678 2 4 +5678 2 4 +5678 3 2 +5678 3 2 # # Try RANGE UNBOUNDED PRECEDING | FOLLOWING # select part_id, -pk, val, count(val) over (partition by part_id order by val @@ -639,28 +636,27 @@ range between unbounded preceding and current row) as CNT from t4; -part_id pk val CNT -1234 100 1 3 -1234 101 1 3 -1234 102 1 3 -1234 103 2 7 -1234 104 2 7 -1234 105 2 7 -1234 106 2 7 -1234 107 3 9 -1234 108 3 9 -5678 200 1 3 -5678 201 1 3 -5678 202 1 3 -5678 203 2 7 -5678 204 2 7 -5678 205 2 7 -5678 206 2 7 -5678 207 3 9 -5678 208 3 9 +part_id val CNT +1234 1 3 +1234 1 3 +1234 1 3 +1234 2 7 +1234 2 7 +1234 2 7 +1234 2 7 +1234 3 9 +1234 3 9 +5678 1 3 +5678 1 3 +5678 1 3 +5678 2 7 +5678 2 7 +5678 2 7 +5678 2 7 +5678 3 9 +5678 3 9 select part_id, -pk, val, count(val) over (partition by part_id order by val @@ -668,28 +664,27 @@ range between current row and unbounded following) as CNT from t4; -part_id pk val CNT -1234 100 1 9 -1234 101 1 9 -1234 102 1 9 -1234 103 2 6 -1234 104 2 6 -1234 105 2 6 -1234 106 2 6 -1234 107 3 2 -1234 108 3 2 -5678 200 1 9 -5678 201 1 9 -5678 202 1 9 -5678 203 2 6 -5678 204 2 6 -5678 205 2 6 -5678 206 2 6 -5678 207 3 2 -5678 208 3 2 +part_id val CNT +1234 1 9 +1234 1 9 +1234 1 9 +1234 2 6 +1234 2 6 +1234 2 6 +1234 2 6 +1234 3 2 +1234 3 2 +5678 1 9 +5678 1 9 +5678 1 9 +5678 2 6 +5678 2 6 +5678 2 6 +5678 2 6 +5678 3 2 +5678 3 2 select part_id, -pk, val, count(val) over (partition by part_id order by val @@ -697,25 +692,25 @@ range between unbounded preceding and unbounded following) as CNT from t4; -part_id pk val CNT -1234 100 1 9 -1234 101 1 9 -1234 102 1 9 -1234 103 2 9 -1234 104 2 9 -1234 105 2 9 -1234 106 2 9 -1234 107 3 9 -1234 108 3 9 -5678 200 1 9 -5678 201 1 9 -5678 202 1 9 -5678 203 2 9 -5678 204 2 9 -5678 205 2 9 -5678 206 2 9 -5678 207 3 9 -5678 208 3 9 +part_id val CNT +1234 1 9 +1234 1 9 +1234 1 9 +1234 2 9 +1234 2 9 +1234 2 9 +1234 2 9 +1234 3 9 +1234 3 9 +5678 1 9 +5678 1 9 +5678 1 9 +5678 2 9 +5678 2 9 +5678 2 9 +5678 2 9 +5678 3 9 +5678 3 9 drop table t4; # # MDEV-9695: Wrong window frame when using RANGE BETWEEN N FOLLOWING AND PRECEDING @@ -881,15 +876,15 @@ RANGE BETWEEN UNBOUNDED PRECEDING AND 10 FOLLOWING) as cnt from t1; pk a cnt -1 1 9 -2 2 9 -3 4 9 -4 8 9 -5 26 5 -6 27 5 -7 40 3 -8 71 2 9 72 2 +8 71 2 +7 40 3 +6 27 5 +5 26 5 +4 8 9 +3 4 9 +2 2 9 +1 1 9 select pk, a, count(a) over (ORDER BY a @@ -929,15 +924,15 @@ RANGE BETWEEN UNBOUNDED PRECEDING AND 10 PRECEDING) as cnt from t1; pk a cnt -1 1 5 -2 2 5 -3 4 5 -4 8 5 -5 26 3 -6 27 3 -7 40 2 -8 71 0 9 72 0 +8 71 0 +7 40 2 +6 27 3 +5 26 3 +4 8 5 +3 4 5 +2 2 5 +1 1 5 select pk, a, count(a) over (ORDER BY a @@ -977,15 +972,15 @@ RANGE BETWEEN 1 PRECEDING AND CURRENT ROW) as cnt from t1; pk a cnt -1 1 2 -2 2 1 -3 4 1 -4 8 1 -5 26 2 -6 27 1 -7 40 1 -8 71 2 9 72 1 +8 71 2 +7 40 1 +6 27 1 +5 26 2 +4 8 1 +3 4 1 +2 2 1 +1 1 2 select pk, a, count(a) over (ORDER BY a @@ -1026,15 +1021,15 @@ range between current row and 1 following) as cnt from t1; pk a cnt -1 1 1 -2 2 2 -3 4 1 -4 8 1 -5 26 1 -6 27 2 -7 40 1 -8 71 1 9 72 2 +8 71 1 +7 40 1 +6 27 2 +5 26 1 +4 8 1 +3 4 1 +2 2 2 +1 1 1 insert into t1 select 22, pk, a from t1; select part_id, pk, a, @@ -1137,7 +1132,8 @@ pk, a, count(b) over (order by a range between 2 preceding and 2 following) as CNT -from t1; +from t1 +order by a, pk; pk a CNT 1 NULL 3 2 NULL 3 @@ -1969,12 +1965,12 @@ ROW_NUMBER() OVER (order by s1), CUME_DIST() OVER (order by -s1) from t1; s1 s2 ROW_NUMBER() OVER (order by s1) CUME_DIST() OVER (order by -s1) +-1 2 1.0000000000 1 a 3 0.8333333333 -NULL NULL 1 0.1666666667 +2 b 4 0.6666666667 3 NULL 5 0.5000000000 4 a 6 0.3333333333 -2 b 4 0.6666666667 --1 2 1.0000000000 +NULL NULL 1 0.1666666667 drop table t1; # # MDEV-9925: Wrong result with aggregate function as a window function @@ -2012,8 +2008,8 @@ o_custkey avg(o_custkey) OVER (PARTITION BY abs(o_custkey) ORDER BY o_custkey RANGE BETWEEN 15 FOLLOWING AND 15 FOLLOWING) -242 NULL 238 NULL +242 NULL DROP table orders; # # MDEV-10842: window functions with the same order column @@ -2042,20 +2038,20 @@ row_number() over (order by pk desc) as r_desc, row_number() over (order by pk asc) as r_asc from t1; pk r_desc r_asc -1 11 1 -2 10 2 -3 9 3 -4 8 4 -5 7 5 -6 6 6 -7 5 7 -8 4 8 -9 3 9 -10 2 10 11 1 11 +10 2 10 +9 3 9 +8 4 8 +7 5 7 +6 6 6 +5 7 5 +4 8 4 +3 9 3 +2 10 2 +1 11 1 drop table t1; # -# MDEV-10874: two window functions with ccompatible sorting +# MDEV-10874: two window functions with compatible sorting # create table t1 ( pk int primary key, @@ -2130,17 +2126,17 @@ sum(d) over (order by a ROWS BETWEEN 1 preceding and 2 following) as sum_2 from t1; pk a d sum_1 sum_2 -1 0 0.100 0.300 1.400 -2 0 0.200 0.500 1.200 3 0 0.300 0.300 0.600 -4 1 0.400 0.900 2.600 -5 1 0.500 1.100 2.400 +2 0 0.200 0.500 1.200 +1 0 0.100 0.300 1.400 6 1 0.600 0.600 1.600 -7 2 0.500 0.500 0.500 -8 2 NULL 0.700 1.200 -9 2 0.700 1.500 2.000 -10 2 0.800 1.700 2.400 +5 1 0.500 1.100 2.400 +4 1 0.400 0.900 2.600 11 2 0.900 0.900 2.800 +10 2 0.800 1.700 2.400 +9 2 0.700 1.500 2.000 +8 2 NULL 0.700 1.200 +7 2 0.500 0.500 0.500 drop table t1; # # MDEV-9941: two window functions with compatible partitions @@ -2232,9 +2228,9 @@ SELECT sum(t.a) over (partition by t.b order by a), sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) from t; sum(t.a) over (partition by t.b order by a) sqrt(ifnull((sum(t.a) over (partition by t.b order by a)), 0)) +0.0000000000 0 1.0000000000 1 3.0000000000 1.7320508075688772 -0.0000000000 0 drop table t; # # MDEV-10868: view definitions with window functions @@ -2391,9 +2387,9 @@ CREATE TABLE t2 (c VARCHAR(8)); INSERT INTO t2 VALUES ('foo'),('bar'),('foo'); SELECT COUNT(*) OVER (PARTITION BY c) FROM t2; COUNT(*) OVER (PARTITION BY c) -2 1 2 +2 SELECT * FROM t1 WHERE i IN ( SELECT COUNT(*) OVER (PARTITION BY c) FROM t2 ); i 1 @@ -2511,14 +2507,14 @@ select id, rank() over (order by id) from t1; id rank() over (order by id) 1 1 2 2 -3 4 2 2 +3 4 select * from v1; id rnk 1 1 2 2 -3 4 2 2 +3 4 drop view v1; drop table t1; # @@ -2879,64 +2875,64 @@ CDEC min(TDEC.CDEC) over () NULL -1 -1 -1 0 -1 -1 -1 0 -1 +1 -1 10 -1 select VDEC.CDEC, min(VDEC.CDEC) over () from VDEC; CDEC min(VDEC.CDEC) over () NULL -1 -1 -1 0 -1 -1 -1 0 -1 +1 -1 10 -1 select TDEC.CDEC, max(TDEC.CDEC) over () from TDEC; CDEC max(TDEC.CDEC) over () NULL 10 -1 10 0 10 -1 10 0 10 +1 10 10 10 select VDEC.CDEC, max(VDEC.CDEC) over () from VDEC; CDEC max(VDEC.CDEC) over () NULL 10 -1 10 0 10 -1 10 0 10 +1 10 10 10 select TDEC.CDEC, min(distinct TDEC.CDEC) over () from TDEC; CDEC min(distinct TDEC.CDEC) over () NULL -1 -1 -1 0 -1 -1 -1 0 -1 +1 -1 10 -1 select VDEC.CDEC, min(distinct VDEC.CDEC) over () from VDEC; CDEC min(distinct VDEC.CDEC) over () NULL -1 -1 -1 0 -1 -1 -1 0 -1 +1 -1 10 -1 select TDEC.CDEC, max(distinct TDEC.CDEC) over () from TDEC; CDEC max(distinct TDEC.CDEC) over () NULL 10 -1 10 0 10 -1 10 0 10 +1 10 10 10 select VDEC.CDEC, max(distinct VDEC.CDEC) over () from VDEC; CDEC max(distinct VDEC.CDEC) over () NULL 10 -1 10 0 10 -1 10 0 10 +1 10 10 10 # # These should be removed once support for them is added. @@ -3315,7 +3311,185 @@ COUNT(DISTINCT t2.a2) rank() OVER (ORDER BY t2.b1) 1 3 DROP TABLE t1,t2; # -# Start of 10.3 tests +# MDEV-16990: server crashes in base_list_iterator::next +# +CREATE TABLE t1(i int); +insert into t1 values (1),(2); +SELECT DISTINCT row_number() OVER (), MAX(1) FROM t1; +row_number() OVER () MAX(1) +1 1 +SELECT DISTINCT BIT_AND(0) OVER (), MAX(1) FROM t1; +BIT_AND(0) OVER () MAX(1) +0 1 +drop table t1; +# +# MDEV-17525: Window functions not working in ONLY_FULL_GROUP_BY mode +# +CREATE TABLE t1 (name CHAR(10), test CHAR(10), score TINYINT); +INSERT INTO t1 VALUES +('Chun', 'SQL', 75), ('Chun', 'Tuning', 73), +('Esben', 'SQL', 43), ('Esben', 'Tuning', 31), +('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88), +('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83); +SET @save_sql_mode= @@sql_mode; +SET sql_mode = 'ONLY_FULL_GROUP_BY'; +SELECT name, test, score, +AVG(score) OVER (PARTITION BY test) AS average_by_test +FROM t1 +ORDER BY test, name; +name test score average_by_test +Chun SQL 75 65.2500 +Esben SQL 43 65.2500 +Kaolin SQL 56 65.2500 +Tatiana SQL 87 65.2500 +Chun Tuning 73 68.7500 +Esben Tuning 31 68.7500 +Kaolin Tuning 88 68.7500 +Tatiana Tuning 83 68.7500 +set @@sql_mode= @save_sql_mode; +SELECT name, test, score, +AVG(score) OVER (PARTITION BY test) AS average_by_test +FROM t1 +ORDER BY test, name; +name test score average_by_test +Chun SQL 75 65.2500 +Esben SQL 43 65.2500 +Kaolin SQL 56 65.2500 +Tatiana SQL 87 65.2500 +Chun Tuning 73 68.7500 +Esben Tuning 31 68.7500 +Kaolin Tuning 88 68.7500 +Tatiana Tuning 83 68.7500 +drop table t1; +# +# MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free +# or Invalid write in JOIN::make_aggr_tables_info +# +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) order by 1+2; +BIT_OR(100) OVER () +100 +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); +SELECT * FROM ( +SELECT +ROW_NUMBER() OVER(), i, sum(i) +FROM t1 +WHERE 1=0 +limit 0 +) AS sq; +ROW_NUMBER() OVER() i sum(i) +SELECT * FROM ( +SELECT +ROW_NUMBER() OVER(), i, sum(i) +FROM t1 +WHERE 1=0 +GROUP BY i +) AS sq; +ROW_NUMBER() OVER() i sum(i) +drop table t1; +create table t1 (a int); +explain +select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible WHERE noticed after reading const tables +select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; +1 row_number() over (order by 1) +drop table t1; +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP +HAVING @A := 'qwerty'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP +HAVING @A := 'qwerty'; +BIT_OR(100) OVER () +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) +HAVING @A := 'qwerty'; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Impossible HAVING +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) +HAVING @A := 'qwerty'; +BIT_OR(100) OVER () +create table t1 (a int); +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM t1 +GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL Zero limit +drop table t1; +# +# MDEV-13170: Database service (MySQL) stops after update with trigger +# +CREATE TABLE t1 ( t1_id int, point_id int, ml_id int, UNIQUE KEY t1_ml_u (ml_id,point_id)) ; +INSERT INTO t1 VALUES (1,1,8884),(2,1,8885); +CREATE TABLE t2 ( db_time datetime, au_nr int, col_id int, new_val int); +CREATE TABLE t3 (id1 int, id2 int, d1 int); +CREATE TRIGGER t1_aurtrg AFTER UPDATE ON t1 FOR EACH ROW begin +CREATE OR REPLACE TEMPORARY TABLE trg_u AS +WITH l AS +(SELECT a.*, +Max(t2.col_id) over (PARTITION BY a.d1), +Max(t2.new_val) over (PARTITION BY a.d1) +FROM +(SELECT d1 , id1, id2 FROM t3) a +JOIN t2 ON (a.d1=t2.db_time AND a.id1=t2.au_nr)) +SELECT 1; +END;// +update t1 set ml_id=8884 where point_id=1; +ERROR 23000: Duplicate entry '8884-1' for key 't1_ml_u' +update t1 set ml_id=8884 where point_id=1; +ERROR 23000: Duplicate entry '8884-1' for key 't1_ml_u' +drop table t1, t2,t3; +CREATE TABLE t1 (i INT, a char); +INSERT INTO t1 VALUES (1, 'a'),(2, 'b'); +create view v1 as select * from t1; +PREPARE stmt FROM "SELECT i, row_number() over (partition by i order by i) FROM v1"; +execute stmt; +i row_number() over (partition by i order by i) +1 1 +2 1 +deallocate prepare stmt; +drop table t1; +drop view v1; +# +# MDEV-17676: Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init +# +CREATE TABLE t1 (b1 text NOT NULL); +INSERT INTO t1 VALUES ('2'),('1'); +EXPLAIN +SELECT DISTINCT MIN(b1) OVER () FROM t1; +id select_type table type possible_keys key key_len ref rows Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 2 Using temporary +SELECT DISTINCT MIN(b1) OVER () FROM t1; +MIN(b1) OVER () +1 +drop table t1; +# +# MDEV-15424: Unreasonal SQL Error (1356) on select from view +# +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY ALL NULL NULL NULL NULL 4 +2 DERIVED t1 ALL NULL NULL NULL NULL 4 Using temporary +select * from v1; +ifnull(max(n1) over (partition by n1),'aaa') +1 +1 +2 +4 +drop table t1; +drop view v1; +# +# End of 10.2 tests # # # MDEV-16489 when lead() returns null on a datetime field, the result is treated as the literal string '[NULL]' @@ -3335,6 +3509,9 @@ d x 00:00:02 NULL DROP TABLE t1; # +# End of 10.3 tests +# +# # MDEV-16722: Assertion `type() != NULL_ITEM' failed # create table t1 (a int); diff --git a/mysql-test/main/win.test b/mysql-test/main/win.test index f038316ce98..19e83ea8c41 100644 --- a/mysql-test/main/win.test +++ b/mysql-test/main/win.test @@ -58,7 +58,8 @@ select pk, a, b, row_number() over (order by a), row_number() over (order by b) -from t1; +from t1 +order by b; drop table t1; @@ -391,7 +392,6 @@ insert into t3 values (6, 2); select - pk, val, count(val) over (order by val range between current row and @@ -404,7 +404,6 @@ insert into t3 values (8, 3); select - pk, val, count(val) over (order by val range between current row and @@ -444,7 +443,6 @@ insert into t4 values select part_id, - pk, val, count(val) over (partition by part_id order by val @@ -458,7 +456,6 @@ from t4; --echo # select part_id, - pk, val, count(val) over (partition by part_id order by val @@ -469,7 +466,6 @@ from t4; select part_id, - pk, val, count(val) over (partition by part_id order by val @@ -480,7 +476,6 @@ from t4; select part_id, - pk, val, count(val) over (partition by part_id order by val @@ -723,7 +718,8 @@ select count(b) over (order by a range between 2 preceding and 2 following) as CNT -from t1; +from t1 +order by a, pk; drop table t1; --echo # @@ -1023,6 +1019,7 @@ insert into t1 values --echo # Check using counters flush status; +--sorted_result select rank() over (partition by c order by a), rank() over (partition by c order by b) @@ -1030,6 +1027,7 @@ from t1; show status like '%sort%'; flush status; +--sorted_result select rank() over (partition by c order by a), rank() over (partition by c order by a) @@ -1101,6 +1099,7 @@ insert into t1 values (2,2), (3,1); +--sorted_result select a, b, rank() over (order by a), rank() over (order by b), @@ -1192,6 +1191,7 @@ insert into t1 values (4,'a'); insert into t1 values (2,'b'); insert into t1 values (-1,''); +--sorted_result select *, ROW_NUMBER() OVER (order by s1), @@ -1267,7 +1267,7 @@ from t1; drop table t1; --echo # ---echo # MDEV-10874: two window functions with ccompatible sorting +--echo # MDEV-10874: two window functions with compatible sorting --echo # create table t1 ( @@ -2084,7 +2084,165 @@ FROM t2 ,t1 GROUP BY t2.b1 ORDER BY t1.a1; DROP TABLE t1,t2; --echo # ---echo # Start of 10.3 tests +--echo # MDEV-16990: server crashes in base_list_iterator::next +--echo # + +CREATE TABLE t1(i int); +insert into t1 values (1),(2); +SELECT DISTINCT row_number() OVER (), MAX(1) FROM t1; +SELECT DISTINCT BIT_AND(0) OVER (), MAX(1) FROM t1; +drop table t1; + +--echo # +--echo # MDEV-17525: Window functions not working in ONLY_FULL_GROUP_BY mode +--echo # + +CREATE TABLE t1 (name CHAR(10), test CHAR(10), score TINYINT); + +INSERT INTO t1 VALUES +('Chun', 'SQL', 75), ('Chun', 'Tuning', 73), +('Esben', 'SQL', 43), ('Esben', 'Tuning', 31), +('Kaolin', 'SQL', 56), ('Kaolin', 'Tuning', 88), +('Tatiana', 'SQL', 87), ('Tatiana', 'Tuning', 83); + +SET @save_sql_mode= @@sql_mode; +SET sql_mode = 'ONLY_FULL_GROUP_BY'; + +SELECT name, test, score, + AVG(score) OVER (PARTITION BY test) AS average_by_test +FROM t1 +ORDER BY test, name; + +set @@sql_mode= @save_sql_mode; +SELECT name, test, score, + AVG(score) OVER (PARTITION BY test) AS average_by_test +FROM t1 +ORDER BY test, name; +drop table t1; + +--echo # +--echo # MDEV-12575: Server crash in AGGR_OP::put_record or in JOIN_CACHE::free +--echo # or Invalid write in JOIN::make_aggr_tables_info +--echo # + +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) order by 1+2; + +CREATE TABLE t1 (i INT); +INSERT INTO t1 VALUES (1),(2); + +SELECT * FROM ( + SELECT + ROW_NUMBER() OVER(), i, sum(i) + FROM t1 + WHERE 1=0 + limit 0 +) AS sq; + +SELECT * FROM ( + SELECT + ROW_NUMBER() OVER(), i, sum(i) + FROM t1 + WHERE 1=0 + GROUP BY i +) AS sq; +drop table t1; + +create table t1 (a int); +explain +select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; +select distinct 1, row_number() over (order by 1) from t1 where a=0 group by a with rollup; +drop table t1; + +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP +HAVING @A := 'qwerty'; +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) WITH ROLLUP +HAVING @A := 'qwerty'; + +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) +HAVING @A := 'qwerty'; +SELECT DISTINCT BIT_OR(100) OVER () FROM dual +GROUP BY LEFT('2018-08-24', 100) +HAVING @A := 'qwerty'; + +create table t1 (a int); +explain +SELECT DISTINCT BIT_OR(100) OVER () FROM t1 +GROUP BY LEFT('2018-08-24', 100) having 1=1 limit 0; +drop table t1; + +--echo # +--echo # MDEV-13170: Database service (MySQL) stops after update with trigger +--echo # + +CREATE TABLE t1 ( t1_id int, point_id int, ml_id int, UNIQUE KEY t1_ml_u (ml_id,point_id)) ; +INSERT INTO t1 VALUES (1,1,8884),(2,1,8885); + +CREATE TABLE t2 ( db_time datetime, au_nr int, col_id int, new_val int); +CREATE TABLE t3 (id1 int, id2 int, d1 int); + +delimiter //; + +CREATE TRIGGER t1_aurtrg AFTER UPDATE ON t1 FOR EACH ROW begin +CREATE OR REPLACE TEMPORARY TABLE trg_u AS +WITH l AS + (SELECT a.*, + Max(t2.col_id) over (PARTITION BY a.d1), + Max(t2.new_val) over (PARTITION BY a.d1) + FROM + (SELECT d1 , id1, id2 FROM t3) a + JOIN t2 ON (a.d1=t2.db_time AND a.id1=t2.au_nr)) +SELECT 1; + + END;// + + delimiter ;// +--error 1062 +update t1 set ml_id=8884 where point_id=1; +--error 1062 +update t1 set ml_id=8884 where point_id=1; +drop table t1, t2,t3; + +CREATE TABLE t1 (i INT, a char); +INSERT INTO t1 VALUES (1, 'a'),(2, 'b'); +create view v1 as select * from t1; +PREPARE stmt FROM "SELECT i, row_number() over (partition by i order by i) FROM v1"; +execute stmt; +deallocate prepare stmt; +drop table t1; +drop view v1; + +--echo # +--echo # MDEV-17676: Assertion `inited==NONE || (inited==RND && scan)' failed in handler::ha_rnd_init +--echo # + +CREATE TABLE t1 (b1 text NOT NULL); +INSERT INTO t1 VALUES ('2'),('1'); +EXPLAIN +SELECT DISTINCT MIN(b1) OVER () FROM t1; +SELECT DISTINCT MIN(b1) OVER () FROM t1; +drop table t1; + +--echo # +--echo # MDEV-15424: Unreasonal SQL Error (1356) on select from view +--echo # + +create table t1 (id int, n1 int); +insert into t1 values (1,1), (2,1), (3,2), (4,4); + +create view v1 as SELECT ifnull(max(n1) over (partition by n1),'aaa') FROM t1; +explain select * from v1; +select * from v1; +drop table t1; +drop view v1; + +--echo # +--echo # End of 10.2 tests --echo # --echo # @@ -2101,6 +2259,10 @@ INSERT INTO t1 VALUES ('00:00:01'),('00:00:02'); SELECT *, LEAD(d) OVER (ORDER BY d) AS x FROM t1; DROP TABLE t1; +--echo # +--echo # End of 10.3 tests +--echo # + --echo # --echo # MDEV-16722: Assertion `type() != NULL_ITEM' failed --echo # diff --git a/mysql-test/main/win_big-mdev-11697.result b/mysql-test/main/win_big-mdev-11697.result index e5dc271839c..ec9d2243c88 100644 --- a/mysql-test/main/win_big-mdev-11697.result +++ b/mysql-test/main/win_big-mdev-11697.result @@ -12,6 +12,7 @@ select * from data_generator commit; analyze table test_table; Table Op Msg_type Msg_text +test.test_table analyze status Engine-independent statistics collected test.test_table analyze status OK explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10; id select_type table type possible_keys key key_len ref rows Extra @@ -44,6 +45,7 @@ select * from data_generator commit; analyze table test_table; Table Op Msg_type Msg_text +test.test_table analyze status Engine-independent statistics collected test.test_table analyze status OK explain select * from (select id, lead(id) over(order by id) next_id from test_table order by id) a limit 10; id select_type table type possible_keys key key_len ref rows Extra diff --git a/mysql-test/main/win_big.result b/mysql-test/main/win_big.result index 225ecae3224..c8b27b9a1aa 100644 --- a/mysql-test/main/win_big.result +++ b/mysql-test/main/win_big.result @@ -38,10 +38,6 @@ where variable_name like 'Sort_merge_passes'; variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end SORT_MERGE_PASSES WITH PASSES include/diff_tables.inc [t21, t22] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead drop table t21, t22; ################################################################# # Try many cursors @@ -76,10 +72,6 @@ where variable_name like 'Sort_merge_passes'; variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end SORT_MERGE_PASSES WITH PASSES include/diff_tables.inc [t21, t22] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead drop table t21, t22; ################################################################# # Try having cursors pointing at different IO_CACHE pages @@ -113,10 +105,6 @@ where variable_name like 'Sort_merge_passes'; variable_name case when variable_value > 0 then 'WITH PASSES' else 'NO PASSES' end SORT_MERGE_PASSES WITH PASSES include/diff_tables.inc [t21, t22] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead drop table t21, t22; ################################################################# drop table t10; diff --git a/mysql-test/main/win_first_last_value.result b/mysql-test/main/win_first_last_value.result index 9de394ef9e0..4c3aa6a7161 100644 --- a/mysql-test/main/win_first_last_value.result +++ b/mysql-test/main/win_first_last_value.result @@ -68,17 +68,17 @@ first_value(pk) over (order by pk desc), last_value(pk) over (order by pk desc) from t1; pk first_value(pk) over (order by pk desc) last_value(pk) over (order by pk desc) -1 11 1 -2 11 2 -3 11 3 -4 11 4 -5 11 5 -6 11 6 -7 11 7 -8 11 8 -9 11 9 -10 11 10 11 11 11 +10 11 10 +9 11 9 +8 11 8 +7 11 7 +6 11 6 +5 11 5 +4 11 4 +3 11 3 +2 11 2 +1 11 1 select pk, a, b, c, d, e, first_value(b) over (partition by a order by pk) as fst_b, last_value(b) over (partition by a order by pk) as lst_b, diff --git a/mysql-test/main/win_percent_cume.result b/mysql-test/main/win_percent_cume.result index d38c95c9ea7..bc2a4182e30 100644 --- a/mysql-test/main/win_percent_cume.result +++ b/mysql-test/main/win_percent_cume.result @@ -14,49 +14,49 @@ insert into t1 values ( 7 , 2, 20), ( 9 , 4, 20), (10 , 4, 20); -select pk, a, b, +select a, percent_rank() over (order by a), cume_dist() over (order by a) from t1; -pk a b percent_rank() over (order by a) cume_dist() over (order by a) -1 0 10 0.0000000000 0.2000000000 -2 0 10 0.0000000000 0.2000000000 -3 1 10 0.2222222222 0.4000000000 -4 1 10 0.2222222222 0.4000000000 -8 2 10 0.4444444444 0.8000000000 -5 2 20 0.4444444444 0.8000000000 -6 2 20 0.4444444444 0.8000000000 -7 2 20 0.4444444444 0.8000000000 -9 4 20 0.8888888889 1.0000000000 -10 4 20 0.8888888889 1.0000000000 -select pk, a, b, +a percent_rank() over (order by a) cume_dist() over (order by a) +0 0.0000000000 0.2000000000 +0 0.0000000000 0.2000000000 +1 0.2222222222 0.4000000000 +1 0.2222222222 0.4000000000 +2 0.4444444444 0.8000000000 +2 0.4444444444 0.8000000000 +2 0.4444444444 0.8000000000 +2 0.4444444444 0.8000000000 +4 0.8888888889 1.0000000000 +4 0.8888888889 1.0000000000 +select pk, percent_rank() over (order by pk), cume_dist() over (order by pk) from t1 order by pk; -pk a b percent_rank() over (order by pk) cume_dist() over (order by pk) -1 0 10 0.0000000000 0.1000000000 -2 0 10 0.1111111111 0.2000000000 -3 1 10 0.2222222222 0.3000000000 -4 1 10 0.3333333333 0.4000000000 -5 2 20 0.4444444444 0.5000000000 -6 2 20 0.5555555556 0.6000000000 -7 2 20 0.6666666667 0.7000000000 -8 2 10 0.7777777778 0.8000000000 -9 4 20 0.8888888889 0.9000000000 -10 4 20 1.0000000000 1.0000000000 -select pk, a, b, +pk percent_rank() over (order by pk) cume_dist() over (order by pk) +1 0.0000000000 0.1000000000 +2 0.1111111111 0.2000000000 +3 0.2222222222 0.3000000000 +4 0.3333333333 0.4000000000 +5 0.4444444444 0.5000000000 +6 0.5555555556 0.6000000000 +7 0.6666666667 0.7000000000 +8 0.7777777778 0.8000000000 +9 0.8888888889 0.9000000000 +10 1.0000000000 1.0000000000 +select a, percent_rank() over (partition by a order by a), cume_dist() over (partition by a order by a) from t1; -pk a b percent_rank() over (partition by a order by a) cume_dist() over (partition by a order by a) -1 0 10 0.0000000000 1.0000000000 -2 0 10 0.0000000000 1.0000000000 -3 1 10 0.0000000000 1.0000000000 -4 1 10 0.0000000000 1.0000000000 -8 2 10 0.0000000000 1.0000000000 -5 2 20 0.0000000000 1.0000000000 -6 2 20 0.0000000000 1.0000000000 -7 2 20 0.0000000000 1.0000000000 -9 4 20 0.0000000000 1.0000000000 -10 4 20 0.0000000000 1.0000000000 +a percent_rank() over (partition by a order by a) cume_dist() over (partition by a order by a) +0 0.0000000000 1.0000000000 +0 0.0000000000 1.0000000000 +1 0.0000000000 1.0000000000 +1 0.0000000000 1.0000000000 +2 0.0000000000 1.0000000000 +2 0.0000000000 1.0000000000 +2 0.0000000000 1.0000000000 +2 0.0000000000 1.0000000000 +4 0.0000000000 1.0000000000 +4 0.0000000000 1.0000000000 drop table t1; diff --git a/mysql-test/main/win_percent_cume.test b/mysql-test/main/win_percent_cume.test index b851185cb32..05ace95d571 100644 --- a/mysql-test/main/win_percent_cume.test +++ b/mysql-test/main/win_percent_cume.test @@ -17,17 +17,17 @@ insert into t1 values ( 9 , 4, 20), (10 , 4, 20); -select pk, a, b, +select a, percent_rank() over (order by a), cume_dist() over (order by a) from t1; -select pk, a, b, +select pk, percent_rank() over (order by pk), cume_dist() over (order by pk) from t1 order by pk; -select pk, a, b, +select a, percent_rank() over (partition by a order by a), cume_dist() over (partition by a order by a) from t1; diff --git a/mysql-test/main/win_percentile.result b/mysql-test/main/win_percentile.result index f46fad80d16..4a918bad17f 100644 --- a/mysql-test/main/win_percentile.result +++ b/mysql-test/main/win_percentile.result @@ -32,8 +32,8 @@ Chun 5.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 -Tatiana 4.0000000000 Tata 4.0000000000 +Tatiana 4.0000000000 select name, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1; name c Chun 3.0000000000 @@ -41,8 +41,8 @@ Chun 3.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 -Tatiana 4.0000000000 Tata 4.0000000000 +Tatiana 4.0000000000 # no partition clause select name, percentile_disc(0.5) within group(order by score) over () from t1; name percentile_disc(0.5) within group(order by score) over () @@ -51,8 +51,8 @@ Chun 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 -Tatiana 4.0000000000 Tata 4.0000000000 +Tatiana 4.0000000000 select name, percentile_cont(0.5) within group(order by score) over () from t1; name percentile_cont(0.5) within group(order by score) over () Chun 4.0000000000 @@ -60,8 +60,8 @@ Chun 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 -Tatiana 4.0000000000 Tata 4.0000000000 +Tatiana 4.0000000000 # argument set to null select name, percentile_cont(null) within group(order by score) over (partition by name) from t1; ERROR HY000: percentile_cont function only accepts arguments that can be converted to numerical types @@ -75,8 +75,8 @@ Chun 5.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 -Tatiana 4.0000000000 Tata 4.0000000000 +Tatiana 4.0000000000 select * from ( select name , percentile_disc(0.5) within group ( order by score) over (partition by name ) from t1 ) as t; name percentile_disc(0.5) within group ( order by score) over (partition by name ) Chun 3.0000000000 @@ -84,8 +84,8 @@ Chun 3.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 -Tatiana 4.0000000000 Tata 4.0000000000 +Tatiana 4.0000000000 select name from t1 a where (select percentile_disc(0.5) within group (order by score) over (partition by name) from t1 b limit 1) >= 0.5; name Chun @@ -93,8 +93,8 @@ Chun Kaolin Kaolin Kaolin -Tatiana Tata +Tatiana #disallowed fields in order by select score, percentile_cont(0.5) within group(order by name) over (partition by score) from t1; ERROR HY000: Numeric datatype is required for percentile_cont function @@ -121,10 +121,10 @@ name cume_dist() over (partition by name order by score) c Chun 0.5000000000 3.0000000000 Chun 1.0000000000 3.0000000000 Kaolin 0.3333333333 4.0000000000 -Kaolin 1.0000000000 4.0000000000 Kaolin 0.6666666667 4.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1; name c Chun 5.0000000000 @@ -132,98 +132,98 @@ Chun 5.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 Kaolin 4.0000000000 -Tatiana 4.0000000000 Tata 4.0000000000 +Tatiana 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.1) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 3.0000000000 Chun 1.0000000000 3.0000000000 Kaolin 0.3333333333 3.0000000000 -Kaolin 1.0000000000 3.0000000000 Kaolin 0.6666666667 3.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 3.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.2) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 3.0000000000 Chun 1.0000000000 3.0000000000 Kaolin 0.3333333333 3.0000000000 -Kaolin 1.0000000000 3.0000000000 Kaolin 0.6666666667 3.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 3.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.3) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 3.0000000000 Chun 1.0000000000 3.0000000000 Kaolin 0.3333333333 3.0000000000 -Kaolin 1.0000000000 3.0000000000 Kaolin 0.6666666667 3.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 3.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.4) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 3.0000000000 Chun 1.0000000000 3.0000000000 Kaolin 0.3333333333 4.0000000000 -Kaolin 1.0000000000 4.0000000000 Kaolin 0.6666666667 4.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 3.0000000000 Chun 1.0000000000 3.0000000000 Kaolin 0.3333333333 4.0000000000 -Kaolin 1.0000000000 4.0000000000 Kaolin 0.6666666667 4.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.6) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 7.0000000000 Chun 1.0000000000 7.0000000000 Kaolin 0.3333333333 4.0000000000 -Kaolin 1.0000000000 4.0000000000 Kaolin 0.6666666667 4.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 4.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.7) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 7.0000000000 Chun 1.0000000000 7.0000000000 Kaolin 0.3333333333 7.0000000000 -Kaolin 1.0000000000 7.0000000000 Kaolin 0.6666666667 7.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 7.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.8) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 7.0000000000 Chun 1.0000000000 7.0000000000 Kaolin 0.3333333333 7.0000000000 -Kaolin 1.0000000000 7.0000000000 Kaolin 0.6666666667 7.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 7.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(0.9) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 7.0000000000 Chun 1.0000000000 7.0000000000 Kaolin 0.3333333333 7.0000000000 -Kaolin 1.0000000000 7.0000000000 Kaolin 0.6666666667 7.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 7.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select name,cume_dist() over (partition by name order by score) as b, percentile_disc(1) within group(order by score) over (partition by name) as c from t1; name b c Chun 0.5000000000 7.0000000000 Chun 1.0000000000 7.0000000000 Kaolin 0.3333333333 7.0000000000 -Kaolin 1.0000000000 7.0000000000 Kaolin 0.6666666667 7.0000000000 -Tatiana 1.0000000000 4.0000000000 +Kaolin 1.0000000000 7.0000000000 Tata 1.0000000000 4.0000000000 +Tatiana 1.0000000000 4.0000000000 select median(score) over (partition by name), percentile_cont(0) within group(order by score) over (partition by name) as c from t1; median(score) over (partition by name) c 5.0000000000 3.0000000000 @@ -348,3 +348,21 @@ MEDIAN(`a2`) OVER (PARTITION BY `pk`) FROM t1; MEDIAN(`a1`) OVER () MEDIAN(`a2`) OVER (PARTITION BY `pk`) DROP TABLE t1; +# +# MDEV-17137: Syntax errors with VIEW using MEDIAN +# +CREATE TABLE t1(val int); +INSERT INTO t1 VALUES (1), (2), (3); +CREATE VIEW v1 AS SELECT MEDIAN(val) OVER() FROM t1; +select * from v1; +MEDIAN(val) OVER() +2.0000000000 +2.0000000000 +2.0000000000 +select median(val) OVER () FROM t1; +median(val) OVER () +2.0000000000 +2.0000000000 +2.0000000000 +drop table t1; +drop view v1; diff --git a/mysql-test/main/win_percentile.test b/mysql-test/main/win_percentile.test index e39af8cfd39..d36b365dd9b 100644 --- a/mysql-test/main/win_percentile.test +++ b/mysql-test/main/win_percentile.test @@ -33,11 +33,15 @@ select percentile_cont() within group() over (partition by name) from t1; --echo # Test simple syntax --echo # +--sorted_result select name, percentile_cont(0.5) within group(order by score) over (partition by name) as c from t1; +--sorted_result select name, percentile_disc(0.5) within group(order by score) over (partition by name) as c from t1; --echo # no partition clause +--sorted_result select name, percentile_disc(0.5) within group(order by score) over () from t1; +--sorted_result select name, percentile_cont(0.5) within group(order by score) over () from t1; --echo # argument set to null @@ -47,8 +51,11 @@ select name, percentile_cont(null) within group(order by score) over (partition select name, percentile_disc(null) within group(order by score) over (partition by name) from t1; --echo #subqueries having percentile functions +--sorted_result select * from ( select name , percentile_cont(0.5) within group ( order by score) over (partition by name ) from t1 ) as t; +--sorted_result select * from ( select name , percentile_disc(0.5) within group ( order by score) over (partition by name ) from t1 ) as t; +--sorted_result select name from t1 a where (select percentile_disc(0.5) within group (order by score) over (partition by name) from t1 b limit 1) >= 0.5; --echo #disallowed fields in order by @@ -127,3 +134,15 @@ SELECT MEDIAN(`a1`) OVER (), MEDIAN(`a2`) OVER (PARTITION BY `pk`) FROM t1; DROP TABLE t1; + +--echo # +--echo # MDEV-17137: Syntax errors with VIEW using MEDIAN +--echo # + +CREATE TABLE t1(val int); +INSERT INTO t1 VALUES (1), (2), (3); +CREATE VIEW v1 AS SELECT MEDIAN(val) OVER() FROM t1; +select * from v1; +select median(val) OVER () FROM t1; +drop table t1; +drop view v1; diff --git a/mysql-test/main/win_rank.result b/mysql-test/main/win_rank.result index 725683d3869..e74c2edd662 100644 --- a/mysql-test/main/win_rank.result +++ b/mysql-test/main/win_rank.result @@ -17,34 +17,34 @@ insert into t1 values ( 7 , 2, 20), ( 9 , 4, 20), (10 , 4, 20); -select pk, a, b, rank() over (order by a) as rank, +select a, rank() over (order by a) as rank, dense_rank() over (order by a) as dense_rank from t1; -pk a b rank dense_rank -1 0 10 1 1 -2 0 10 1 1 -3 1 10 3 2 -4 1 10 3 2 -8 2 10 5 3 -5 2 20 5 3 -6 2 20 5 3 -7 2 20 5 3 -9 4 20 9 4 -10 4 20 9 4 -select pk, a, b, rank() over (partition by b order by a) as rank, +a rank dense_rank +0 1 1 +0 1 1 +1 3 2 +1 3 2 +2 5 3 +2 5 3 +2 5 3 +2 5 3 +4 9 4 +4 9 4 +select a, b, rank() over (partition by b order by a) as rank, dense_rank() over (partition by b order by a) as dense_rank from t1; -pk a b rank dense_rank -1 0 10 1 1 -2 0 10 1 1 -3 1 10 3 2 -4 1 10 3 2 -8 2 10 5 3 -5 2 20 1 1 -6 2 20 1 1 -7 2 20 1 1 -9 4 20 4 2 -10 4 20 4 2 +a b rank dense_rank +0 10 1 1 +0 10 1 1 +1 10 3 2 +1 10 3 2 +2 10 5 3 +2 20 1 1 +2 20 1 1 +2 20 1 1 +4 20 4 2 +4 20 4 2 drop table t1; # # Test with null values in the table. @@ -59,46 +59,49 @@ insert into t2 values (2,'b'); insert into t2 values (-1,''); select *, rank() over (order by s1) as rank, dense_rank() over (order by s1) as dense_rank -from t2; +from t2 +order by s1, s2; s1 s2 rank dense_rank -1 a 5 3 NULL NULL 1 1 -1 NULL 5 3 NULL a 1 1 NULL c 1 1 -2 b 7 4 -1 4 2 +1 NULL 5 3 +1 a 5 3 +2 b 7 4 select *, rank() over (partition by s2 order by s1) as rank, dense_rank() over (partition by s2 order by s1) as dense_rank -from t2; +from t2 +order by s1, s2; s1 s2 rank dense_rank -1 a 2 2 NULL NULL 1 1 -1 NULL 2 2 NULL a 1 1 NULL c 1 1 -2 b 1 1 -1 1 1 +1 NULL 2 2 +1 a 2 2 +2 b 1 1 select *, rank() over (order by s2) as rank, dense_rank() over (order by s2) as dense_rank -from t2; +from t2 +order by s2, s1; s1 s2 rank dense_rank -1 a 4 3 NULL NULL 1 1 1 NULL 1 1 -NULL a 4 3 -NULL c 7 5 -2 b 6 4 -1 3 2 +NULL a 4 3 +1 a 4 3 +2 b 6 4 +NULL c 7 5 select *, rank() over (partition by s1 order by s2) as rank, dense_rank() over (partition by s1 order by s2) as dense_rank from t2; s1 s2 rank dense_rank -1 a 2 2 NULL NULL 1 1 -1 NULL 1 1 NULL a 2 2 NULL c 3 3 -2 b 1 1 -1 1 1 +1 NULL 1 1 +1 a 2 2 +2 b 1 1 drop table t2; diff --git a/mysql-test/main/win_rank.test b/mysql-test/main/win_rank.test index eda1f458205..c58ff054117 100644 --- a/mysql-test/main/win_rank.test +++ b/mysql-test/main/win_rank.test @@ -20,11 +20,11 @@ insert into t1 values ( 9 , 4, 20), (10 , 4, 20); -select pk, a, b, rank() over (order by a) as rank, - dense_rank() over (order by a) as dense_rank +select a, rank() over (order by a) as rank, + dense_rank() over (order by a) as dense_rank from t1; -select pk, a, b, rank() over (partition by b order by a) as rank, - dense_rank() over (partition by b order by a) as dense_rank +select a, b, rank() over (partition by b order by a) as rank, + dense_rank() over (partition by b order by a) as dense_rank from t1; drop table t1; @@ -44,13 +44,16 @@ insert into t2 values (-1,''); select *, rank() over (order by s1) as rank, dense_rank() over (order by s1) as dense_rank -from t2; +from t2 +order by s1, s2; select *, rank() over (partition by s2 order by s1) as rank, dense_rank() over (partition by s2 order by s1) as dense_rank -from t2; +from t2 +order by s1, s2; select *, rank() over (order by s2) as rank, dense_rank() over (order by s2) as dense_rank -from t2; +from t2 +order by s2, s1; select *, rank() over (partition by s1 order by s2) as rank, dense_rank() over (partition by s1 order by s2) as dense_rank from t2; diff --git a/mysql-test/main/win_std.test b/mysql-test/main/win_std.test index 5ed999431c0..c1964ecac98 100644 --- a/mysql-test/main/win_std.test +++ b/mysql-test/main/win_std.test @@ -80,9 +80,11 @@ select std(b) over (order by a rows between current row and 0 following) from t2; --echo # Only peers frame. +--sorted_result select a, b, std(b) over (order by a range between 0 preceding and 0 preceding) from t2; +--sorted_result select a, b, std(b) over (order by a range between 0 preceding and current row) from t2; @@ -90,9 +92,11 @@ from t2; select a, b, std(b) over (order by a range between current row and 0 preceding) from t2; +--sorted_result select a, b, std(b) over (order by a range between current row and 0 following) from t2; +--sorted_result select a, b, std(b) over (order by a range between 0 following and 0 following) from t2; diff --git a/mysql-test/mysql-test-run.pl b/mysql-test/mysql-test-run.pl index af908297d65..56e265d9eef 100755 --- a/mysql-test/mysql-test-run.pl +++ b/mysql-test/mysql-test-run.pl @@ -25,7 +25,7 @@ # Tool used for executing a suite of .test files # # See the "MySQL Test framework manual" for more information -# http://dev.mysql.com/doc/mysqltest/en/index.html +# https://mariadb.com/kb/en/library/mysqltest/ # # ############################################################################## @@ -102,6 +102,7 @@ use mtr_unique; use mtr_results; use IO::Socket::INET; use IO::Select; +use Time::HiRes qw(gettimeofday); require "mtr_process.pl"; require "mtr_io.pl"; @@ -1456,7 +1457,7 @@ sub command_line_setup { foreach my $fs (@tmpfs_locations) { - if ( -d $fs && ! -l $fs ) + if ( -d $fs && ! -l $fs && -w $fs ) { my $template= "var_${opt_build_thread}_XXXX"; $opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0); @@ -2292,6 +2293,10 @@ sub environment_setup { $ENV{'EXE_MYSQL'}= $exe_mysql; $ENV{'MYSQL_PLUGIN'}= $exe_mysql_plugin; $ENV{'MYSQL_EMBEDDED'}= $exe_mysql_embedded; + if(IS_WINDOWS) + { + $ENV{'MYSQL_INSTALL_DB_EXE'}= mtr_exe_exists("$bindir/sql$opt_vs_config/mysql_install_db"); + } my $client_config_exe= mtr_exe_maybe_exists( @@ -2891,15 +2896,44 @@ sub mysql_server_start($) { # Save this test case information, so next can examine it $mysqld->{'started_tinfo'}= $tinfo; } + + # If wsrep is on, we need to wait until the first + # server starts and bootstraps the cluster before + # starting other servers. The bootsrap server in the + # configuration should always be the first which has + # wsrep_on=ON + if (wsrep_on($mysqld) && wsrep_is_bootstrap_server($mysqld)) + { + mtr_verbose("Waiting for wsrep bootstrap server to start"); + if ($mysqld->{WAIT}->($mysqld)) + { + return 1; + } + } } sub mysql_server_wait { - my ($mysqld) = @_; + my ($mysqld, $tinfo) = @_; - return not sleep_until_file_created($mysqld->value('pid-file'), - $opt_start_timeout, - $mysqld->{'proc'}, - $warn_seconds); + if (!sleep_until_file_created($mysqld->value('pid-file'), + $opt_start_timeout, + $mysqld->{'proc'}, + $warn_seconds)) + { + $tinfo->{comment}= "Failed to start ".$mysqld->name() . "\n"; + return 1; + } + + if (wsrep_on($mysqld)) + { + mtr_verbose("Waiting for wsrep server " . $mysqld->name() . " to be ready"); + if (!wait_wsrep_ready($tinfo, $mysqld)) + { + return 1; + } + } + + return 0; } sub create_config_file_for_extern { @@ -3258,7 +3292,7 @@ sub mysql_install_db { # Remove anonymous users mtr_tofile($bootstrap_sql_file, - "DELETE FROM mysql.user where user= '';\n"); + "DELETE FROM mysql.global_priv where user= '';\n"); # Create mtr database mtr_tofile($bootstrap_sql_file, @@ -3281,6 +3315,7 @@ sub mysql_install_db { # Create directories mysql and test mkpath("$install_datadir/mysql"); + my $realtime= gettimeofday(); if ( My::SafeProcess->run ( name => "bootstrap", @@ -3298,6 +3333,10 @@ sub mysql_install_db { "Could not install system database from $bootstrap_sql_file\n" . "The $path_bootstrap_log file contains:\n$data\n"); } + else + { + mtr_verbose("Spent " . sprintf("%.3f", (gettimeofday() - $realtime)) . " seconds in bootstrap"); + } } @@ -4006,14 +4045,14 @@ sub run_testcase ($$) { } my $test= $tinfo->{suite}->start_test($tinfo); - # Set only when we have to keep waiting after expectedly died server - my $keep_waiting_proc = 0; + # Set to a list of processes we have to keep waiting (expectedly died servers) + my %keep_waiting_proc = (); my $print_timeout= start_timer($print_freq * 60); while (1) { my $proc; - if ($keep_waiting_proc) + if (%keep_waiting_proc) { # Any other process exited? $proc = My::SafeProcess->check_any(); @@ -4023,48 +4062,34 @@ sub run_testcase ($$) { } else { - $proc = $keep_waiting_proc; # Also check if timer has expired, if so cancel waiting if ( has_expired($test_timeout) ) { - $keep_waiting_proc = 0; + %keep_waiting_proc = (); } } } - if (! $keep_waiting_proc) + if (!%keep_waiting_proc && !$proc) { - if($test_timeout > $print_timeout) + if ($test_timeout > $print_timeout) { - $proc= My::SafeProcess->wait_any_timeout($print_timeout); - if ( $proc->{timeout} ) - { - #print out that the test is still on - mtr_print("Test still running: $tinfo->{name}"); - #reset the timer - $print_timeout= start_timer($print_freq * 60); - next; - } + $proc= My::SafeProcess->wait_any_timeout($print_timeout); + if ($proc->{timeout}) + { + #print out that the test is still on + mtr_print("Test still running: $tinfo->{name}"); + #reset the timer + $print_timeout= start_timer($print_freq * 60); + next; + } } else { - $proc= My::SafeProcess->wait_any_timeout($test_timeout); + $proc= My::SafeProcess->wait_any_timeout($test_timeout); } } - # Will be restored if we need to keep waiting - $keep_waiting_proc = 0; - - unless ( defined $proc ) - { - mtr_error("wait_any failed"); - } - mtr_verbose("Got $proc"); - - mark_time_used('test'); - # ---------------------------------------------------- - # Was it the test program that exited - # ---------------------------------------------------- - if ($proc eq $test) + if ($proc and $proc eq $test) # mysqltest itself exited { my $res= $test->exit_status(); @@ -4079,12 +4104,12 @@ sub run_testcase ($$) { if ( $res == 0 ) { - my $check_res; - if ( $opt_check_testcases and - $check_res= check_testcase($tinfo, "after")) - { - if ($check_res == 1) { - # Test case had sideeffects, not fatal error, just continue + my $check_res; + if ( $opt_check_testcases and + $check_res= check_testcase($tinfo, "after")) + { + if ($check_res == 1) { + # Test case had sideeffects, not fatal error, just continue if ($opt_warnings) { # Checking error logs for warnings, so need to stop server # gracefully so that memory leaks etc. can be properly detected. @@ -4095,93 +4120,110 @@ sub run_testcase ($$) { # test. } else { # Not checking warnings, so can do a hard shutdown. - stop_all_servers($opt_shutdown_timeout); + stop_all_servers($opt_shutdown_timeout); } - mtr_report("Resuming tests...\n"); - resfile_output($tinfo->{'check'}) if $opt_resfile; - } - else { - # Test case check failed fatally, probably a server crashed - report_failure_and_restart($tinfo); - return 1; - } - } - mtr_report_test_passed($tinfo); + mtr_report("Resuming tests...\n"); + resfile_output($tinfo->{'check'}) if $opt_resfile; + } + else { + # Test case check failed fatally, probably a server crashed + report_failure_and_restart($tinfo); + return 1; + } + } + mtr_report_test_passed($tinfo); } elsif ( $res == 62 ) { - # Testcase itself tell us to skip this one - $tinfo->{skip_detected_by_test}= 1; - # Try to get reason from test log file - find_testcase_skipped_reason($tinfo); - mtr_report_test_skipped($tinfo); - # Restart if skipped due to missing perl, it may have had side effects - if ( $tinfo->{'comment'} =~ /^perl not found/ ) - { - stop_all_servers($opt_shutdown_timeout); - } + # Testcase itself tell us to skip this one + $tinfo->{skip_detected_by_test}= 1; + # Try to get reason from test log file + find_testcase_skipped_reason($tinfo); + mtr_report_test_skipped($tinfo); + # Restart if skipped due to missing perl, it may have had side effects + if ( $tinfo->{'comment'} =~ /^perl not found/ ) + { + stop_all_servers($opt_shutdown_timeout); + } } elsif ( $res == 65 ) { - # Testprogram killed by signal - $tinfo->{comment}= - "testprogram crashed(returned code $res)"; - report_failure_and_restart($tinfo); + # Testprogram killed by signal + $tinfo->{comment}= + "testprogram crashed(returned code $res)"; + report_failure_and_restart($tinfo); } elsif ( $res == 1 ) { - # Check if the test tool requests that - # an analyze script should be run - my $analyze= find_analyze_request(); - if ($analyze){ - run_on_all($tinfo, "analyze-$analyze"); - } + # Check if the test tool requests that + # an analyze script should be run + my $analyze= find_analyze_request(); + if ($analyze){ + run_on_all($tinfo, "analyze-$analyze"); + } - # Wait a bit and see if a server died, if so report that instead - mtr_milli_sleep(100); - my $srvproc= My::SafeProcess::check_any(); - if ($srvproc && grep($srvproc eq $_, started(all_servers()))) { - $proc= $srvproc; - goto SRVDIED; - } + # Wait a bit and see if a server died, if so report that instead + mtr_milli_sleep(100); + my $srvproc= My::SafeProcess::check_any(); + if ($srvproc && grep($srvproc eq $_, started(all_servers()))) { + $proc= $srvproc; + goto SRVDIED; + } - # Test case failure reported by mysqltest - report_failure_and_restart($tinfo); + # Test case failure reported by mysqltest + report_failure_and_restart($tinfo); } else { - # mysqltest failed, probably crashed - $tinfo->{comment}= - "mysqltest failed with unexpected return code $res\n"; - report_failure_and_restart($tinfo); + # mysqltest failed, probably crashed + $tinfo->{comment}= + "mysqltest failed with unexpected return code $res\n"; + report_failure_and_restart($tinfo); } # Save info from this testcase run to mysqltest.log if( -f $path_current_testlog) { - if ($opt_resfile && $res && $res != 62) { - resfile_output_file($path_current_testlog); - } - mtr_appendfile_to_file($path_current_testlog, $path_testlog); - unlink($path_current_testlog); + if ($opt_resfile && $res && $res != 62) { + resfile_output_file($path_current_testlog); + } + mtr_appendfile_to_file($path_current_testlog, $path_testlog); + unlink($path_current_testlog); } return ($res == 62) ? 0 : $res; - } - # ---------------------------------------------------- - # Check if it was an expected crash - # ---------------------------------------------------- - my $check_crash = check_expected_crash_and_restart($proc); - if ($check_crash) + if ($proc) { - # Keep waiting if it returned 2, if 1 don't wait or stop waiting. - $keep_waiting_proc = 0 if $check_crash == 1; - $keep_waiting_proc = $proc if $check_crash == 2; - next; + # It was not mysqltest that exited, add to a wait-to-be-started-again list. + $keep_waiting_proc{$proc} = 1; } + mtr_verbose("Got " . join(",", keys(%keep_waiting_proc))); + + mark_time_used('test'); + foreach my $wait_for_proc (keys(%keep_waiting_proc)) { + # ---------------------------------------------------- + # Check if it was an expected crash + # ---------------------------------------------------- + my $check_crash = check_expected_crash_and_restart($wait_for_proc); + if ($check_crash == 0) # unexpected exit/crash of $wait_for_proc + { + goto SRVDIED; + } + elsif ($check_crash == 1) # $wait_for_proc was started again by check_expected_crash_and_restart() + { + delete $keep_waiting_proc{$wait_for_proc}; + } + elsif ($check_crash == 2) # we must keep waiting + { + # do nothing + } + } + + next; + SRVDIED: # ---------------------------------------------------- # Stop the test case timer @@ -5301,6 +5343,7 @@ sub server_need_restart { { delete $server->{'restart_opts'}; my $use_dynamic_option_switch= 0; + delete $server->{'restart_opts'}; if (!$use_dynamic_option_switch) { mtr_verbose_restart($server, "running with different options '" . @@ -5395,6 +5438,118 @@ sub stop_servers($$) { } } +# +# run_query_output +# +# Run a query against a server using mysql client. The output of +# the query will be written into outfile. +# +sub run_query_output { + my ($mysqld, $query, $outfile)= @_; + my $args; + + mtr_init_args(\$args); + mtr_add_arg($args, "--defaults-file=%s", $path_config_file); + mtr_add_arg($args, "--defaults-group-suffix=%s", $mysqld->after('mysqld')); + mtr_add_arg($args, "--silent"); + mtr_add_arg($args, "--execute=%s", $query); + + my $res= My::SafeProcess->run + ( + name => "run_query_output -> ".$mysqld->name(), + path => $exe_mysql, + args => \$args, + output => $outfile, + error => $outfile + ); + + return $res +} + + +# +# wsrep_wait_ready +# +# Wait until the server has been joined to the cluster and is +# ready for operation. +# +# RETURN +# 1 Server is ready +# 0 Server didn't transition to ready state within start timeout +# +sub wait_wsrep_ready($$) { + my ($tinfo, $mysqld)= @_; + + my $sleeptime= 100; # Milliseconds + my $loops= ($opt_start_timeout * 1000) / $sleeptime; + + my $name= $mysqld->name(); + my $outfile= "$opt_vardir/tmp/$name.wsrep_ready"; + my $query= "SET SESSION wsrep_sync_wait = 0; + SELECT VARIABLE_NAME, VARIABLE_VALUE + FROM INFORMATION_SCHEMA.GLOBAL_STATUS + WHERE VARIABLE_NAME = 'wsrep_ready'"; + + for (my $loop= 1; $loop <= $loops; $loop++) + { + # Careful... if MTR runs with option 'verbose' then the + # file contains also SafeProcess verbose output + if (run_query_output($mysqld, $query, $outfile) == 0 && + mtr_grab_file($outfile) =~ /WSREP_READY\s+ON/) + { + unlink($outfile); + return 1; + } + mtr_milli_sleep($sleeptime); + } + + $tinfo->{logfile}= "WSREP did not transition to state READY"; + return 0; +} + +# +# wsrep_is_bootstrap_server +# +# Check if the server is the first one to be started in the +# cluster. +# +# RETURN +# 1 The server is a bootstrap server +# 0 The server is not a bootstrap server +# +sub wsrep_is_bootstrap_server($) { + my $mysqld= shift; + + my $cluster_address= $mysqld->if_exist('wsrep-cluster-address') || + $mysqld->if_exist('wsrep_cluster_address'); + if (defined $cluster_address) + { + return $cluster_address eq "gcomm://" || $cluster_address eq "'gcomm://'"; + } + return 0; +} + +# +# wsrep_on +# +# Check if wsrep has been enabled for a server. +# +# RETURN +# 1 Wsrep has been enabled +# 0 Wsrep is not enabled +# +sub wsrep_on($) { + my $mysqld= shift; + #check if wsrep_on= is set in configuration + if ($mysqld->if_exist('wsrep-on')) { + my $on= "".$mysqld->value('wsrep-on'); + if ($on eq "1" || $on eq "ON") { + return 1; + } + } + return 0; +} + # # start_servers @@ -5414,8 +5569,7 @@ sub start_servers($) { for (all_servers()) { next unless $_->{WAIT} and started($_); - if ($_->{WAIT}->($_)) { - $tinfo->{comment}= "Failed to start ".$_->name() . "\n"; + if ($_->{WAIT}->($_, $tinfo)) { return 1; } } @@ -5692,7 +5846,7 @@ EOF mtr_tofile($gdb_init_file, join("\n", "set args @$$args $input", - split /;/, $opt_gdb + split /;/, $opt_gdb || "" )); } diff --git a/mysql-test/std_data/ca-cert-verify.pem b/mysql-test/std_data/ca-cert-verify.pem deleted file mode 100644 index 21d6264a0ad..00000000000 --- a/mysql-test/std_data/ca-cert-verify.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDWzCCAkOgAwIBAgIJAO/QdKLEDQdXMA0GCSqGSIb3DQEBCwUAMEQxCzAJBgNV -BAYTAklOMREwDwYDVQQIDAhLYXJuYXRrYTESMBAGA1UEBwwJQmFuZ2Fsb3JlMQ4w -DAYDVQQKDAVNeVNRTDAeFw0xNjAxMDUxMDA1MDhaFw0yNTExMTMxMDA1MDhaMEQx -CzAJBgNVBAYTAklOMREwDwYDVQQIDAhLYXJuYXRrYTESMBAGA1UEBwwJQmFuZ2Fs -b3JlMQ4wDAYDVQQKDAVNeVNRTDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC -ggEBAKdOCuS2CzfBTJ2x8SAzY0J7cYJfNJvMDF1cvANnhkIhtnkWt/HZ5DJ9NxeX -q5h7FJLAi4gddqdk/tvQJw0V6gZepJr/mKVnMPivF5+oHPc9ZJQMX6B3FBNwWylm -ACd5GKx8I/H/MXyuhQTcoV//Ab+2pI8RHeYbBsm3lHH+tX7bRU6mUFjneqMpiCkb -JHt6BWZiWR10O6pMuGQ9+dDdsLhEV1fj3CctEPwW6rs4IZzD8xl5n+8cy7qu6eYH -Wt/snwsTzkrufeMRqTtqelxON9eoQwYOR1oH3vNEVlcbuoJAvaWOqBROUBdf12SP -TYSdP9nlRh7lTKQOywN4kYt6LqUCAwEAAaNQME4wHQYDVR0OBBYEFJ4c9tKaUU0P -EjBq5G207jjXI7RAMB8GA1UdIwQYMBaAFJ4c9tKaUU0PEjBq5G207jjXI7RAMAwG -A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEBABRnUyj21oFi0SGJg/K5+8Lc -4n6OwVU/NgLOysIB0baIP/Rqeaze59xG/v9FPQgBlWcJK3RabOywx5bxAxdcus+1 -yp5j4h37Qq1/qkgqmevvdSAPa0OBQbLb+58/naV+ywUpCYZ6flLdCMH3fXuDSlSq -qrCznextjojtWbnzrBmCmJmXWGd2gSaJDvb90ZZp/Elt3vN1sgjW0M/JEkb4MJ1r -6nfD/FHr2lUwBHm2yk7Blovx7x4d/Ip3pglk63cNO/Rn0SBTdoVDS2LB9du3Phq2 -TZiL3NrRMGUNwmdaavyrJxaPq5D+Sfa4LYP3MMYD4KhLogNzIl299n5joyizlJw= ------END CERTIFICATE----- diff --git a/mysql-test/std_data/cacert.pem b/mysql-test/std_data/cacert.pem index cc5d9100e30..23dda2318e1 100644 --- a/mysql-test/std_data/cacert.pem +++ b/mysql-test/std_data/cacert.pem @@ -2,78 +2,78 @@ Certificate: Data: Version: 3 (0x2) Serial Number: - e5:b1:e3:71:e9:6f:a9:e1 + d0:4d:23:85:ee:59:b3:fa Signature Algorithm: sha256WithRSAEncryption Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB Validity - Not Before: Apr 25 20:52:21 2017 GMT - Not After : Apr 20 20:52:21 2037 GMT + Not Before: Jan 27 10:11:10 2019 GMT + Not After : Jan 22 10:11:10 2039 GMT Subject: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (2048 bit) Modulus: - 00:a0:ad:d5:b1:ec:45:6f:d6:33:fc:5a:03:29:14: - f1:8e:78:d5:27:53:79:e0:92:7c:10:3b:79:a0:d7: - b6:9d:a8:5c:4d:fa:68:11:b3:03:9e:ee:5e:20:79: - 23:d8:9c:49:34:9c:1d:c4:6e:53:1f:9a:92:1f:08: - c1:15:e2:ad:cf:59:cd:1e:55:84:79:f9:09:ca:36: - 8a:50:83:c6:38:48:c6:d3:fa:f6:f2:2a:4f:bd:5d: - 60:9d:eb:21:c4:8c:f2:dd:2d:49:10:63:46:47:de: - 2d:59:a0:4a:e0:58:e6:c0:ae:d8:d4:5e:9a:f8:f5: - 68:1d:ea:80:8a:d6:01:b0:d5:5f:30:4d:88:5a:c5: - 1f:81:92:c1:40:54:c8:bb:a6:a1:43:de:81:3c:4b: - 79:95:82:bb:52:da:a3:a4:a0:69:ff:7e:00:8c:86: - 85:ec:af:03:68:a8:83:48:a0:e4:1d:31:a9:5c:47: - 99:9d:3a:3f:b5:3e:12:7c:4d:47:15:72:f1:11:5c: - 4a:ef:08:1c:7b:8f:e6:03:06:07:4f:94:21:b0:5e: - 27:fa:93:8c:b4:cc:56:34:3b:6d:c4:4a:14:57:b2: - 21:1a:3e:2f:c5:9e:47:1a:59:05:22:0e:56:b1:a7: - e8:80:9b:82:c3:54:57:12:05:94:79:a2:03:d9:64: - 3c:63 + 00:e8:0e:a7:84:d3:75:30:06:30:b2:10:b9:d1:88: + 36:2b:5e:f8:c8:44:57:cb:67:72:ab:96:95:33:d5: + 88:d1:8f:23:50:98:ba:6d:20:00:80:bd:35:d5:c1: + bf:98:49:c4:0a:15:4a:34:a6:21:9b:2e:8c:15:09: + f0:63:81:02:c2:7c:e2:53:e0:f7:a1:1a:40:5e:8f: + 41:4a:4c:56:d4:20:f1:d5:a7:c1:53:2e:ff:7e:37: + 17:cc:7e:74:bd:e2:22:33:ce:8c:77:62:a4:c5:3f: + 44:35:7b:7e:b9:f5:7d:8c:7a:27:58:fd:2c:42:86: + 2e:e7:6b:01:99:7b:fe:7d:a7:a1:4f:3e:39:39:54: + 1f:61:de:74:66:d1:77:4f:43:1b:66:70:29:85:de: + fc:8f:8e:1b:7b:a2:66:48:26:7f:9b:a6:fd:4a:e4: + dc:eb:ed:bd:f8:e3:f1:57:98:13:6f:f1:a3:2a:e3: + 73:bd:8d:7c:6f:4b:59:35:bc:b5:42:3e:99:a7:13: + 8d:be:2e:5c:9a:c6:5b:ab:ae:bf:00:e9:c8:ee:05: + 22:8e:d5:67:1a:47:9a:6d:9c:f9:42:3e:15:34:f8: + 31:ec:b4:7e:d3:92:95:b0:b8:f9:66:f3:bd:1d:31: + 2c:b1:90:62:a1:f8:4e:a6:5d:26:22:f0:e1:fe:16: + 2b:69 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Subject Key Identifier: - 1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12 + CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93 X509v3 Authority Key Identifier: - keyid:1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12 + keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93 X509v3 Basic Constraints: CA:TRUE Signature Algorithm: sha256WithRSAEncryption - 0d:4b:21:52:fa:49:34:56:14:db:83:ae:1c:3d:a7:4d:3e:ea: - 55:7e:1a:37:7a:65:89:ee:19:05:94:9d:3a:ad:59:c4:38:16: - b2:bd:02:ee:5a:a6:7e:e2:b1:21:a3:ad:af:8c:ae:c3:30:71: - ad:d7:d2:24:0f:c4:d9:47:80:c5:95:05:1d:7c:8a:49:0a:7d: - 8b:61:ca:b5:68:3d:3e:4e:f1:c7:45:62:c8:cc:a9:2f:f3:12: - f1:3f:92:34:7f:07:ab:d3:ac:ab:af:2d:c9:69:63:8a:b2:e5: - 35:ea:7d:b8:17:38:72:82:5f:96:3d:dc:8d:e5:11:bb:ae:f3: - 02:2d:20:77:5c:64:59:18:a6:e7:fa:c7:89:e8:30:12:14:04: - 40:5b:e9:b1:8f:86:81:b9:0d:6c:b6:fc:98:f9:b7:52:ab:8f: - 7e:53:c8:a0:05:e4:cd:0d:6b:d2:74:9f:17:7a:a1:c3:76:5e: - f3:29:1c:c6:be:56:ab:02:f7:5d:e1:c9:21:27:6d:66:7a:41: - 29:49:a3:f8:f5:2a:e7:03:2a:7c:52:4b:f5:46:58:45:be:a4: - 4c:a0:65:37:1d:d8:ac:f8:1f:81:ca:9c:79:f0:ff:22:8c:1d: - ce:2b:d0:1e:ce:99:f2:db:fa:66:84:e6:86:6f:19:3b:10:f1: - 92:ac:57:b2 + df:fd:74:29:5b:5e:9a:8b:09:02:40:59:73:cb:71:47:3f:97: + 3d:a9:fd:c4:8c:01:29:c9:86:b8:71:55:ff:72:0e:50:dc:c8: + b5:e6:91:41:52:47:21:30:cc:4d:e7:3b:4b:db:55:ea:7d:46: + eb:53:e0:b7:1b:80:7c:b1:0c:d3:d1:bc:a0:73:ae:96:1f:fd: + 05:52:7e:54:d5:03:52:69:7b:34:5f:27:d7:98:da:98:76:73: + e6:bb:50:59:2a:94:90:67:03:1c:a4:76:2f:ee:ef:59:60:09: + 48:33:03:2b:52:ed:83:42:f8:71:19:7f:d8:be:40:ed:20:01: + 90:3c:7e:1c:8b:d2:9f:f3:2f:09:1f:50:c8:10:e1:8a:d9:a5: + 49:9c:0b:74:17:b9:2b:68:f6:1e:73:c2:73:10:38:b3:35:e2: + 87:91:1b:a1:d1:9b:81:9d:1b:32:cc:03:6e:4c:82:95:81:11: + 42:56:e2:16:2b:22:65:db:40:2c:ca:dc:03:f4:d5:07:cf:f5: + 13:b2:cf:51:5b:24:cd:c7:d1:9b:42:8e:f9:df:5d:1e:5a:09: + a3:4f:a9:0b:f4:21:c5:bb:ff:02:93:67:e8:2d:ee:ab:d9:59: + 76:03:2c:a1:bd:fb:dc:af:b6:82:94:71:85:53:a8:18:0d:3a: + 9e:42:eb:59 -----BEGIN CERTIFICATE----- -MIIDfzCCAmegAwIBAgIJAOWx43Hpb6nhMA0GCSqGSIb3DQEBCwUAMFYxDzANBgNV +MIIDfzCCAmegAwIBAgIJANBNI4XuWbP6MA0GCSqGSIb3DQEBCwUAMFYxDzANBgNV BAMMBmNhY2VydDELMAkGA1UEBhMCRkkxETAPBgNVBAgMCEhlbHNpbmtpMREwDwYD -VQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjAeFw0xNzA0MjUyMDUyMjFa -Fw0zNzA0MjAyMDUyMjFaMFYxDzANBgNVBAMMBmNhY2VydDELMAkGA1UEBhMCRkkx +VQQHDAhIZWxzaW5raTEQMA4GA1UECgwHTWFyaWFEQjAeFw0xOTAxMjcxMDExMTBa +Fw0zOTAxMjIxMDExMTBaMFYxDzANBgNVBAMMBmNhY2VydDELMAkGA1UEBhMCRkkx ETAPBgNVBAgMCEhlbHNpbmtpMREwDwYDVQQHDAhIZWxzaW5raTEQMA4GA1UECgwH -TWFyaWFEQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKCt1bHsRW/W -M/xaAykU8Y541SdTeeCSfBA7eaDXtp2oXE36aBGzA57uXiB5I9icSTScHcRuUx+a -kh8IwRXirc9ZzR5VhHn5Cco2ilCDxjhIxtP69vIqT71dYJ3rIcSM8t0tSRBjRkfe -LVmgSuBY5sCu2NRemvj1aB3qgIrWAbDVXzBNiFrFH4GSwUBUyLumoUPegTxLeZWC -u1Lao6Sgaf9+AIyGheyvA2iog0ig5B0xqVxHmZ06P7U+EnxNRxVy8RFcSu8IHHuP -5gMGB0+UIbBeJ/qTjLTMVjQ7bcRKFFeyIRo+L8WeRxpZBSIOVrGn6ICbgsNUVxIF -lHmiA9lkPGMCAwEAAaNQME4wHQYDVR0OBBYEFBzHK6obsbsumvQPsYZgVzjCQQUS -MB8GA1UdIwQYMBaAFBzHK6obsbsumvQPsYZgVzjCQQUSMAwGA1UdEwQFMAMBAf8w -DQYJKoZIhvcNAQELBQADggEBAA1LIVL6STRWFNuDrhw9p00+6lV+Gjd6ZYnuGQWU -nTqtWcQ4FrK9Au5apn7isSGjra+MrsMwca3X0iQPxNlHgMWVBR18ikkKfYthyrVo -PT5O8cdFYsjMqS/zEvE/kjR/B6vTrKuvLclpY4qy5TXqfbgXOHKCX5Y93I3lEbuu -8wItIHdcZFkYpuf6x4noMBIUBEBb6bGPhoG5DWy2/Jj5t1Krj35TyKAF5M0Na9J0 -nxd6ocN2XvMpHMa+VqsC913hySEnbWZ6QSlJo/j1KucDKnxSS/VGWEW+pEygZTcd -2Kz4H4HKnHnw/yKMHc4r0B7OmfLb+maE5oZvGTsQ8ZKsV7I= +TWFyaWFEQjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAOgOp4TTdTAG +MLIQudGINite+MhEV8tncquWlTPViNGPI1CYum0gAIC9NdXBv5hJxAoVSjSmIZsu +jBUJ8GOBAsJ84lPg96EaQF6PQUpMVtQg8dWnwVMu/343F8x+dL3iIjPOjHdipMU/ +RDV7frn1fYx6J1j9LEKGLudrAZl7/n2noU8+OTlUH2HedGbRd09DG2ZwKYXe/I+O +G3uiZkgmf5um/Urk3Ovtvfjj8VeYE2/xoyrjc72NfG9LWTW8tUI+macTjb4uXJrG +W6uuvwDpyO4FIo7VZxpHmm2c+UI+FTT4Mey0ftOSlbC4+WbzvR0xLLGQYqH4TqZd +JiLw4f4WK2kCAwEAAaNQME4wHQYDVR0OBBYEFMpxmYnwcqt1ZrtlagMEcqV7laaT +MB8GA1UdIwQYMBaAFMpxmYnwcqt1ZrtlagMEcqV7laaTMAwGA1UdEwQFMAMBAf8w +DQYJKoZIhvcNAQELBQADggEBAN/9dClbXpqLCQJAWXPLcUc/lz2p/cSMASnJhrhx +Vf9yDlDcyLXmkUFSRyEwzE3nO0vbVep9RutT4LcbgHyxDNPRvKBzrpYf/QVSflTV +A1JpezRfJ9eY2ph2c+a7UFkqlJBnAxykdi/u71lgCUgzAytS7YNC+HEZf9i+QO0g +AZA8fhyL0p/zLwkfUMgQ4YrZpUmcC3QXuSto9h5zwnMQOLM14oeRG6HRm4GdGzLM +A25MgpWBEUJW4hYrImXbQCzK3AP01QfP9ROyz1FbJM3H0ZtCjvnfXR5aCaNPqQv0 +IcW7/wKTZ+gt7qvZWXYDLKG9+9yvtoKUcYVTqBgNOp5C61k= -----END CERTIFICATE----- diff --git a/mysql-test/std_data/cakey.pem b/mysql-test/std_data/cakey.pem index 88e251f00e2..0e2f7dce244 100644 --- a/mysql-test/std_data/cakey.pem +++ b/mysql-test/std_data/cakey.pem @@ -1,28 +1,28 @@ -----BEGIN PRIVATE KEY----- -MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCgrdWx7EVv1jP8 -WgMpFPGOeNUnU3ngknwQO3mg17adqFxN+mgRswOe7l4geSPYnEk0nB3EblMfmpIf -CMEV4q3PWc0eVYR5+QnKNopQg8Y4SMbT+vbyKk+9XWCd6yHEjPLdLUkQY0ZH3i1Z -oErgWObArtjUXpr49Wgd6oCK1gGw1V8wTYhaxR+BksFAVMi7pqFD3oE8S3mVgrtS -2qOkoGn/fgCMhoXsrwNoqINIoOQdMalcR5mdOj+1PhJ8TUcVcvERXErvCBx7j+YD -BgdPlCGwXif6k4y0zFY0O23EShRXsiEaPi/FnkcaWQUiDlaxp+iAm4LDVFcSBZR5 -ogPZZDxjAgMBAAECggEAWmy6AGFpSmEP7IpzkOEaeAWEX5dY1YtaioAOGPiM6vje -yXuMqblG5mBbVIcYJ0T85cCd9/fmi7ifVxvEHh7tle2Bw/p4jXQbkFNVT655FR/P -1Wg9JVeufHFaeETlQgnYe6SKo9BaswNUHkZZHRyq7/D2Ub3UFRt2tq9MG9YIKY1m -rP9s7E+EDuH9UhYmaWdQfNm8muIXWK8WjicI5+PX0CQ1NtUy6vS7qBzcBzvT0chC -Jtja29S6Nvg12A96nHsRmQyUaQjRlqosSwiagpc5mZmNeCEUoY+3deIdYIUMSQnf -judZOKVPq0GOW5Y1U068LGODWaifPkinGBj+04VH0QKBgQDOp/jVCOUdEeqFJ/8m -wEsfsRIrXvtGJHgbDXcVJ69FwlX+yaKGEuC+4f21uyxPn6GoFw+NKAyTmGKH7VAX -OFQLrMQ/DMlNbZrCAAFcXMqrnLaVwqMeIIoVNfKAa8u15K40qc+B0it61Nlay5wq -wvXoSZrdqXSgsI29pav20+8pTQKBgQDHC3l1+gMZ1rCar+5KdVBN1Wq4Xh7cwZw6 -FxEvyrDCJePEU2L7FpH1pFuB4WpXdBu3CPo70ZgwfqBXn4qLOOI3gTtDHActyiUm -+WRG62O+5Ye7aLB4xy0MfnKNA2g/yHj1ozwM8kA5JRptAzDnzWfVE0k47/pVAVzt -E2bZuSykbwKBgQCL6SkMgjMr1T9j20phn/q8gBN/DZUtTe+K0Tj4N5/wqLuz/its -fkdutG4ipZBAcCDwPnym4qBxJNBAmqiIr/gm11ceILgBFd2azoodUC1etoDfL6Fj -+j/CUH3X+CM5CJPwz67Pg80wIf7t+7/FK611ELAqtllhmWa9KPcd6yqWWQKBgHh5 -Xnvk5kmWY3BNOgrBNOjXWu/asA1n9lpGqfVmVlQ8wL6MxiU5xQCMCYL0X/ws37WK -boMUWmxHyF8gxqd7t5hm1OrKpSG274PGgUZXpRjfLqdlNyLzUzXztvvY6xloCqaK -tYcUfYDZD0SaINi8v7L9KF2ZCsi2uXsZOjBf30BrAoGAXPPotkw/CkcPQBS13cha -ZWeeH5NDKBADWXfLfcRUs108c9xw4BYr5yGilSPscN2ZP0/iWONKp/c6/STS54t5 -lkOKKUbkAFbQu8UKa1J7zrnHZv+Mr4I/iBBy6VkN8Spp2vBI3Ng6jhPIJg3Gum9p -943wWtAnIhe/UqCRT3a/GZg= +MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDoDqeE03UwBjCy +ELnRiDYrXvjIRFfLZ3KrlpUz1YjRjyNQmLptIACAvTXVwb+YScQKFUo0piGbLowV +CfBjgQLCfOJT4PehGkBej0FKTFbUIPHVp8FTLv9+NxfMfnS94iIzzox3YqTFP0Q1 +e3659X2MeidY/SxChi7nawGZe/59p6FPPjk5VB9h3nRm0XdPQxtmcCmF3vyPjht7 +omZIJn+bpv1K5Nzr7b344/FXmBNv8aMq43O9jXxvS1k1vLVCPpmnE42+Llyaxlur +rr8A6cjuBSKO1WcaR5ptnPlCPhU0+DHstH7TkpWwuPlm870dMSyxkGKh+E6mXSYi +8OH+FitpAgMBAAECggEBAMSw7yKxjSnIhWvYq3fDiY6XcC1naDb7FwIDn7GQs+hT +9+3vlky6jFKSjdgB4iD1nVmilAQuMFv1Rzzp8LyWdD1fVwMbsyj1NEwyBngwXoRs +7C5Zg467Tkmv7tcg9FiiHLVmxD7I+LpLlsfyRgbe4qy4OTO/W82DKKx0UaXDqIDd +gIiBM5Vj9s1Lzoi7r2lXtuuEeRCH0mf9sAygqAkmj50i0vI05kQtIzJluU8KufPy +DbQryaz5CWvXr4wdN3KbrVw5yRk9wz8JsIW1CRQshmVb5hZ+sS97eO11WKumen0I +wXP8Z3s6NhTaeJvW/AsPZ2xm/vM/rLo1634tUZzzQ4UCgYEA+zIJ/TQ7Rfot30lu +oz3d8moXW6B5iDUYQ6VuFY/0qImlFkR91BPp/XtZ0FyiVHEvF8hUQQc6jzCQylot +QHOuW/hRWxFrVZndVhhgtAd4tFd39yOa8pkFifj8Wkdq6q0KuA+/qtCnVDwEEe+n +U4xZXJmZ8schLRy9A5Js9NNckhcCgYEA7H7oCVBhNQRfcylBs5Y41qmIvokpU76B +u6Pk7OwhVoe9aO41VXXjPwLJaPw7U2270CEuKB0YhVY1cpqFZdkuUsfwYh6ju6xY +AIzeZuGw7LAXM+DabHnc6NKKAG6b9uBEh3f+N93NnLM8yPJheCbRGcC67gbEIB+Q +7Z3TX8QtHn8CgYEAqSv9EDriBHHF/Q/uZCAhXsZWbs33q2Ter4g1SG5H/k2dEg8U +kwTKXH17cllAtg/4AFNZcuYUaSTzDmSG/1YpQiVNXUCxAdh6+SW30ucJQqN51sZy +7xlhYpd+FKrudZgOlQF+OuMFHjTBJPc6wIjQEg4cYSX80O3+2e3+VTAXswcCgYEA +hfur58LzH383uF2yTFUaJHtt7kx07m3qv+ytgJCSnpxOcckqzBz6vrMMen8T+UMc ++WAi7zT0tG3P3/qtArOVK+78QAqNxoBwZvdn9K9+dcmZi5mjBXvQ7NKCvpXrpGUQ +ThNsIih2GYXuNQYktFaBdm6bOMj6ihx4FjapDwNscG8CgYAnGxSNAgAsoMzfhSbp +fYQYqGlufvTHknavHW1tQagxFdew9tsYYA9XQJtwB4pnYZ6vEGOnp74g4Y6i2VPx +1T4T5ctDX0oydWe1lNZR8iszU9Fes9YnWviS2KWE0s3NDii/3UDUDqc4ZmgRUOIs +gcAXPXgP9Kgz6kRH/9VkzAFfkQ== -----END PRIVATE KEY----- diff --git a/mysql-test/std_data/client-cert.crl b/mysql-test/std_data/client-cert.crl new file mode 100644 index 00000000000..1f737bf790b --- /dev/null +++ b/mysql-test/std_data/client-cert.crl @@ -0,0 +1,12 @@ +-----BEGIN X509 CRL----- +MIIBxTCBrgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNlcnQxCzAJ +BgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kx +EDAOBgNVBAoMB01hcmlhREIXDTE5MDEyNzEwMTExNVoXDTM5MDEyMjEwMTExNVow +FDASAgEFFw0xOTAxMjcxMDExMTVaoA4wDDAKBgNVHRQEAwIBAjANBgkqhkiG9w0B +AQsFAAOCAQEAI0yg8tW6n8m/3g4FO5fjrtwEB1HYnJVLbKT2fOSKs7WN/t6M4ZWo +hSolEpNozd0yP+20srCMzsg7PuiYV/jMJn0bCw+Q6G7IP2GBlBURRErJ6UNZ+Upe +Gc+o5tWvb7ROwMj76UBzK5tDsmDapk5102k0sfaIbD51OmA+RxnxbKsGNvAVp9EH +yN+irF6vfVmbP1WPzGZa6x2s70kiC3peQlnZFOUnhycwVdiRprcUd+ZfMLJ3Ov2b +oa9P+ntTW/0ijg0QYH6gSQVOl9ZiVhnRR/eO6SrkrevgtAM3pXl4aDdvFyoIXXkh +mCkYfW7LkH/+OYWyZ1W99cnISM2F+yC1yQ== +-----END X509 CRL----- diff --git a/mysql-test/std_data/client-cert.pem b/mysql-test/std_data/client-cert.pem index 9f6f0cfde7c..dbd94f57702 100644 --- a/mysql-test/std_data/client-cert.pem +++ b/mysql-test/std_data/client-cert.pem @@ -1,26 +1,35 @@ Certificate: Data: Version: 3 (0x2) - Serial Number: 3 (0x3) + Serial Number: 5 (0x5) Signature Algorithm: sha256WithRSAEncryption Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB Validity - Not Before: Apr 25 20:52:33 2017 GMT - Not After : Apr 20 20:52:33 2037 GMT + Not Before: Jan 27 10:11:15 2019 GMT + Not After : Jan 22 10:11:15 2039 GMT Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=client Subject Public Key Info: Public Key Algorithm: rsaEncryption - Public-Key: (1024 bit) + Public-Key: (2048 bit) Modulus: - 00:a1:10:ea:cc:8e:2c:73:6b:33:1a:5e:26:19:b6: - 4b:4c:bc:04:b8:c2:e2:33:eb:67:a2:7a:27:af:3f: - f7:ef:49:5f:c1:d2:b9:d9:71:fe:17:a0:93:da:dc: - f1:47:de:fa:1f:c3:c1:d1:a5:2a:06:cb:b3:e8:9a: - c1:bd:78:77:68:45:c1:55:cd:b1:c1:d3:df:8c:12: - 4f:c2:3a:0d:b7:58:dc:ca:13:08:b9:fb:12:24:90: - aa:b7:4e:04:eb:43:0d:45:be:1c:17:d6:a8:b1:af: - 10:3c:39:d6:08:45:ed:a9:7e:3a:69:ae:70:22:86: - 7e:71:1f:f1:0e:d0:0d:32:c3 + 00:a9:10:77:b5:42:8f:e8:ad:69:2a:03:e9:56:f5: + 2d:d5:ba:92:06:cc:7f:c8:d2:0f:c5:47:fd:3e:db: + e1:5b:2b:40:ca:f8:05:9c:12:55:ef:0c:4a:92:3d: + 01:ac:0a:21:72:c4:b4:d9:59:82:75:1d:0c:63:fe: + 5a:20:7f:c5:53:b2:b9:05:88:60:c7:d9:fd:0f:ce: + 8f:10:a3:23:74:8f:21:70:56:73:c2:07:f0:79:20: + 52:1d:e0:30:9d:ed:0d:5a:f2:68:1b:0c:9e:2d:62: + d6:5c:e3:72:2d:92:79:aa:d0:f0:3a:ed:d6:52:30: + 3a:e7:91:5e:98:4e:2f:a0:07:d7:73:78:42:02:7d: + c4:2c:d3:63:03:b7:72:a5:33:da:f7:e9:3f:93:c9: + 37:19:9f:33:62:4f:1a:03:c3:a6:4b:f4:f5:51:e4: + ef:af:d6:a7:9a:55:5f:bc:d3:a9:77:90:59:8c:29: + b5:2d:3d:ef:ba:cd:21:54:24:79:6e:91:be:08:b6: + b1:9c:78:be:6d:2f:56:72:10:69:91:ee:b3:bd:eb: + 77:b3:c1:bf:c7:28:c6:ad:70:37:68:da:42:8a:7f: + dc:3b:40:78:d5:f2:a5:c1:43:c3:61:8e:bb:d0:b8: + 2d:05:41:7e:f2:b2:49:86:8b:ad:d7:fb:e0:9b:48: + 7d:af Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -28,42 +37,45 @@ Certificate: Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: - 0C:20:76:A1:80:9C:2F:30:3D:F7:AB:8D:31:19:AD:E2:F7:E2:8D:12 + CE:F4:DF:1F:F9:52:2E:37:2D:3D:8A:B6:DE:41:8C:13:F6:14:4E:57 X509v3 Authority Key Identifier: - keyid:1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12 + keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93 Signature Algorithm: sha256WithRSAEncryption - 39:c0:90:13:19:85:47:9d:c6:ab:8c:c6:c9:0f:33:11:19:f7: - 01:2c:1b:08:f6:81:98:11:ab:48:05:d9:b2:29:56:32:9c:ba: - e5:40:df:85:5e:6d:fd:6e:36:9a:14:eb:90:50:57:de:2f:ed: - 2d:89:a6:8a:40:1c:41:84:9b:da:e1:6d:e6:7c:46:b2:e0:90: - 93:02:1c:52:2e:af:b4:d4:a1:d8:9d:19:cf:0a:67:bf:c3:3e: - 2e:02:f4:3e:bc:2e:59:57:30:85:8a:32:ab:22:88:72:37:6e: - ee:ed:f8:53:72:c9:28:87:50:47:81:1b:80:4c:f8:80:ce:2f: - 47:ca:78:ce:38:51:70:ec:df:ee:fc:ea:5a:40:1e:4d:1c:fd: - 4e:f6:74:d0:22:a4:7e:57:df:16:1a:a0:8d:be:fe:ee:f2:07: - 2e:39:a1:97:40:19:f9:3b:b8:e7:c4:98:6e:1d:1a:27:d3:19: - 4c:5c:c9:c3:31:98:c1:3c:27:0e:6a:de:cf:88:72:cf:e4:65: - c9:0d:33:32:f1:ea:f7:dd:5b:9d:42:6d:ee:c7:a8:b7:85:d2: - 41:e0:84:38:ce:86:81:ba:6e:7d:d5:ad:7a:00:58:d7:c5:83: - 9e:5c:1d:38:32:72:49:f5:42:4b:e7:c6:5c:12:6d:e1:5d:51: - 2c:f5:52:f0 + 65:61:98:4c:62:3c:25:3b:12:2b:4d:78:9a:81:20:e2:4d:1e: + 1e:c3:78:ca:1b:5b:84:13:7b:11:da:f3:ad:d0:19:f0:02:0c: + 99:44:d8:52:89:e5:ee:61:9d:8e:ac:30:7a:dc:fc:7e:73:e3: + 28:39:25:00:78:f2:00:66:63:96:3a:10:af:2b:35:b5:3e:09: + 87:99:97:dd:29:0b:23:eb:95:fe:a8:f4:f5:4f:db:dd:ac:96: + 94:7b:b1:ef:47:15:54:6f:d8:1b:43:39:00:34:9f:ad:49:fb: + 21:26:94:74:20:61:ce:c5:b3:3d:5f:51:46:58:56:dc:2c:8c: + c3:74:97:83:63:3d:ad:0b:f6:81:63:4d:cb:30:af:45:ce:28: + fe:e0:68:c4:8f:1a:61:80:7e:56:8d:fc:31:5a:9f:33:37:1f: + ae:4e:0d:6c:25:e3:0e:13:af:01:1b:82:41:95:a1:83:47:61: + 40:dd:d4:36:fb:73:7a:98:61:d1:e2:5f:1e:a1:a1:a8:ea:e3: + 30:c8:74:c2:d2:82:6d:30:e5:e8:8f:b0:2d:1a:93:8e:ab:6b: + a6:17:36:a3:a2:0c:86:9c:b2:4e:1f:d7:6f:ef:04:f9:05:20: + b7:4f:e5:e3:9b:58:38:06:aa:d3:64:15:9a:bf:8a:97:fd:39: + b7:5f:e2:9e -----BEGIN CERTIFICATE----- -MIIDHjCCAgagAwIBAgIBAzANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl +MIIDojCCAoqgAwIBAgIBBTANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs -c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTcwNDI1MjA1MjMzWhcNMzcwNDIw -MjA1MjMzWjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV +c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTE1WhcNMzkwMTIy +MTAxMTE1WjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMQ8wDQYDVQQDDAZjbGllbnQw -gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKEQ6syOLHNrMxpeJhm2S0y8BLjC -4jPrZ6J6J68/9+9JX8HSudlx/hegk9rc8Ufe+h/DwdGlKgbLs+iawb14d2hFwVXN -scHT34wST8I6DbdY3MoTCLn7EiSQqrdOBOtDDUW+HBfWqLGvEDw51ghF7al+Ommu -cCKGfnEf8Q7QDTLDAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8W -HU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBQMIHahgJwv -MD33q40xGa3i9+KNEjAfBgNVHSMEGDAWgBQcxyuqG7G7Lpr0D7GGYFc4wkEFEjAN -BgkqhkiG9w0BAQsFAAOCAQEAOcCQExmFR53Gq4zGyQ8zERn3ASwbCPaBmBGrSAXZ -silWMpy65UDfhV5t/W42mhTrkFBX3i/tLYmmikAcQYSb2uFt5nxGsuCQkwIcUi6v -tNSh2J0Zzwpnv8M+LgL0PrwuWVcwhYoyqyKIcjdu7u34U3LJKIdQR4EbgEz4gM4v -R8p4zjhRcOzf7vzqWkAeTRz9TvZ00CKkflffFhqgjb7+7vIHLjmhl0AZ+Tu458SY -bh0aJ9MZTFzJwzGYwTwnDmrez4hyz+RlyQ0zMvHq991bnUJt7seot4XSQeCEOM6G -gbpufdWtegBY18WDnlwdODJySfVCS+fGXBJt4V1RLPVS8A== +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpEHe1Qo/orWkqA+lW9S3V +upIGzH/I0g/FR/0+2+FbK0DK+AWcElXvDEqSPQGsCiFyxLTZWYJ1HQxj/logf8VT +srkFiGDH2f0Pzo8QoyN0jyFwVnPCB/B5IFId4DCd7Q1a8mgbDJ4tYtZc43Itknmq +0PA67dZSMDrnkV6YTi+gB9dzeEICfcQs02MDt3KlM9r36T+TyTcZnzNiTxoDw6ZL +9PVR5O+v1qeaVV+806l3kFmMKbUtPe+6zSFUJHlukb4ItrGceL5tL1ZyEGmR7rO9 +63ezwb/HKMatcDdo2kKKf9w7QHjV8qXBQ8NhjrvQuC0FQX7yskmGi63X++CbSH2v +AgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2Vu +ZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTO9N8f+VIuNy09irbeQYwT9hRO +VzAfBgNVHSMEGDAWgBTKcZmJ8HKrdWa7ZWoDBHKle5WmkzANBgkqhkiG9w0BAQsF +AAOCAQEAZWGYTGI8JTsSK014moEg4k0eHsN4yhtbhBN7EdrzrdAZ8AIMmUTYUonl +7mGdjqwwetz8fnPjKDklAHjyAGZjljoQrys1tT4Jh5mX3SkLI+uV/qj09U/b3ayW +lHux70cVVG/YG0M5ADSfrUn7ISaUdCBhzsWzPV9RRlhW3CyMw3SXg2M9rQv2gWNN +yzCvRc4o/uBoxI8aYYB+Vo38MVqfMzcfrk4NbCXjDhOvARuCQZWhg0dhQN3UNvtz +ephh0eJfHqGhqOrjMMh0wtKCbTDl6I+wLRqTjqtrphc2o6IMhpyyTh/Xb+8E+QUg +t0/l45tYOAaq02QVmr+Kl/05t1/ing== -----END CERTIFICATE----- diff --git a/mysql-test/std_data/client-key.pem b/mysql-test/std_data/client-key.pem index b6b5507cd15..726cb5f5132 100644 --- a/mysql-test/std_data/client-key.pem +++ b/mysql-test/std_data/client-key.pem @@ -1,15 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQChEOrMjixzazMaXiYZtktMvAS4wuIz62eieievP/fvSV/B0rnZ -cf4XoJPa3PFH3vofw8HRpSoGy7PomsG9eHdoRcFVzbHB09+MEk/COg23WNzKEwi5 -+xIkkKq3TgTrQw1FvhwX1qixrxA8OdYIRe2pfjpprnAihn5xH/EO0A0ywwIDAQAB -AoGAaJMqT+vTcpDcmjcct78DPuwoiKmH4rvqCrUTRRbcbJGQSbD/F+6KUl7hAM5J -Hifo8GzST8LT+ZuS0OiB9/naVGJjcLzpV+us+keMctB/cjmsPAAsRdeA8Xk0jTWv -v+5a5ZWSSbRXycuUtywtoESY1RLEyB0k3Dcxvk6SD3LnNMkCQQDTyDJfP+eirhgC -mKiNvHJjLtlRT11IMLMVTELEntsyKqzVgficZCWGkFRoF9iEO1OyCJaug7RZsuxs -Z3lk/gq1AkEAwrHwzVPU+dTqsZ8tYHlq+d0xy+6eTtYy7e/5qH3AUz10us6BG/LY -XVTwRFAOKQOciKZ/zPQa4oYeAc0oozSalwJBAIuMbyS0Rz262bdcQDSk5/rS8//P -+/eFn3t5NMW6p1T3KcvGSLtEgjWZBQVSMSlwrkWxwxhbUIuKip8jz6nse8ECQDgm -g5FkLRdEfc9uXfLl8aFQVu0+y29nPVb8D9+1LMOVBNZfekLqPdZlCcpZ4EuZ3ApZ -IqCkgiB0l7DjT2YKZM8CQQCp8z1JvoNRwhIuojh7JajY5QBkXtvHootXr+vDUHNf -SgR5BRmqZb0F5/BK4/7JbumiHI11QUULxhOnNtlS7DDt +MIIEpQIBAAKCAQEAqRB3tUKP6K1pKgPpVvUt1bqSBsx/yNIPxUf9PtvhWytAyvgF +nBJV7wxKkj0BrAohcsS02VmCdR0MY/5aIH/FU7K5BYhgx9n9D86PEKMjdI8hcFZz +wgfweSBSHeAwne0NWvJoGwyeLWLWXONyLZJ5qtDwOu3WUjA655FemE4voAfXc3hC +An3ELNNjA7dypTPa9+k/k8k3GZ8zYk8aA8OmS/T1UeTvr9anmlVfvNOpd5BZjCm1 +LT3vus0hVCR5bpG+CLaxnHi+bS9WchBpke6zvet3s8G/xyjGrXA3aNpCin/cO0B4 +1fKlwUPDYY670LgtBUF+8rJJhout1/vgm0h9rwIDAQABAoIBAQCAMnODZ+C13+DR +sjua67mAysN2ElWHUvoQb2Ex7At7VVYBUob2bNTqulhFgasl6FyqqUw1T/Fjms5N +eI6g/CIGMIyqDFrO0JZbCRdk1z/IX8xMYdHPPLP1NTPvYZOb/SfWYd/dOvkqkzrX +HsTyl5JYm6y+EqEkm1vfQlUHiqoEXxG7hkYSIU6uXmRgeHHfw0Nuy/DizQFVZTAi +yPoYQlMm13S1oIhr1cQRAHS41aWGl4dmprbS0Drqqr8kl2xrFEgZ/YLcwYKjAMzi +UbkgOBU11DuLd0E+J/9iUhK5YTsMxo1TO89p7yNLHvT4NBhV3cuicq9aaWYeSijf +VhDo+k4hAoGBAN1jlrElHmJcxI6JpA7BfX2BI5XTiQrq07jNkNMD1IlUe3zAnnq0 +DbwtXWYcolapYA9SbsXgHoEDhBjFJsz8fjqX/RKpBy0XZQuWImP0sYBficyWkKSQ +yO0I9RNq6zERKSCP/wJMBGuRAVjlgrY6mBNVr2NmyqvVLzNNNUeCTcC/AoGBAMN+ +vrALUkMrJ8Oh5ay4IW+5toOu6/4TUyOK7zN23jGaObbPy/tLcgvpZ1xQsvuhvesG +ubIr98st7J9+V/+mGMrvf5s4TlHUtB26E56wZrque98tBe8IG7Wh5dYut9PLw31K +npT9fAYy8nsY2c7g5cs/vfJ+ixFj5ytsiYgjjI8RAoGBAMz32xh/CTaANOrSvDV9 +JrX/zfZ1NrgI2aSLjb4QGcJbmUjS/OcVtHG4fnR/pj0d63XEGBLTgOppWu+j+Fxo +mGWfOgsAu0ggFMk5YvWwInZ7/ZSRAbGa6quqU1x67O0suisPpkV2I9GDGwA23WHh +tdKQziT1kkasxVp17RIbrej5AoGAHMki5uUj3cQS/Nlv6jjKo5ri5wzwrt7FlSw2 +AIv2N7OP3/1E+eGoD1z03UD8udSdFGhPG48h04cVmn6OEpSwfeE6Fu75iU8anm3x +yaIL3l0m3DvS7dlxyxLltt32L3eHd4FvTFzu0DLcRYfpOm8fJwhhvb0oWQ0u0tQO +hD9HySECgYEAnLQnpkmFfr+1Gfg19N28Pvgh9NJMxvt4zVP+MZ8xR8gI+peqjZLp +KDGtIlQ7bPnjMopeWojf7mOnlsvR4mChXJ6Uw1XGZjgMQnQtOrrHSuzdoWDJDteu +8ftYoxWkqclzIrytpsOxon/Epq9i/D019V3+p+IhJ7NKiwqh0Ui66co= -----END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/crl-ca-cert.pem b/mysql-test/std_data/crl-ca-cert.pem deleted file mode 100644 index abe7bc469fc..00000000000 --- a/mysql-test/std_data/crl-ca-cert.pem +++ /dev/null @@ -1,63 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: - a5:85:ec:60:b1:68:44:22 - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=BG, ST=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test CA certificate - Validity - Not Before: Jun 17 07:27:51 2011 GMT - Not After : Jun 15 07:27:51 2016 GMT - Subject: C=BG, ST=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test CA certificate - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:9b:08:0b:96:19:57:fb:21:79:f4:16:c9:b8:2c: - 13:2e:e1:fe:5f:6b:18:7d:d4:c4:d7:cd:66:a6:62: - 0e:b7:28:b1:39:76:62:6e:5a:4a:80:f6:0e:8e:84: - 3e:cf:2f:91:0d:36:6d:8b:b5:f9:78:96:f0:5f:82: - a2:b2:d8:fc:b3:46:b5:30:24:b3:a8:77:60:6c:05: - c9:8f:82:fd:ad:9f:26:23:29:56:5b:02:6f:f2:00: - 31:86:60:b7:8c:56:b3:95:a8:8d:a9:bb:6b:91:fd: - 5d:f5:6a:21:45:85:63:78:0e:0f:0e:03:6d:53:73: - 0d:6c:aa:5b:f9:fc:fa:fd:f7 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Subject Key Identifier: - C4:1D:2C:68:3F:5F:29:51:EC:C5:54:61:CE:16:13:D2:72:5D:63:E8 - X509v3 Authority Key Identifier: - keyid:C4:1D:2C:68:3F:5F:29:51:EC:C5:54:61:CE:16:13:D2:72:5D:63:E8 - DirName:/C=BG/ST=Plovdiv/O=Oracle/OU=MySQL/CN=MySQL CRL test CA certificate - serial:A5:85:EC:60:B1:68:44:22 - - X509v3 Basic Constraints: - CA:TRUE - Signature Algorithm: sha1WithRSAEncryption - 73:dd:2e:76:71:25:c2:fe:7a:c5:46:ca:f2:c7:a0:43:f0:c7: - 3c:24:8d:a6:bd:8d:f2:7c:db:03:1b:2b:8a:c8:23:ae:ef:71: - 25:33:5b:10:61:e7:7d:89:30:a8:67:25:2e:e0:06:30:77:da: - b8:87:e5:91:cd:c7:8f:c9:7b:3d:9e:86:80:44:02:6b:d1:06: - 85:5d:28:78:cc:a7:a8:35:ac:f7:77:6d:e2:c7:a3:37:bc:9f: - d3:bf:4a:ca:09:dc:d0:78:0c:59:c7:db:4b:67:f1:09:6d:a9: - 7a:50:2f:1d:2c:a6:b8:81:0e:e6:4b:ee:d9:be:ae:a5:6a:d7: - 56:c4 ------BEGIN CERTIFICATE----- -MIIDHDCCAoWgAwIBAgIJAKWF7GCxaEQiMA0GCSqGSIb3DQEBBQUAMGgxCzAJBgNV -BAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAMBgNV -BAsTBU15U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZpY2F0 -ZTAeFw0xMTA2MTcwNzI3NTFaFw0xNjA2MTUwNzI3NTFaMGgxCzAJBgNVBAYTAkJH -MRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAMBgNVBAsTBU15 -U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZpY2F0ZTCBnzAN -BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAmwgLlhlX+yF59BbJuCwTLuH+X2sYfdTE -181mpmIOtyixOXZiblpKgPYOjoQ+zy+RDTZti7X5eJbwX4Kistj8s0a1MCSzqHdg -bAXJj4L9rZ8mIylWWwJv8gAxhmC3jFazlaiNqbtrkf1d9WohRYVjeA4PDgNtU3MN -bKpb+fz6/fcCAwEAAaOBzTCByjAdBgNVHQ4EFgQUxB0saD9fKVHsxVRhzhYT0nJd -Y+gwgZoGA1UdIwSBkjCBj4AUxB0saD9fKVHsxVRhzhYT0nJdY+ihbKRqMGgxCzAJ -BgNVBAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAM -BgNVBAsTBU15U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZp -Y2F0ZYIJAKWF7GCxaEQiMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEA -c90udnElwv56xUbK8segQ/DHPCSNpr2N8nzbAxsrisgjru9xJTNbEGHnfYkwqGcl -LuAGMHfauIflkc3Hj8l7PZ6GgEQCa9EGhV0oeMynqDWs93dt4sejN7yf079Kygnc -0HgMWcfbS2fxCW2pelAvHSymuIEO5kvu2b6upWrXVsQ= ------END CERTIFICATE----- diff --git a/mysql-test/std_data/crl-client-cert.pem b/mysql-test/std_data/crl-client-cert.pem deleted file mode 100644 index 260e8bf4647..00000000000 --- a/mysql-test/std_data/crl-client-cert.pem +++ /dev/null @@ -1,62 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: - a5:85:ec:60:b1:68:44:24 - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=BG, ST=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test CA certificate - Validity - Not Before: Jun 17 07:32:32 2011 GMT - Not After : Jun 16 07:32:32 2014 GMT - Subject: C=BG, ST=Plovdiv, L=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test client certificate - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:bd:18:bf:c5:37:7e:f7:8a:1d:22:c0:4f:5a:70: - 51:ea:df:56:4f:29:e9:c7:a5:8a:ab:5a:48:b5:f9: - bf:cd:2a:73:f8:fa:13:20:fd:33:17:11:93:51:f0: - 4f:fa:a5:6a:bc:37:94:92:de:7d:c1:09:c6:43:c0: - f7:cd:dd:ac:06:bf:fe:0c:9f:fc:ec:5b:83:a1:1e: - 34:d8:af:50:17:4d:84:51:20:44:76:81:d1:12:76: - 06:fb:05:29:59:47:0f:9d:97:f1:41:2f:92:0d:e4: - b6:c1:fb:cf:75:95:a9:0f:cf:b3:4f:69:a3:d1:14: - e9:6b:cf:be:53:bd:4e:3f:5d - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 39:37:9C:0B:9F:E4:8E:48:48:71:23:2B:CA:F0:C1:F9:0B:F2:0A:D0 - X509v3 Authority Key Identifier: - keyid:C4:1D:2C:68:3F:5F:29:51:EC:C5:54:61:CE:16:13:D2:72:5D:63:E8 - - Signature Algorithm: sha1WithRSAEncryption - 18:03:42:13:af:86:c3:eb:9c:40:4a:d8:9e:e7:25:e1:43:7b: - 2f:55:1b:e6:ec:bf:9b:56:b3:c7:cb:78:cd:d2:00:46:39:96: - d8:f8:cd:9d:0e:e7:97:51:93:f8:5b:ed:4f:5a:16:6b:56:fb: - c0:d1:58:3c:7f:e9:64:aa:11:03:ff:3b:5e:9d:6d:c8:53:a8: - 4a:30:f7:a6:ae:7c:e0:ed:16:c4:a0:07:9c:75:1a:23:58:13: - 70:9e:aa:cc:b8:1d:70:26:85:ad:e1:f3:34:83:1b:e0:72:44: - c4:28:d5:c5:6a:43:83:47:fe:8b:ab:ac:07:55:ff:2c:d9:0f: - 5f:c7 ------BEGIN CERTIFICATE----- -MIIC3zCCAkigAwIBAgIJAKWF7GCxaEQkMA0GCSqGSIb3DQEBBQUAMGgxCzAJBgNV -BAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAMBgNV -BAsTBU15U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZpY2F0 -ZTAeFw0xMTA2MTcwNzMyMzJaFw0xNDA2MTYwNzMyMzJaMH4xCzAJBgNVBAYTAkJH -MRAwDgYDVQQIEwdQbG92ZGl2MRAwDgYDVQQHEwdQbG92ZGl2MQ8wDQYDVQQKEwZP -cmFjbGUxDjAMBgNVBAsTBU15U1FMMSowKAYDVQQDEyFNeVNRTCBDUkwgdGVzdCBj -bGllbnQgY2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAL0Y -v8U3fveKHSLAT1pwUerfVk8p6celiqtaSLX5v80qc/j6EyD9MxcRk1HwT/qlarw3 -lJLefcEJxkPA983drAa//gyf/Oxbg6EeNNivUBdNhFEgRHaB0RJ2BvsFKVlHD52X -8UEvkg3ktsH7z3WVqQ/Ps09po9EU6WvPvlO9Tj9dAgMBAAGjezB5MAkGA1UdEwQC -MAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRl -MB0GA1UdDgQWBBQ5N5wLn+SOSEhxIyvK8MH5C/IK0DAfBgNVHSMEGDAWgBTEHSxo -P18pUezFVGHOFhPScl1j6DANBgkqhkiG9w0BAQUFAAOBgQAYA0ITr4bD65xAStie -5yXhQ3svVRvm7L+bVrPHy3jN0gBGOZbY+M2dDueXUZP4W+1PWhZrVvvA0Vg8f+lk -qhED/ztenW3IU6hKMPemrnzg7RbEoAecdRojWBNwnqrMuB1wJoWt4fM0gxvgckTE -KNXFakODR/6Lq6wHVf8s2Q9fxw== ------END CERTIFICATE----- diff --git a/mysql-test/std_data/crl-client-key.pem b/mysql-test/std_data/crl-client-key.pem deleted file mode 100644 index dea4a9cea56..00000000000 --- a/mysql-test/std_data/crl-client-key.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQC9GL/FN373ih0iwE9acFHq31ZPKenHpYqrWki1+b/NKnP4+hMg -/TMXEZNR8E/6pWq8N5SS3n3BCcZDwPfN3awGv/4Mn/zsW4OhHjTYr1AXTYRRIER2 -gdESdgb7BSlZRw+dl/FBL5IN5LbB+891lakPz7NPaaPRFOlrz75TvU4/XQIDAQAB -AoGAYMe37rIWk47mlpCijIEMDA++Vsn20q2RKV4N9MUcO19M99LV036DlXzzT26V -II1k8Wvo6Lpi1lewV6D9symPDwuxO3L/lSwInVSbAaCkRYq7BlpL+ShxsUpWT788 -ealwFTj3TeM1MCHpFwvO0xGBqFVk+ZadCNZjvwdQi44JCykCQQDqJgOTPPniq5Lk -J6d+KWiCPVAEnEWk5lR0jQ2NZhSm4fFmCd0v6bNYhztk7dizSOiIrXnPLXx9Z8v0 -rwKr5WrHAkEAzr5ps9d/t4V60vAJCK+Sq1b+Qj42yEnH2eIjKAUFO63jkPtpOv9h -nzYJTqajvEkHbYJ92elpzGx47FuSOjzAuwJAYpZC5xnDdSccoCf6I+q3cC70pBxQ -TpAUe0ZwsFqM039KrtX0ZZoWw22dGm/yz/ogvnucUBks03iCrbGKhGoCPQJAdlhj -U5I5Rsl+vH6w/Srbz37Vvv+0BkTNxPiA3Wi6TSZGDPkNjLshm6yn+UDEm4RGXzaC -ahoF+QHi2pG0i+e4/wJBAOmbrYbjE2LAzIBy0NvRHslPABTK4zn1L9lzU5XIjV9r -y8JiMfGNC5r7To/ERlFUlMbaPA5Zm9XNrZhDROMZLTc= ------END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/crl-client-revoked.crl b/mysql-test/std_data/crl-client-revoked.crl deleted file mode 100644 index 80c4b1254d4..00000000000 --- a/mysql-test/std_data/crl-client-revoked.crl +++ /dev/null @@ -1,10 +0,0 @@ ------BEGIN X509 CRL----- -MIIBbDCB1gIBATANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJCRzEQMA4GA1UE -CBMHUGxvdmRpdjEPMA0GA1UEChMGT3JhY2xlMQ4wDAYDVQQLEwVNeVNRTDEmMCQG -A1UEAxMdTXlTUUwgQ1JMIHRlc3QgQ0EgY2VydGlmaWNhdGUXDTExMDgxOTEwMDQ1 -MFoXDTE3MDIwODEwMDQ1MFowKjAoAgkApYXsYLFoRCQXDTExMDYxNzA3Mzc1OVow -DDAKBgNVHRUEAwoBBaAOMAwwCgYDVR0UBAMCAQMwDQYJKoZIhvcNAQEFBQADgYEA -BXAwYBjHUHG6MQ22/+1hvOaRtSYfj/E5bhKbBB8JlKSRFO+xIOF2i2H1AigunWpC -R10NicSS7qjsr6yDyBaywZmi0TCNGksR7b3m1m97RnhrxkVRlr/i7L+o04ZwWo/b -z9zoTX6RTj8rHgQtEdIOi/EArCvDv+wqYmkI+XMScGI= ------END X509 CRL----- diff --git a/mysql-test/std_data/crl-server-cert.pem b/mysql-test/std_data/crl-server-cert.pem deleted file mode 100644 index 312bce0e0b6..00000000000 --- a/mysql-test/std_data/crl-server-cert.pem +++ /dev/null @@ -1,62 +0,0 @@ -Certificate: - Data: - Version: 3 (0x2) - Serial Number: - a5:85:ec:60:b1:68:44:23 - Signature Algorithm: sha1WithRSAEncryption - Issuer: C=BG, ST=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test CA certificate - Validity - Not Before: Jun 17 07:29:11 2011 GMT - Not After : Jun 16 07:29:11 2014 GMT - Subject: C=BG, ST=Plovdiv, L=Plovdiv, O=Oracle, OU=MySQL, CN=MySQL CRL test server certificate - Subject Public Key Info: - Public Key Algorithm: rsaEncryption - RSA Public Key: (1024 bit) - Modulus (1024 bit): - 00:c4:c6:01:29:db:e6:62:40:07:bd:43:ce:37:8e: - 90:0e:3c:86:cc:6a:0c:40:8e:8e:30:27:f2:84:d3: - 59:e8:7d:e7:97:1e:0d:36:08:0b:cc:28:bb:86:b0: - 0a:64:8c:55:33:f6:ce:19:00:08:b9:93:ca:84:7e: - 9a:4e:81:91:e2:56:32:2a:de:b5:1f:82:b9:8f:33: - f4:87:f8:10:84:69:69:9a:79:58:08:9a:29:dc:09: - 79:27:90:ec:af:c8:2d:5f:2e:c1:e1:4a:f1:52:21: - 37:58:d4:f9:ef:49:ce:a9:9d:eb:dc:f4:34:30:40: - d0:d7:38:54:94:2e:d1:ac:25 - Exponent: 65537 (0x10001) - X509v3 extensions: - X509v3 Basic Constraints: - CA:FALSE - Netscape Comment: - OpenSSL Generated Certificate - X509v3 Subject Key Identifier: - 4A:18:8F:0C:A3:CF:D7:4A:38:83:07:FC:26:E3:EB:96:32:73:FA:8C - X509v3 Authority Key Identifier: - keyid:C4:1D:2C:68:3F:5F:29:51:EC:C5:54:61:CE:16:13:D2:72:5D:63:E8 - - Signature Algorithm: sha1WithRSAEncryption - 61:74:cc:62:70:9e:1f:3e:96:ac:cd:54:4f:34:60:1c:27:51: - f4:d5:f8:2e:d7:18:11:86:4e:b5:52:8c:a1:ef:28:c9:43:d7: - 23:2a:22:15:4a:a3:e7:ff:76:fa:25:be:ed:30:05:ea:12:aa: - 3f:c8:ab:a7:22:02:ea:cf:50:d4:43:31:5f:51:de:4c:e1:fa: - 31:ba:2e:4e:d8:a4:3d:80:ad:17:83:67:0f:1b:6f:0b:74:43: - ce:36:cb:2f:17:9e:6e:ae:c6:eb:ec:93:70:69:82:42:04:b3: - a7:31:1f:65:70:ff:06:ce:9c:22:8a:dc:7d:92:bc:04:24:ca: - 20:66 ------BEGIN CERTIFICATE----- -MIIC3zCCAkigAwIBAgIJAKWF7GCxaEQjMA0GCSqGSIb3DQEBBQUAMGgxCzAJBgNV -BAYTAkJHMRAwDgYDVQQIEwdQbG92ZGl2MQ8wDQYDVQQKEwZPcmFjbGUxDjAMBgNV -BAsTBU15U1FMMSYwJAYDVQQDEx1NeVNRTCBDUkwgdGVzdCBDQSBjZXJ0aWZpY2F0 -ZTAeFw0xMTA2MTcwNzI5MTFaFw0xNDA2MTYwNzI5MTFaMH4xCzAJBgNVBAYTAkJH -MRAwDgYDVQQIEwdQbG92ZGl2MRAwDgYDVQQHEwdQbG92ZGl2MQ8wDQYDVQQKEwZP -cmFjbGUxDjAMBgNVBAsTBU15U1FMMSowKAYDVQQDEyFNeVNRTCBDUkwgdGVzdCBz -ZXJ2ZXIgY2VydGlmaWNhdGUwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMTG -ASnb5mJAB71DzjeOkA48hsxqDECOjjAn8oTTWeh955ceDTYIC8wou4awCmSMVTP2 -zhkACLmTyoR+mk6BkeJWMiretR+CuY8z9If4EIRpaZp5WAiaKdwJeSeQ7K/ILV8u -weFK8VIhN1jU+e9Jzqmd69z0NDBA0Nc4VJQu0awlAgMBAAGjezB5MAkGA1UdEwQC -MAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRl -MB0GA1UdDgQWBBRKGI8Mo8/XSjiDB/wm4+uWMnP6jDAfBgNVHSMEGDAWgBTEHSxo -P18pUezFVGHOFhPScl1j6DANBgkqhkiG9w0BAQUFAAOBgQBhdMxicJ4fPpaszVRP -NGAcJ1H01fgu1xgRhk61Uoyh7yjJQ9cjKiIVSqPn/3b6Jb7tMAXqEqo/yKunIgLq -z1DUQzFfUd5M4foxui5O2KQ9gK0Xg2cPG28LdEPONssvF55ursbr7JNwaYJCBLOn -MR9lcP8Gzpwiitx9krwEJMogZg== ------END CERTIFICATE----- diff --git a/mysql-test/std_data/crl-server-key.pem b/mysql-test/std_data/crl-server-key.pem deleted file mode 100644 index fa8a61695c1..00000000000 --- a/mysql-test/std_data/crl-server-key.pem +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQDExgEp2+ZiQAe9Q843jpAOPIbMagxAjo4wJ/KE01nofeeXHg02 -CAvMKLuGsApkjFUz9s4ZAAi5k8qEfppOgZHiVjIq3rUfgrmPM/SH+BCEaWmaeVgI -mincCXknkOyvyC1fLsHhSvFSITdY1PnvSc6pnevc9DQwQNDXOFSULtGsJQIDAQAB -AoGAfecnZW4jWegYS5xv/RJF0CYgJfkQv9m21s8omJ5W37B3lzSORW0eh1Hkswg+ -jhlQhwA63Lot2vfaU65h8ytqeGSxUSj0X8bVCsG+7aoQOxeowZs+CLgWPHmXbXw8 -BI9mFbfkIQ/1x5yMSTv0BNRGUtg+t5FGPsmWxSUtfTme4CECQQDxQGEoesrJ25uE -MUcrTSeVpNmzqA8e41+8YIzbyi8nmwzp5gbsgIIF6/P5iMo1T7nIal/8N+FQMft4 -Ebzb0ZFNAkEA0M2JmH/ctyDQ7RbQx5lVwiHYn9a3inusvsV47kfH24kdRZYSymI8 -of7O8SGkHFJNeYsJmM3UrsNDlbSd+sCaOQJBAKoM+i8hVp2weU9VuNex28wkVfvH -41ifZtUOrVsjidd9+D1KkejUsFHiPqfOntGzL74wFRZggSYZBStePWQotSUCQH29 -aMDnLtkw79/2v1+TnSs9CqCmwvyoIYz4iiykGVzBI1mGWGZ75ht/wMtBAPz1Kyao -be0Q9qUPfaGnlQMt/TECQGrMh32zFPFR98yNS6JDVAVib+d5SaJsV5HXXqKCYxQR -u1sv7YeF4/Y+TPKpBSasDNZHQ3zex0M9YOgI+9eEBHk= ------END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/crldir/ed1f42db.r0 b/mysql-test/std_data/crldir/ed1f42db.r0 new file mode 100644 index 00000000000..1f737bf790b --- /dev/null +++ b/mysql-test/std_data/crldir/ed1f42db.r0 @@ -0,0 +1,12 @@ +-----BEGIN X509 CRL----- +MIIBxTCBrgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNlcnQxCzAJ +BgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kx +EDAOBgNVBAoMB01hcmlhREIXDTE5MDEyNzEwMTExNVoXDTM5MDEyMjEwMTExNVow +FDASAgEFFw0xOTAxMjcxMDExMTVaoA4wDDAKBgNVHRQEAwIBAjANBgkqhkiG9w0B +AQsFAAOCAQEAI0yg8tW6n8m/3g4FO5fjrtwEB1HYnJVLbKT2fOSKs7WN/t6M4ZWo +hSolEpNozd0yP+20srCMzsg7PuiYV/jMJn0bCw+Q6G7IP2GBlBURRErJ6UNZ+Upe +Gc+o5tWvb7ROwMj76UBzK5tDsmDapk5102k0sfaIbD51OmA+RxnxbKsGNvAVp9EH +yN+irF6vfVmbP1WPzGZa6x2s70kiC3peQlnZFOUnhycwVdiRprcUd+ZfMLJ3Ov2b +oa9P+ntTW/0ijg0QYH6gSQVOl9ZiVhnRR/eO6SrkrevgtAM3pXl4aDdvFyoIXXkh +mCkYfW7LkH/+OYWyZ1W99cnISM2F+yC1yQ== +-----END X509 CRL----- diff --git a/mysql-test/std_data/crldir/fc725416.r0 b/mysql-test/std_data/crldir/fc725416.r0 deleted file mode 100644 index 80c4b1254d4..00000000000 --- a/mysql-test/std_data/crldir/fc725416.r0 +++ /dev/null @@ -1,10 +0,0 @@ ------BEGIN X509 CRL----- -MIIBbDCB1gIBATANBgkqhkiG9w0BAQUFADBoMQswCQYDVQQGEwJCRzEQMA4GA1UE -CBMHUGxvdmRpdjEPMA0GA1UEChMGT3JhY2xlMQ4wDAYDVQQLEwVNeVNRTDEmMCQG -A1UEAxMdTXlTUUwgQ1JMIHRlc3QgQ0EgY2VydGlmaWNhdGUXDTExMDgxOTEwMDQ1 -MFoXDTE3MDIwODEwMDQ1MFowKjAoAgkApYXsYLFoRCQXDTExMDYxNzA3Mzc1OVow -DDAKBgNVHRUEAwoBBaAOMAwwCgYDVR0UBAMCAQMwDQYJKoZIhvcNAQEFBQADgYEA -BXAwYBjHUHG6MQ22/+1hvOaRtSYfj/E5bhKbBB8JlKSRFO+xIOF2i2H1AigunWpC -R10NicSS7qjsr6yDyBaywZmi0TCNGksR7b3m1m97RnhrxkVRlr/i7L+o04ZwWo/b -z9zoTX6RTj8rHgQtEdIOi/EArCvDv+wqYmkI+XMScGI= ------END X509 CRL----- diff --git a/mysql-test/std_data/galera-cert.pem b/mysql-test/std_data/galera-cert.pem deleted file mode 100644 index 2996b330cc0..00000000000 --- a/mysql-test/std_data/galera-cert.pem +++ /dev/null @@ -1,26 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDWTCCAkGgAwIBAgIJAIlW4JmZGnU4MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV -BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg -Q29tcGFueSBMdGQwIBcNMTQxMDI0MDc1MTU1WhgPMzAxNDAyMjQwNzUxNTVaMEIx -CzAJBgNVBAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0Rl -ZmF1bHQgQ29tcGFueSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQDDzU6xLZDD5rZENsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2Qa -MyTkvyjzf7bSFsDt9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BW -B3lcoKXXJgMnWw0WGrt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5 -kdcIbDRVw81J4eAZ6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrM -mhOeL8kuQV0fI8v2xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWX -Qo98swTu7mb89qVYmR71d3L3AgMBAAGjUDBOMB0GA1UdDgQWBBRdWet/kGNTyvXK -wuBdP/eSldOgWjAfBgNVHSMEGDAWgBRdWet/kGNTyvXKwuBdP/eSldOgWjAMBgNV -HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCcJpP+DR4AJxVelNTSZa+V38c+ -jgrMD2Ku2eU8NQlsjgMfNEU5Md/g7FpP8aCFzVf0kAAT7DxZmSE3uWXQbMXyVJmy -bF+qXinf71QzdWULm6sASoshC6wbHnXL9ZjWQ3gh1nqVgo3MmLQYrb3eJfKaaLoc -wpjhYxVxGFOx1ITN3jED64lUfoLHvR6NFbESYKAuAAzSNqX4HOQ3uGk2THM8JocZ -oH2+38d81Kd4HQ7DDDKS/isG0+rR60Ti1cMgu7OT7p1dZCwT/KQuI5eGjE9lubkc -yAJjaod4rVLdBri3XVvtySfS2+/75qUgv2TF7d/s7mxMq4DDt29yeKSUhZCs ------END CERTIFICATE----- ------BEGIN DH PARAMETERS----- -MIGHAoGBAJWyvKjE+s7OP4Lj1jXKGlJGWT4Vd5YaxPljihTsRe1aXkWAgsuwISXk -/TQ8Rx5Zmze7rtwtU0PoYxvuam9FMXYqhw2dVe4qRdeSX78DSiL/YBkQzaxlfWVy -RE9+9dzHbCtRVDlN7K1kA+mGWH4/r7NAu4Qm/003V0NTtMwQSqebAgEC ------END DH PARAMETERS----- - diff --git a/mysql-test/std_data/galera-key.pem b/mysql-test/std_data/galera-key.pem deleted file mode 100644 index c88c613cacf..00000000000 --- a/mysql-test/std_data/galera-key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDDzU6xLZDD5rZE -NsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2QaMyTkvyjzf7bSFsDt -9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BWB3lcoKXXJgMnWw0W -Grt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5kdcIbDRVw81J4eAZ -6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrMmhOeL8kuQV0fI8v2 -xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWXQo98swTu7mb89qVY -mR71d3L3AgMBAAECggEBAIMT0UdZSp1quL/nrYqNGa9kuSuDz4uCM3+3jNcGZVU4 -vCYHxpmINLi0UK8W5ROJA3zC4AZKjDgOlW93NXK5iKyyiUTIN3hiJi4jiVDuGbh2 -DZtH7mmAKAU1zCx2y2osLLmurfbe8qOJF7ShhrZfgWsHFujFhhUdU92dsTkhZ7EU -2NF8ScxCo4PbOJoHC3j0ApfwCMxUMAKZF5+08EeKYqK7OAXI79HeIvEbHn3cUDGm -bvg6ykwlz2UUO4sg+xdCmn1Bt36HF/4e973Y5fkE/vd9mryHIlu9t7GJgWyUiPr8 -BGEoAWDSpPOMd/b9ivtxh9Gd+LW/uitMuBIfrRPgz9kCgYEA+JqeeD2xqF2IzZyq -i1UqgKe3su2U2zhkgbu1h/1M/reNIZGylF0wFs3P+kNIB2NavmHjXcgSjdJzqRL9 -XEWfFJRmeARo9RTEQEVd8zp1Eo8ISeiksGgvbL4rrNIRR5V5MZytfISRiGCWN6jx -ulJ6EieQk5EcvknGlWpJY/bBsQ0CgYEAyaCLqrR38gVl2Z0t6YlhW/HWAwGt+lf4 -apN1AS4uykx7wRW2B0y9QUDfsrYeVlbbeRPP4UzPmJez+J2cweoIIeFFyo3KP2L7 -79E3EVYywjXhPg52F7OjFA4Bp970XclIC5Al7kDufSgwZmWdceSx4Jjc5ixyQEC8 -Ad0ThgP6yxMCgYAvC4OFmZcvF1Q2JLmZWGqMojB/KbqLqaZLbqwxqduSMEYC3kF/ -FgttpVEAOQ8+ZqzbbkbKjnwEXpkIm9FaTsqF6HdjquH5zw48Y2QeDSfudSbKZb4U -rAKdf3dgYvhmJYEjxFSIRcYMmsqSieQEsGrtWJNheYqI8AkmaVCuHBoXWQKBgQCj -daelNffD2wJuQNI28axfiRjSiSsNuQHpDTCfS1ydnxH5QGu5UUphO4HfdWv03SfC -6f/vDIGEmQBLvyOVxfDf3qzhAMCFUO8kxj1ZrcMq1dmMoNa2cmj0WkKXYNZFrmfd -D/jgRf3Ss6FBcoIJErnudp8nb8MUOibxb9RjIpjQxwKBgEliKaGN+/QkPTNJ4vXz -609CIilxpE+YVTzlv3YeZP5HqsJTJPS2ARIUr/Pjpbl3LHfYNeeGDCwgkJIK0JJH -iA1M51q6t3zG2y9gKmC15FF0jShoZkRgqBxqrSHAnrCo5t2C48ElxJ3FEU8T75sz -dlGTbkmR0Wm43Kh++dWICJ3g ------END PRIVATE KEY----- diff --git a/mysql-test/std_data/galera-upgrade-ca-cert.pem b/mysql-test/std_data/galera-upgrade-ca-cert.pem deleted file mode 100644 index 13d27e84bb3..00000000000 --- a/mysql-test/std_data/galera-upgrade-ca-cert.pem +++ /dev/null @@ -1,40 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDWTCCAkGgAwIBAgIJAIlW4JmZGnU4MA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV -BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg -Q29tcGFueSBMdGQwIBcNMTQxMDI0MDc1MTU1WhgPMzAxNDAyMjQwNzUxNTVaMEIx -CzAJBgNVBAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0Rl -ZmF1bHQgQ29tcGFueSBMdGQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIB -AQDDzU6xLZDD5rZENsOpTpTmqS8YisBaefU3ZeN7VJepZZ/7unM/1YLGJtuRh2Qa -MyTkvyjzf7bSFsDt9L5lfQwBBblVeWkrCvGnQmHDQQYB7JrSmFDPz9W9Mxf9Q2BW -B3lcoKXXJgMnWw0WGrt0lEdFp9gWbq8H9hwJdjpyyk4ZTIuucSOD4JUP3QFEhYU5 -kdcIbDRVw81J4eAZ6EdvbjDN05S7qWjW7rJTnCHAHEd18hcsMGwjpwhjEaSdhMrM -mhOeL8kuQV0fI8v2xfYBliIn9xBZGOVzySPzwFmQceORlW6F3V5w6mwFkmuXqXWX -Qo98swTu7mb89qVYmR71d3L3AgMBAAGjUDBOMB0GA1UdDgQWBBRdWet/kGNTyvXK -wuBdP/eSldOgWjAfBgNVHSMEGDAWgBRdWet/kGNTyvXKwuBdP/eSldOgWjAMBgNV -HRMEBTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQCcJpP+DR4AJxVelNTSZa+V38c+ -jgrMD2Ku2eU8NQlsjgMfNEU5Md/g7FpP8aCFzVf0kAAT7DxZmSE3uWXQbMXyVJmy -bF+qXinf71QzdWULm6sASoshC6wbHnXL9ZjWQ3gh1nqVgo3MmLQYrb3eJfKaaLoc -wpjhYxVxGFOx1ITN3jED64lUfoLHvR6NFbESYKAuAAzSNqX4HOQ3uGk2THM8JocZ -oH2+38d81Kd4HQ7DDDKS/isG0+rR60Ti1cMgu7OT7p1dZCwT/KQuI5eGjE9lubkc -yAJjaod4rVLdBri3XVvtySfS2+/75qUgv2TF7d/s7mxMq4DDt29yeKSUhZCs ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIDVzCCAj+gAwIBAgIJALBO5bqmtlYkMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV -BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg -Q29tcGFueSBMdGQwHhcNMTUwNjI2MDcxMjQ1WhcNMjUwNTA0MDcxMjQ1WjBCMQsw -CQYDVQQGEwJGSTEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZh -dWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA -1DlcztIzSngGeTUFibj9GZ4ZO78ASpgYySZv/DRIVn/3hbF41ZRD/6uJlb5rf1R7 -fpFsurbXNDDxeap7b/Gz2XSQy96Dbm0SbsFSZttV/R2WtlT1Wf5n9ix6RLqhKSbg -nPyL2fsDaxtZh2uywGJEXhwXFtdx3deIo/tYivDfl5Tcsv0NnZY8Vg0boBRP+FEn -ReJOdSa5LLn+QJN2Xa+wutbLHe0hI6huKUXU2YUeBfgyk1nWol5241ZUDCgDsoaW -8r2YeJNHmNInd3wERbqFgFHsR4N1+Atcyrfn/uQSj9zrTPO/Pp51KpjWf/gjxjXP -biu5De50qZ4+U4no20EIOwIDAQABo1AwTjAdBgNVHQ4EFgQU3kSPGchrOoQJ5gq1 -mmV2HEra6GswHwYDVR0jBBgwFoAU3kSPGchrOoQJ5gq1mmV2HEra6GswDAYDVR0T -BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAfoBD64FJ9fAR19+vwueFGmpWNIqF -PzN7QmEpCMduV3DXuxYO73q2ikXgrVO5HWFz9IjNvzXbSRmWNzJGaZ3QYZ+Xx1JJ -8MrAOUr6djWuyD659f64dh/2jMxiQNoEHrknXm9HSqR5oJVwndFyr/zvSkYSRexE -KFciIprb9LOba9G3ZMBYBdqK+f3Ky16BMjaD6XfaTx+xjHk/8peSueXIQl+v2biz -zSfpEUa0dKCIxckrzD4JknDHFimTsrzlRftcg8t8piOXwZomFcnVunyGs2bJ/Npj -25c2e6sx7XSc5bUgPGuQcSGflZPLg9zWyJ69sVYUNAz+gqfvWfOOJuzPNg== ------END CERTIFICATE----- diff --git a/mysql-test/std_data/galera-upgrade-server-cert.pem b/mysql-test/std_data/galera-upgrade-server-cert.pem deleted file mode 100644 index 3af8b1ae7dd..00000000000 --- a/mysql-test/std_data/galera-upgrade-server-cert.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDVzCCAj+gAwIBAgIJALBO5bqmtlYkMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNV -BAYTAkZJMRUwEwYDVQQHDAxEZWZhdWx0IENpdHkxHDAaBgNVBAoME0RlZmF1bHQg -Q29tcGFueSBMdGQwHhcNMTUwNjI2MDcxMjQ1WhcNMjUwNTA0MDcxMjQ1WjBCMQsw -CQYDVQQGEwJGSTEVMBMGA1UEBwwMRGVmYXVsdCBDaXR5MRwwGgYDVQQKDBNEZWZh -dWx0IENvbXBhbnkgTHRkMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA -1DlcztIzSngGeTUFibj9GZ4ZO78ASpgYySZv/DRIVn/3hbF41ZRD/6uJlb5rf1R7 -fpFsurbXNDDxeap7b/Gz2XSQy96Dbm0SbsFSZttV/R2WtlT1Wf5n9ix6RLqhKSbg -nPyL2fsDaxtZh2uywGJEXhwXFtdx3deIo/tYivDfl5Tcsv0NnZY8Vg0boBRP+FEn -ReJOdSa5LLn+QJN2Xa+wutbLHe0hI6huKUXU2YUeBfgyk1nWol5241ZUDCgDsoaW -8r2YeJNHmNInd3wERbqFgFHsR4N1+Atcyrfn/uQSj9zrTPO/Pp51KpjWf/gjxjXP -biu5De50qZ4+U4no20EIOwIDAQABo1AwTjAdBgNVHQ4EFgQU3kSPGchrOoQJ5gq1 -mmV2HEra6GswHwYDVR0jBBgwFoAU3kSPGchrOoQJ5gq1mmV2HEra6GswDAYDVR0T -BAUwAwEB/zANBgkqhkiG9w0BAQUFAAOCAQEAfoBD64FJ9fAR19+vwueFGmpWNIqF -PzN7QmEpCMduV3DXuxYO73q2ikXgrVO5HWFz9IjNvzXbSRmWNzJGaZ3QYZ+Xx1JJ -8MrAOUr6djWuyD659f64dh/2jMxiQNoEHrknXm9HSqR5oJVwndFyr/zvSkYSRexE -KFciIprb9LOba9G3ZMBYBdqK+f3Ky16BMjaD6XfaTx+xjHk/8peSueXIQl+v2biz -zSfpEUa0dKCIxckrzD4JknDHFimTsrzlRftcg8t8piOXwZomFcnVunyGs2bJ/Npj -25c2e6sx7XSc5bUgPGuQcSGflZPLg9zWyJ69sVYUNAz+gqfvWfOOJuzPNg== ------END CERTIFICATE----- diff --git a/mysql-test/std_data/galera-upgrade-server-key.pem b/mysql-test/std_data/galera-upgrade-server-key.pem deleted file mode 100644 index d243c9e0381..00000000000 --- a/mysql-test/std_data/galera-upgrade-server-key.pem +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDUOVzO0jNKeAZ5 -NQWJuP0Znhk7vwBKmBjJJm/8NEhWf/eFsXjVlEP/q4mVvmt/VHt+kWy6ttc0MPF5 -qntv8bPZdJDL3oNubRJuwVJm21X9HZa2VPVZ/mf2LHpEuqEpJuCc/IvZ+wNrG1mH -a7LAYkReHBcW13Hd14ij+1iK8N+XlNyy/Q2dljxWDRugFE/4USdF4k51Jrksuf5A -k3Zdr7C61ssd7SEjqG4pRdTZhR4F+DKTWdaiXnbjVlQMKAOyhpbyvZh4k0eY0id3 -fARFuoWAUexHg3X4C1zKt+f+5BKP3OtM878+nnUqmNZ/+CPGNc9uK7kN7nSpnj5T -iejbQQg7AgMBAAECggEBAJ4m7VG3db+uOGzFJY5fzEX1+qn6ibYNKJNmUJfrQmkr -zgLUoc7QQehbJhnwoN1v0OQebZ+rOC7NtnZLpNdkkPmhk3JKLTnykIT3DnhWRftt -vG2+XGUnYMQkmy1ywz0Omt6CmZnlJMQByrNPgBM8Z+SWHGLKRTHkOBCz82T/YjDr -wqug1Yv6W0wMNM/cikgoBldVG7hABCJuShjffIbUgVysK3dEPNywNAC78neoGECm -evPZOaIkWEr86SpAlwA6Yh+zTQZ03CXATcGonJdWJ015DvlKRv6QyRR0Q/Y1ONwb -f115kll15MJBEspFdSyhlMcVJlwO8WMaZ2qIzlQZmdECgYEA//P469QzX00L/urK -7IRvtSVu5CP/A/Wui90U4KoP7XgXIeExnEtzLVs1K7vjuzdpTyq+68XuC40gPcJW -RvoX229m6gRV8nC53UiV71jM8IvkyEqFYT/gfZC9KQCMSRJLtVnDMpZ3gMxAY6/5 -p20o616Au8DKFFetQV0aD4Hj1/MCgYEA1ENV1WkgvN6yItB77E9kN/vbKLRh0hrg -9xj0SmMXGYyDM9NpjbgbgJIZo3ukkBtp3kEY8P9JQZRcd1EcnnSrwTB7ChdInWkR -m/LpIZBEMqNQbeu4QSzZYYS6z4tcGGx43aHqzzNBZdnQnqhYL1CvlLwhkgX6oQCo -woXqyfMNKJkCgYEA63gD1NGPwWkcVBSlQxpDup8JeZE0Fux6++kUP+u0Y39LqLuH -7IXtHBkAvY9JXv8HPvHQWw/og2/97VNQFFQYhqPiRgBfIX9bPpx8c4l6YQISI8GL -G4CsglgZ7hK2/LJ8PAascWnD3xYJVqyaPNFMB90VCaW/Qx+2IKAKTaHtfskCgYBu -1f5C4pMqrCpeTXj4Cvis1wE4PwB5QnnH7SrakOVl/N4huLn8O2948lEa8Zwbd4UP -ffR1Gwh4iuzBjQQhpZBt30/QFBphv5RnVy7uzLMfsfF0hEqBFdcoubMGXqGnSzTN -nhfLO9thQJxTzFnH0xzr0FTDOAYH/h0g/eZ8r0JmuQKBgQDjhXM+hJ3Pkwua+Fnl -nZfY5MeSzkJki/9iwVo8rSDwmZS9Nsc83oZnddM7c2x63t+zYOAcMxsVCiByMDzo -5IB781HWRBGcU8TnW1b0bAnZimjKp/qsZ/Szr38rvImqG8TjzbcSD7w0SpyRQ/Ot -A7SZFkWYfem8/q/VImjU/CNbOQ== ------END PRIVATE KEY----- diff --git a/mysql-test/std_data/mdev17909#P#p20181029.MYD b/mysql-test/std_data/mdev17909#P#p20181029.MYD new file mode 100644 index 00000000000..e69de29bb2d diff --git a/mysql-test/std_data/mdev17909#P#p20181029.MYI b/mysql-test/std_data/mdev17909#P#p20181029.MYI new file mode 100644 index 00000000000..dcdd088b4dc Binary files /dev/null and b/mysql-test/std_data/mdev17909#P#p20181029.MYI differ diff --git a/mysql-test/std_data/mdev17909#P#p20181128.MYD b/mysql-test/std_data/mdev17909#P#p20181128.MYD new file mode 100644 index 00000000000..e69de29bb2d diff --git a/mysql-test/std_data/mdev17909#P#p20181128.MYI b/mysql-test/std_data/mdev17909#P#p20181128.MYI new file mode 100644 index 00000000000..dcdd088b4dc Binary files /dev/null and b/mysql-test/std_data/mdev17909#P#p20181128.MYI differ diff --git a/mysql-test/std_data/mdev17909.frm b/mysql-test/std_data/mdev17909.frm new file mode 100644 index 00000000000..575ecd2c70f Binary files /dev/null and b/mysql-test/std_data/mdev17909.frm differ diff --git a/mysql-test/std_data/mdev17909.par b/mysql-test/std_data/mdev17909.par new file mode 100644 index 00000000000..d9141dd0dee Binary files /dev/null and b/mysql-test/std_data/mdev17909.par differ diff --git a/mysql-test/std_data/rpl/mysql-5.7.11-stm-temporal-round-binlog.000001 b/mysql-test/std_data/rpl/mysql-5.7.11-stm-temporal-round-binlog.000001 new file mode 100644 index 00000000000..5010e164e43 Binary files /dev/null and b/mysql-test/std_data/rpl/mysql-5.7.11-stm-temporal-round-binlog.000001 differ diff --git a/mysql-test/std_data/rpl/mysql-8.0.13-stm-temporal-round-binlog.000001 b/mysql-test/std_data/rpl/mysql-8.0.13-stm-temporal-round-binlog.000001 new file mode 100644 index 00000000000..4d582fdf5bb Binary files /dev/null and b/mysql-test/std_data/rpl/mysql-8.0.13-stm-temporal-round-binlog.000001 differ diff --git a/mysql-test/std_data/server-cert-verify-fail.pem b/mysql-test/std_data/server-cert-verify-fail.pem deleted file mode 100644 index 4203425a344..00000000000 --- a/mysql-test/std_data/server-cert-verify-fail.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDJzCCAg8CAQEwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCSU4xETAPBgNV -BAgMCEthcm5hdGthMRIwEAYDVQQHDAlCYW5nYWxvcmUxDjAMBgNVBAoMBU15U1FM -MB4XDTE2MDEwNTEwMDgyN1oXDTI1MTExMzEwMDgyN1owbzELMAkGA1UEBhMCSU4x -EjAQBgNVBAgMCTpLYXJuYXRrYTETMBEGA1UEBwwKOkJhbmdhbG9yZTEPMA0GA1UE -CgwGOk15U1FMMRcwFQYDVQQLDA4vQ049bG9jYWxob3N0LzENMAsGA1UEAwwEZmFp -bDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL3wnWuJodzZYq9TAJRm -HU7995FA3TEWdUinYTgGP79aTVQ4M9aeINlB6whWXOI8seh9Ja7C6kMzqOgYbgCl -WlDPAVJWktFYeWXOLxbpzh1KWkS6jBkWT02t7H7JcYbil7xjlJUxLz4UOOUDUDIP -6yqdA9VE3osESttjzj57Zm2xPqzbIHVJfORn7EexH4pryS7439p6i4XtfL31NJ8V -07M3j3a8GqbcEqXYvcUCrLnywDQ1igP817b6ta52nbgYWiqdn0mJs535UJ/p/rSl -D4Ae/6G3BSEY7whir6xY6vsd4KJ6w+wRCHnY0ky6OdDJVJLH1iqh7si7P3RBGkxw -Y7MCAwEAATANBgkqhkiG9w0BAQsFAAOCAQEAggbw1jj2b7H5KDdeGJGIoOGkQAcs -GNSJussCfdk7qnzYXKmjyNppC86jjaOrXona5f+SNCuujdu86Tv8V69EH57k4lUc -DW7J4AD3vUb/tBzB0tsI/76Z4gm1XoCsnCGGpWd8GQAg/QNn/ZfJB2Vb/9ObN6rH -0HV7ouB6OGZSsb71+grKiN6mDyB1lZynCGvqBxOCKFISfcRbCNFHo/pONlHaNGPE -vjDH1bPZbEHj8owYgkdcQe0a8EbJYeQfm6fH8V8bmUcG7N60DrCnq4l1qwwVkh1S -7RpIDgrWkU+esIIdYZIIbtDxQP1Sm7kUh++7b+bcHnyw3KtDVSCw7MIedA== ------END CERTIFICATE----- diff --git a/mysql-test/std_data/server-cert-verify-pass.pem b/mysql-test/std_data/server-cert-verify-pass.pem deleted file mode 100644 index f8780f1f94e..00000000000 --- a/mysql-test/std_data/server-cert-verify-pass.pem +++ /dev/null @@ -1,19 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDEzCCAfsCAQEwDQYJKoZIhvcNAQELBQAwRDELMAkGA1UEBhMCSU4xETAPBgNV -BAgMCEthcm5hdGthMRIwEAYDVQQHDAlCYW5nYWxvcmUxDjAMBgNVBAoMBU15U1FM -MB4XDTE2MDEwNTEwMDU1OVoXDTI1MTExMzEwMDU1OVowWzELMAkGA1UEBhMCSU4x -EjAQBgNVBAgMCTpLYXJuYXRrYTETMBEGA1UEBwwKOkJhbmdhbG9yZTEPMA0GA1UE -CgwGOk15U1FMMRIwEAYDVQQDDAlsb2NhbGhvc3QwggEiMA0GCSqGSIb3DQEBAQUA -A4IBDwAwggEKAoIBAQDAmkbUwDe+nrqL8A8uwlIZk74HHCDjUAWrskKF9leEIQsB -5exFZ8JEo1u6mdR4laQWsxizGdTPqIEidkDyyEMh4+joHgyQEPD/G3rFVW8yEFHb -42O04O96BEPFXNPDRuX3MxI+lGbYDjxTS/WhVub4/3SqLjC28FJmEUXIHA0/A+c5 -hlYXK0u+aPAqXxHIjBgB4BxxHXZKqecmvR3LhXoVmhJmndsVfKajB27nDKc8/OTI -H2SXb6h3nRPDXRfwB/C5i+004tEsVeIgkYshcCgLSyDdeVieUP2pm3EAmDSjmtLF -6CgY/EBSfH+JCKFUk75bA4k8CCGzBfIeOcsKHwgFAgMBAAEwDQYJKoZIhvcNAQEL -BQADggEBAInDuHtDkeT6dkWmRJCP56c4xiQqib2QuYUuMSrAhf07xlLHc6iHnD2X -hCWCrja6uwF90DnPjeouKMAUe5txq/uKA8/Y/NfXN6nPiAeHLI0qnTv7Mr9TQ8zU -DNDwRz6onlI2cS4GhrwAnlpiaxu7AjMUWHtfBFGFrgn3PawjDQpsBZNcxw1QsLc0 -E0hFrWLOd0vDETEhoRge88N7a0jqK0Rd9cvRWnvjI+IsjQMLZzKufivIHPzI9K+9 -Wtp8iRHcaBr5DpsBjgsO7dqVRbsNyaWsdHdLt+CQSGXpv7P6fq3K6nJFTBeIgSfS -gflrHVKYZRkKDDDpX4yHNdnIqrvy4RU= ------END CERTIFICATE----- diff --git a/mysql-test/std_data/server-cert.crl b/mysql-test/std_data/server-cert.crl new file mode 100644 index 00000000000..c841c893c57 --- /dev/null +++ b/mysql-test/std_data/server-cert.crl @@ -0,0 +1,12 @@ +-----BEGIN X509 CRL----- +MIIBxTCBrgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNlcnQxCzAJ +BgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVsc2lua2kx +EDAOBgNVBAoMB01hcmlhREIXDTE5MDEyNzEwMTExNVoXDTM5MDEyMjEwMTExNVow +FDASAgEBFw0xOTAxMjcxMDExMTVaoA4wDDAKBgNVHRQEAwIBATANBgkqhkiG9w0B +AQsFAAOCAQEAERRidERQcCHOE3ltJeftBHhZL4xi/NuOH0KlYK6I00Resrwz4UUm +cvBzNBb7LqLw24tRvhAGXrSxDEKVsUc+54VBRfPrHbUR15/9eseCA7lIKRS0ub8q +0fvtwinxyr4Y9hcP9ew9bUZxf99yegc6rNC7/8xZCnIOdvQQ5BpelPGmZ71tnBeg +6UkW6IG0/BG1MlxRJenAlILtxwu+Q6lgRvVrAtSQJJxTCzCof6oM7vTDvlTHH1LL +F11xIXP9rjNGw0qBJmxLT4J8tB++eV5u7MpSlbwQNga44zyyvBqdRuSyhFufXPBi +hqUmVskfdZs9HYrqIWz9ipkFiMNXEzGNxA== +-----END X509 CRL----- diff --git a/mysql-test/std_data/server-cert.pem b/mysql-test/std_data/server-cert.pem index b874f129ce3..068d7200c3e 100644 --- a/mysql-test/std_data/server-cert.pem +++ b/mysql-test/std_data/server-cert.pem @@ -5,22 +5,31 @@ Certificate: Signature Algorithm: sha256WithRSAEncryption Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB Validity - Not Before: Apr 25 20:52:21 2017 GMT - Not After : Apr 20 20:52:21 2037 GMT + Not Before: Jan 27 10:11:10 2019 GMT + Not After : Jan 22 10:11:10 2039 GMT Subject: C=FI, ST=state or province within country, in other certificates in this file it is the same as L, L=location, usually an address but often ambiguously used, O=organization name, typically a company name, OU=organizational unit name, a division name within an organization, CN=localhost Subject Public Key Info: Public Key Algorithm: rsaEncryption - Public-Key: (1024 bit) + Public-Key: (2048 bit) Modulus: - 00:c9:fe:83:3f:0b:38:89:1d:43:15:93:5c:26:b9: - 80:65:41:bd:2f:63:66:5e:db:fa:33:20:d9:c7:e1: - 35:f3:14:3c:c8:b4:f7:09:d8:f5:b5:44:8f:6b:7e: - a0:a4:3b:45:5f:e6:f4:0f:08:67:f8:5a:4c:49:e4: - e5:39:31:69:8c:cf:25:78:93:a6:7f:58:e9:90:9c: - 61:cb:2e:14:b1:57:b2:15:9c:ea:8d:6f:96:20:fe: - 29:ed:2c:71:b8:4f:1f:e0:05:6c:04:b1:7e:e0:bc: - 42:8e:bf:95:5e:a9:5e:c9:c9:a4:64:c2:1f:59:94: - 14:c2:06:44:79:bc:d2:65:2d + 00:eb:7c:4f:59:f0:40:37:ed:38:b2:e8:30:69:4e: + 95:c9:00:59:d1:60:3b:8a:aa:28:a1:20:40:ee:bf: + 1c:f3:b0:a6:40:8e:57:a4:79:81:c9:70:9f:8c:3d: + f4:5c:b0:f9:58:55:d9:62:b2:4b:69:e1:1a:73:bf: + 03:0e:8b:ca:d3:0d:f2:12:ea:68:1e:b8:f5:ba:29: + 02:b0:15:7f:76:52:9a:7d:ee:6d:7e:2c:f5:5a:d0: + 8c:a7:c9:53:d8:8c:ce:e3:be:c7:bb:4a:ae:7c:f9: + f1:6d:07:ac:3b:55:cd:83:3d:e4:ef:96:8e:a9:c9: + 1c:cb:84:99:cf:37:f5:53:57:e7:94:78:97:12:04: + 1f:dc:31:f8:f0:bf:7c:9b:ef:8a:25:02:1f:1b:ab: + cd:f9:bd:a9:de:df:e1:3d:b2:fb:92:44:93:59:ab: + f7:c2:a6:e1:05:19:49:fb:f8:02:5d:3e:d0:50:26: + 5b:e3:26:ac:fb:cf:ab:f1:52:0a:12:36:16:3d:b5: + 9e:12:f3:c3:69:e2:9b:89:70:b2:31:56:9a:9b:91: + a4:c6:39:01:56:e4:b5:8b:35:70:4e:eb:45:1b:70: + 7d:1a:52:2f:a5:37:32:80:ae:50:d0:da:4a:85:6a: + 3c:66:e7:41:85:c8:3a:dd:25:d8:4c:32:85:cb:12: + bc:81 Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -28,47 +37,50 @@ Certificate: Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: - CB:22:3B:E6:DA:B8:3D:7E:39:61:18:38:50:C8:4D:B4:C8:9A:3E:2B + 0B:18:61:66:8F:12:44:81:60:0D:80:D6:0A:6A:9E:DE:D7:69:56:B0 X509v3 Authority Key Identifier: - keyid:1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12 + keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93 Signature Algorithm: sha256WithRSAEncryption - 8e:b7:3d:cc:2b:e5:27:49:49:5a:d4:3c:83:9b:2f:7d:11:de: - 6b:0f:b4:51:02:e4:37:d0:c4:b5:7b:4b:e3:42:93:75:32:d1: - eb:41:a2:27:fe:4d:91:ae:2b:a0:8b:3b:7f:e9:1b:47:85:73: - 9f:b7:05:74:34:eb:62:12:d8:f2:24:6a:b4:24:58:7a:6a:55: - 3e:ba:54:f9:51:de:54:0e:19:06:f6:01:23:32:0a:6c:81:e2: - 57:8a:9e:71:c5:ba:ca:c3:0f:18:d4:ef:54:4b:e1:ee:7c:3a: - f3:4d:c3:a3:44:21:9f:c8:ef:85:01:ab:fe:a9:7b:36:05:10: - 25:5e:61:b8:1d:7c:40:8a:5d:5b:c1:bb:7c:79:45:6e:84:63: - b5:3f:51:e9:9c:57:01:de:2d:1e:85:cb:83:f0:16:6d:78:bb: - 12:01:a5:e5:a2:a7:80:fa:54:8f:9a:5c:de:1c:52:a2:bd:00: - 49:e4:04:65:30:f9:b9:fc:4f:94:e2:d8:39:89:b6:a5:a5:2d: - db:25:a3:0d:5b:f9:e1:2a:13:19:5e:d7:1a:33:89:5b:ac:bd: - 29:26:da:1a:90:7e:08:19:dd:59:4b:50:fd:46:c3:0b:91:33: - 8b:c6:70:d1:22:18:37:a3:8b:d3:8f:f8:68:cf:38:8e:e1:ef: - ac:17:88:ca + ac:6b:15:7d:68:74:9d:ce:e2:ed:80:9c:f6:36:b5:54:8b:60: + 38:d3:cd:43:5c:97:44:1b:c8:6d:73:e2:1d:6a:68:07:bf:c4: + 0c:bf:ae:b9:f1:12:28:1b:07:6d:86:2e:8d:4d:1c:56:3e:e7: + d7:62:a1:a2:de:9b:7b:1a:8a:b4:7f:76:f1:cf:d3:b5:b0:95: + 91:ce:7e:49:45:0f:11:a6:96:6b:7b:42:07:cc:8d:28:13:d2: + 30:19:5a:c3:31:16:f6:0a:9a:d7:cd:8e:6f:be:8c:aa:91:40: + 68:fa:4d:ff:9f:10:d6:3d:27:27:54:f7:64:fa:7a:89:d9:67: + 4b:63:2b:da:cc:95:f1:30:10:e8:5e:cd:ce:43:c9:72:ad:32: + b6:06:cc:a9:02:dd:4d:9c:00:97:fc:99:80:84:bf:e3:54:5a: + e8:2c:a5:b3:30:8e:30:cb:3c:5f:74:18:43:a3:42:36:53:78: + 62:4f:08:56:11:80:c2:12:1a:da:70:18:10:7f:3d:15:b4:73: + 29:26:69:7d:3b:ec:f8:18:01:f7:ac:c2:8f:f2:37:8d:8d:fc: + 78:87:bc:d4:cb:1d:c1:14:c7:9c:3b:dc:a9:fd:e8:86:2a:32: + 51:fe:8d:89:cd:6a:9d:7a:6f:0c:52:4b:b2:4d:d3:dc:02:39: + 8d:2d:25:6e -----BEGIN CERTIFICATE----- -MIIEETCCAvmgAwIBAgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl +MIIElTCCA32gAwIBAgIBATANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs -c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTcwNDI1MjA1MjIxWhcNMzcwNDIw -MjA1MjIxWjCCAUcxCzAJBgNVBAYTAkZJMWEwXwYDVQQIDFhzdGF0ZSBvciBwcm92 +c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTEwWhcNMzkwMTIy +MTAxMTEwWjCCAUcxCzAJBgNVBAYTAkZJMWEwXwYDVQQIDFhzdGF0ZSBvciBwcm92 aW5jZSB3aXRoaW4gY291bnRyeSwgaW4gb3RoZXIgY2VydGlmaWNhdGVzIGluIHRo aXMgZmlsZSBpdCBpcyB0aGUgc2FtZSBhcyBMMUAwPgYDVQQHDDdsb2NhdGlvbiwg dXN1YWxseSBhbiBhZGRyZXNzIGJ1dCBvZnRlbiBhbWJpZ3VvdXNseSB1c2VkMTQw MgYDVQQKDCtvcmdhbml6YXRpb24gbmFtZSwgdHlwaWNhbGx5IGEgY29tcGFueSBu YW1lMUkwRwYDVQQLDEBvcmdhbml6YXRpb25hbCB1bml0IG5hbWUsIGEgZGl2aXNp b24gbmFtZSB3aXRoaW4gYW4gb3JnYW5pemF0aW9uMRIwEAYDVQQDDAlsb2NhbGhv -c3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMn+gz8LOIkdQxWTXCa5gGVB -vS9jZl7b+jMg2cfhNfMUPMi09wnY9bVEj2t+oKQ7RV/m9A8IZ/haTEnk5TkxaYzP -JXiTpn9Y6ZCcYcsuFLFXshWc6o1vliD+Ke0scbhPH+AFbASxfuC8Qo6/lV6pXsnJ -pGTCH1mUFMIGRHm80mUtAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgEN -BB8WHU9wZW5TU0wgR2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBTLIjvm -2rg9fjlhGDhQyE20yJo+KzAfBgNVHSMEGDAWgBQcxyuqG7G7Lpr0D7GGYFc4wkEF -EjANBgkqhkiG9w0BAQsFAAOCAQEAjrc9zCvlJ0lJWtQ8g5svfRHeaw+0UQLkN9DE -tXtL40KTdTLR60GiJ/5Nka4roIs7f+kbR4Vzn7cFdDTrYhLY8iRqtCRYempVPrpU -+VHeVA4ZBvYBIzIKbIHiV4qeccW6ysMPGNTvVEvh7nw6803Do0Qhn8jvhQGr/ql7 -NgUQJV5huB18QIpdW8G7fHlFboRjtT9R6ZxXAd4tHoXLg/AWbXi7EgGl5aKngPpU -j5pc3hxSor0ASeQEZTD5ufxPlOLYOYm2paUt2yWjDVv54SoTGV7XGjOJW6y9KSba -GpB+CBndWUtQ/UbDC5Ezi8Zw0SIYN6OL04/4aM84juHvrBeIyg== +c3QwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDrfE9Z8EA37Tiy6DBp +TpXJAFnRYDuKqiihIEDuvxzzsKZAjlekeYHJcJ+MPfRcsPlYVdlisktp4RpzvwMO +i8rTDfIS6mgeuPW6KQKwFX92Upp97m1+LPVa0IynyVPYjM7jvse7Sq58+fFtB6w7 +Vc2DPeTvlo6pyRzLhJnPN/VTV+eUeJcSBB/cMfjwv3yb74olAh8bq835vane3+E9 +svuSRJNZq/fCpuEFGUn7+AJdPtBQJlvjJqz7z6vxUgoSNhY9tZ4S88Np4puJcLIx +VpqbkaTGOQFW5LWLNXBO60UbcH0aUi+lNzKArlDQ2kqFajxm50GFyDrdJdhMMoXL +EryBAgMBAAGjezB5MAkGA1UdEwQCMAAwLAYJYIZIAYb4QgENBB8WHU9wZW5TU0wg +R2VuZXJhdGVkIENlcnRpZmljYXRlMB0GA1UdDgQWBBQLGGFmjxJEgWANgNYKap7e +12lWsDAfBgNVHSMEGDAWgBTKcZmJ8HKrdWa7ZWoDBHKle5WmkzANBgkqhkiG9w0B +AQsFAAOCAQEArGsVfWh0nc7i7YCc9ja1VItgONPNQ1yXRBvIbXPiHWpoB7/EDL+u +ufESKBsHbYYujU0cVj7n12Khot6bexqKtH928c/TtbCVkc5+SUUPEaaWa3tCB8yN +KBPSMBlawzEW9gqa182Ob76MqpFAaPpN/58Q1j0nJ1T3ZPp6idlnS2Mr2syV8TAQ +6F7NzkPJcq0ytgbMqQLdTZwAl/yZgIS/41Ra6CylszCOMMs8X3QYQ6NCNlN4Yk8I +VhGAwhIa2nAYEH89FbRzKSZpfTvs+BgB96zCj/I3jY38eIe81MsdwRTHnDvcqf3o +hioyUf6Nic1qnXpvDFJLsk3T3AI5jS0lbg== -----END CERTIFICATE----- diff --git a/mysql-test/std_data/server-key-verify-fail.pem b/mysql-test/std_data/server-key-verify-fail.pem deleted file mode 100644 index af1ae1e3ae1..00000000000 --- a/mysql-test/std_data/server-key-verify-fail.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAvfCda4mh3Nlir1MAlGYdTv33kUDdMRZ1SKdhOAY/v1pNVDgz -1p4g2UHrCFZc4jyx6H0lrsLqQzOo6BhuAKVaUM8BUlaS0Vh5Zc4vFunOHUpaRLqM -GRZPTa3sfslxhuKXvGOUlTEvPhQ45QNQMg/rKp0D1UTeiwRK22POPntmbbE+rNsg -dUl85GfsR7EfimvJLvjf2nqLhe18vfU0nxXTszePdrwaptwSpdi9xQKsufLANDWK -A/zXtvq1rnaduBhaKp2fSYmznflQn+n+tKUPgB7/obcFIRjvCGKvrFjq+x3gonrD -7BEIedjSTLo50MlUksfWKqHuyLs/dEEaTHBjswIDAQABAoIBAQCSUyNzDPydXvsf -hhoUOParPAvU4tuETYDdD9Vdi7Lgf3jDQOjulbNIq/ec3KuBvrBwIrk9APvn+YxO -AUP9S2Vgi5jBDeDdVgNv4n90b3pSJk2UVQJI8V72wN5Ibnf/KeErSKvWo6V5daq/ -AuZtKsZIdd3WFtA62HuyuBjTGc23Alj1C0EKnN0Rx1uBwDvx/OVQ266Us/x8jJqW -ZxIOfcvfNzBQEa5hAzbQCReVaC+rBLRAcMM2yGP7aDa+8cRkwuVlSqpX8CXBdLoU -PqmU49etcW72Rb1AFt9WgEu1Oh9UYbHFSB+FEbO8IGcGBsuYHf9zkxQyjpy/iKyT -H5dTu7YBAoGBAOWqEGepZVrfB+P6X18n3vbJhgYmF0sa0mCmwkFYgk36yNqsZ8at -lQjm5mbn4wjEKHIcQ/T1taq73W471M+PxMnn0WTwoG5jsyarZGgy6/95YXiyZtQe -qgA4P3aKkCteRP22DjG7uxmm9Hoqx8Z31vfRTLAHN1IEHPHHkg/J3gPTAoGBANO4 -aqKeY4vcDvVkvxVbADrw++tZGwA+RuxfO4HKKru59VdA2PsAxhXwb3Dfejwj7hYW -yE9edHjGpMr1+dpf8YJYs7qjajHe1HxBOYqQGHycIdw+Gv56R4HpaS9eW3x8l/Pi -b4xnAodv2qIriACOe7br+rll4wKX46Wt64zdvpShAoGAT0r3HQM0Vjp4u/J+qRjX -9za+yjKuiiS5i9snaG5JlujGHhG2Rrc5pHgsBk17alRnbnZp1BJdZZQ1MFEB+aO2 -mssp1YLqsRJFEU3NfdhO+MaMq6JUtFnd8fN5ndDbU83ZXgtUPUGGqKWm9OL+VHyd -wLQHmSL0q6F16Ngxirf0qjcCgYEAtSmiJVA+gdhk/FmeoBlkEwtNpM50Kjsf2PaM -Jrzk4Al5A5Y7lFvPI8q+sOio4XklKsWH1VJPe2EOdZUQnGlocE6SS+u03MN9Mm1l -XUl7inTXDGwgEQx0z5b4KE4nHlhGdauWI5+pLFbrz8RL9Z32AkneGnIyU2/AnW46 -lijQAMECgYEAmgp/88ndIw49RCtMhYhtXQ87AsEAP6kzXQyKppDkn0os+xI5igIL -i/UDxB33hx3yjrUZwoGDV9MwlMhZNX5Tf5bwjPmmh1NR6KdEpPt5AkklX4s6uil2 -Bxl1P5l1jl/PbEYtv5LDZKIPANWRzViMSIWqjUWlbdqE7/vjx+Oo+cc= ------END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/server-key-verify-pass.pem b/mysql-test/std_data/server-key-verify-pass.pem deleted file mode 100644 index 7ecc44f6d48..00000000000 --- a/mysql-test/std_data/server-key-verify-pass.pem +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEowIBAAKCAQEAwJpG1MA3vp66i/APLsJSGZO+Bxwg41AFq7JChfZXhCELAeXs -RWfCRKNbupnUeJWkFrMYsxnUz6iBInZA8shDIePo6B4MkBDw/xt6xVVvMhBR2+Nj -tODvegRDxVzTw0bl9zMSPpRm2A48U0v1oVbm+P90qi4wtvBSZhFFyBwNPwPnOYZW -FytLvmjwKl8RyIwYAeAccR12SqnnJr0dy4V6FZoSZp3bFXymowdu5wynPPzkyB9k -l2+od50Tw10X8AfwuYvtNOLRLFXiIJGLIXAoC0sg3XlYnlD9qZtxAJg0o5rSxego -GPxAUnx/iQihVJO+WwOJPAghswXyHjnLCh8IBQIDAQABAoIBAHPQUSc9LkgBSks7 -XuXPE28t1+aOk3gcdkx4NGg5aQaal/PcPea+LaL4WAAs4AZidPjxWLjZn43+1SfT -09opcbS/Rx3Mc+FtTn0YGQrwBJ0mExMV+K6bU2Ubi2TyHKQfzciHfUEEG5Nve/ba -hikuCFVRxuVOQRzABcw6NqvNsmlg892lfw6/+RDwMBcz7ocwzmiOUoIxgjyFo9G4 -aJvRmHLij5892H6qveik+A/Xr+8leGQHiQET2wW/F9MFP5ypIT7aeE6remeZH7fG -f4/Zfei/TE4xK2ElNR/91byzeKIVY4vjtTndAiBuqpfYuICb40MC02LNW5Oe6VN2 -3mQ6EgECgYEA7O4ndBnbs/00gyTGyNg6I+3wRTibhNH4R8RZFJiLfKRKOlUiLhUo -+bQeO4bCQ6YY++TYDvMEXTlA3jow9R9Mj2AWc6bNmQmJd/065QyFHftywT66I+V4 -rz1ohSJyHXcv4DxqNk3o3Vb4N8GFjZKcodSgTv2Lk+9ipDYFcQiZop0CgYEA0BrF -SIyLTnjoVht/7RbIGEqhMQUiz5mx7qQ1TPB+YTG77G2xXJNg5d6S7WT4LN+cqbxN -YdndIbW4NdV7bH7FlG9q7jfkuZ+AY2BPU047tcDeyO0HYYEhVY+EyZqHci/26mvt -JrawdqS5HQS1y/rKfytm7YBGTvqoNZHvOHc6aokCgYEAxcjlbJkte+pyzMuFmiJP -HrFBczeXM+BoJ9j0GCpjvvAS+vEYsGl/pDvFRSHwx7I/hv/5kTkzOnNSAHGJbwbq -zYGEHJVxakC43k6pvI2gDnBa0pD/qHmmLnvP5dvkcU6Oy90DOUP+kc9JNJo7V/y8 -/qdWD7q+qwcaTETAdCSexE0CgYA/DN1Y7bwHOnqqHArWOmDFe1b7EyNI4rgWJYpA -lVy09eyJ5XInKj/hZV3+rujCL723b2XCj89/tx7osJWEeaRDJL6xDh4uXzT25uch -xkIw/w6Asc/aqtT+p00EB92hqwaUX76qTA+K4r1zHUo3UvSnMu8sZgDnTOpJ0L05 -zmXUgQKBgDT+IFrAzOty4B0mJncTCC/TulpW704bEZwNJfQSdtiBQr/vqoXygBQc -bHfpncpSfhzHB5lhRUv02TqXgl53D70nM7JD5nx98WYTTBxsbvxPlt4gBRZkfgq5 -tHKclAArc1SbfW5Z8oYyl7h33LQJK116QSyiIIGieH5VXNPwnqUs ------END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/server-key.pem b/mysql-test/std_data/server-key.pem index feb7fbaf535..125c4efa587 100644 --- a/mysql-test/std_data/server-key.pem +++ b/mysql-test/std_data/server-key.pem @@ -1,15 +1,27 @@ -----BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDJ/oM/CziJHUMVk1wmuYBlQb0vY2Ze2/ozINnH4TXzFDzItPcJ -2PW1RI9rfqCkO0Vf5vQPCGf4WkxJ5OU5MWmMzyV4k6Z/WOmQnGHLLhSxV7IVnOqN -b5Yg/intLHG4Tx/gBWwEsX7gvEKOv5VeqV7JyaRkwh9ZlBTCBkR5vNJlLQIDAQAB -AoGAZzoeMJW3arr9kYUhTtj1+MlDuXf+1PNuRbrAERnSzErHVXrF1M5/owdKlBC+ -X6+6oGwSxavyFkVvP0QusK/D1DxSs60Mk1p3Ax5nVpNYiBdeBULcYiXCSUbKItYL -vzyECIc02t+auWf/wp3Wy3g6sU6FoT2QCPSsy0qRC48VBzECQQD79P9w0XjJGk8y -3zPc4JOr3a1UUu4VLjFdFDR2eZZRE02NcXfLHE0+Idk3TYnNDRLoWDJjdfZ0thZZ -KuJ58wIDAkEAzTxGYmT/aieDC3G8sHMqLUvjN30TfTocv7mWlpxWo7zbRbQm7jsB -S5weRKtu3yVmdb6rW+5IZSCazc/j4T5tDwJAUgDRSpTCrSFE+Zevt4nYRi2mBjXf -i0E3i8XRtWWpSMXxjcGKba7ObRRzMA6qdPR2XOynqbtw9Vd2Ops8jthKpQJBAJJm -8tZxsXlqIiLhyXYdUPLq9XS5tlNYRvXFT9S0RWGb8NbyQesjEDN9dGIL4JUxurs3 -fkmf2ui4r3UtXSNqQqUCQQDjatAhBdibh5UawO5VpI87OJMzATCkY/mX3R+TnbOm -MkdydjF022P0M4N24DiM+2nBTDp+F45LwtQLa4vmB2No +MIIEpQIBAAKCAQEA63xPWfBAN+04sugwaU6VyQBZ0WA7iqoooSBA7r8c87CmQI5X +pHmByXCfjD30XLD5WFXZYrJLaeEac78DDovK0w3yEupoHrj1uikCsBV/dlKafe5t +fiz1WtCMp8lT2IzO477Hu0qufPnxbQesO1XNgz3k75aOqckcy4SZzzf1U1fnlHiX +EgQf3DH48L98m++KJQIfG6vN+b2p3t/hPbL7kkSTWav3wqbhBRlJ+/gCXT7QUCZb +4yas+8+r8VIKEjYWPbWeEvPDaeKbiXCyMVaam5GkxjkBVuS1izVwTutFG3B9GlIv +pTcygK5Q0NpKhWo8ZudBhcg63SXYTDKFyxK8gQIDAQABAoIBAADaATt1B/Zr0DGt +b0diNl50tt5v96cnuF/kyvdSD5u9/svq99wraFG/K4SJUNHo/e3Y2aFmvakTXFIg +1bT+wmwC9+YjnN7HknPq5AyY904JPG/KJfE33mdGq8uLidcVo0XlkblWqsze5oWb +an8Ib2bTGXnYVIm+pXEC+L9sF2IGxJP3kWQyFjX1UEp7YDhmtMVm7ONeli3/LPYF +TqWF6ScoI0AexKVo7Jgfx+oDlUASSup90Om07YyjlbIzgiTYPzDqM9XhDQNDaMLJ +zi3N4INohRRG0R/DQ4nqP/YWat6/q1FuRznWdOzzNIR5YrbyFRgX7rMPCjeF3cRt +mK9xKXECgYEA+Qo7ixk0giXZj2ZkJ/OsqT2CnK1jUuJGxtyGCpXbM7hXe8bRq8AA +BVVzLIFR5wY1LKoLYxoMSAn3B1F7y2iVgj7VlBehLTWC2mrsrPse1yRSl8TGOpJB +wP40lfH6/L2mXI4TfnDEgfzkFdpgsHVazpz48A5nSKB+xrJX4JkDos0CgYEA8hEa +GBvwqYum/tMWhYF0YVPXxRUySMYRZX9cW7Mfa/bG2KUyCwIJJipiBe/Zq2AsN917 +wA1TXdnwC3i63iVssPxKKkx1RNpDpNJKzot9oawjhR/OKG/24f6mQJ1W8cX7viT8 +F7IXIX4/drfuDlz4s89NmMRaKuC/mWJfYi77yIUCgYEAkvIUvDi9IOZQfyq9gk1n +3dyriuNMLgXSGVjZxrkxxEzLYf+ojB0YZg1LjkEoIJcrHRWg7nLaOE+Y8TqFPzqQ +rW+B+oYO1mwyr8pTqKXsRqnqCh9TkA/ouIXGZYuIu0T0OryiiALmEIU12Cco0jYM +xMkeohb9nn8FDx0AeUgQOykCgYEArpehL4Rvd4ovf5p2owJ1E4Hqnc6k/xJFF+Td +k5JFdpR+ZWH5DzF/sdRd8RRG9jGekwifqiyyVX3Mgimo9nMdyyWcxJdy+Z9HrMi0 +hfbcPVCwKeN/yXDAK86E0RPq0uVOpp18agbcYh7x3UnaXOe3xdEekbIFqumBqDro +uyNSHRUCgYEAy3xDAESUEXhYGN4WRpWn58Pb0NUsbc/l9P42Z7tog7YmPLpJuY1O +qKW3uwTzxmk65JsiBEsOL7UT7xbq15uaUINC3FRfcMQz7+TW8rUBguVRUjxLTHlx +SlgU3Oxz1oQ/J7GL+x0MxBtTjRW9/7Adv2j1Du8QtlWgr/wOHarPjh4= -----END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/server-new-cert.pem b/mysql-test/std_data/server-new-cert.pem new file mode 100644 index 00000000000..fb203d7c0a2 --- /dev/null +++ b/mysql-test/std_data/server-new-cert.pem @@ -0,0 +1,81 @@ +Certificate: + Data: + Version: 3 (0x2) + Serial Number: 2 (0x2) + Signature Algorithm: sha256WithRSAEncryption + Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB + Validity + Not Before: Jan 27 10:11:10 2019 GMT + Not After : Jan 23 10:11:10 2039 GMT + Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=server-new + Subject Public Key Info: + Public Key Algorithm: rsaEncryption + Public-Key: (2048 bit) + Modulus: + 00:d8:52:35:3e:4b:0e:fe:cc:17:1f:b8:79:5c:35: + d6:a0:e3:c5:11:23:5b:12:7f:c3:a4:4d:0f:35:71: + e1:94:87:49:11:e2:f4:b3:80:dc:33:c0:65:f4:1b: + 24:21:b1:c4:e5:d6:b8:1e:83:f6:3f:6b:7f:aa:2a: + 18:a0:49:6c:87:ee:b4:df:cc:58:19:0f:7f:06:b3: + 93:ce:8c:de:46:69:80:e9:ac:9e:79:05:bd:e2:c6: + bc:80:3f:44:7e:a8:ca:09:72:e3:e4:b0:a4:54:79: + 08:9c:f8:b0:ed:56:3b:21:da:dd:8b:06:12:df:fb: + b6:2e:0e:ca:27:c4:de:8b:55:e2:93:d6:ff:09:aa: + f0:a9:8e:83:be:92:fb:9d:a8:c4:b6:27:e2:63:03: + 3c:0d:6b:4a:05:f9:6f:1c:14:de:f3:c3:ef:60:9f: + b4:21:d6:74:6f:a3:a5:6a:c0:b0:4e:7b:37:95:0d: + f6:43:06:95:cf:c0:93:13:d0:81:83:5a:aa:bf:81: + 98:ca:4f:70:46:79:42:84:12:32:74:e4:7f:4e:84: + 13:83:54:15:49:45:1d:d1:40:bf:e1:5f:11:de:94: + d0:4a:5e:8b:a2:26:03:61:55:41:45:86:45:00:d8: + ea:34:f7:1f:21:64:f7:85:6b:a6:47:3e:f9:81:e4: + a6:6b + Exponent: 65537 (0x10001) + X509v3 extensions: + X509v3 Basic Constraints: + CA:FALSE + Netscape Comment: + OpenSSL Generated Certificate + X509v3 Subject Key Identifier: + 20:CD:11:1F:57:C3:33:FC:17:16:2D:32:48:16:47:B8:0F:42:2D:53 + X509v3 Authority Key Identifier: + keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93 + + Signature Algorithm: sha256WithRSAEncryption + b3:2d:b3:4f:a0:9a:48:ec:a9:06:97:8d:b4:af:93:13:a8:58: + 8f:4e:43:f1:4f:7b:13:59:d5:c6:dc:f0:f7:b8:f2:e8:47:28: + e0:94:2d:cb:d1:de:58:a8:31:e7:41:f1:c3:9b:6e:21:c4:3e: + 2c:56:f7:8b:36:1e:b5:c9:40:aa:15:8b:32:33:29:e6:8e:3c: + a2:db:ad:02:c2:cb:46:fa:4d:2b:43:51:97:00:bc:ad:83:b1: + e9:69:7b:83:31:a8:ce:18:c9:a2:d3:a2:17:f5:f4:b2:3c:59: + 36:2d:6d:ee:21:bd:fa:24:cd:c5:96:26:41:66:6b:8a:ba:ff: + 25:60:44:64:43:f5:4d:df:61:4d:a1:7f:16:27:63:a4:9c:61: + fc:d1:9e:9f:aa:e0:dd:dd:4f:64:2e:89:03:cd:a7:f4:b8:d0: + d7:a5:72:46:fa:33:13:84:0f:a2:e1:fa:9a:a1:e4:6f:f4:30: + fb:30:24:df:ac:d0:52:94:8d:92:3b:26:fe:1d:a0:30:da:23: + 05:3f:ef:f1:79:a8:b7:f9:73:42:5f:da:9d:f8:a8:28:b8:4f: + e3:6e:50:81:46:e1:b4:a1:7e:ec:78:10:8c:be:2e:bc:21:6d: + 1a:78:df:3f:f9:a8:8e:67:0e:b6:cb:1e:fd:ed:d3:28:68:59: + e3:d4:59:a8 +-----BEGIN CERTIFICATE----- +MIIDpjCCAo6gAwIBAgIBAjANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl +cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs +c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTEwWhcNMzkwMTIz +MTAxMTEwWjBaMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV +BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMRMwEQYDVQQDDApzZXJ2ZXIt +bmV3MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2FI1PksO/swXH7h5 +XDXWoOPFESNbEn/DpE0PNXHhlIdJEeL0s4DcM8Bl9BskIbHE5da4HoP2P2t/qioY +oElsh+6038xYGQ9/BrOTzozeRmmA6ayeeQW94sa8gD9EfqjKCXLj5LCkVHkInPiw +7VY7IdrdiwYS3/u2Lg7KJ8Tei1Xik9b/CarwqY6DvpL7najEtifiYwM8DWtKBflv +HBTe88PvYJ+0IdZ0b6OlasCwTns3lQ32QwaVz8CTE9CBg1qqv4GYyk9wRnlChBIy +dOR/ToQTg1QVSUUd0UC/4V8R3pTQSl6LoiYDYVVBRYZFANjqNPcfIWT3hWumRz75 +geSmawIDAQABo3sweTAJBgNVHRMEAjAAMCwGCWCGSAGG+EIBDQQfFh1PcGVuU1NM +IEdlbmVyYXRlZCBDZXJ0aWZpY2F0ZTAdBgNVHQ4EFgQUIM0RH1fDM/wXFi0ySBZH +uA9CLVMwHwYDVR0jBBgwFoAUynGZifByq3Vmu2VqAwRypXuVppMwDQYJKoZIhvcN +AQELBQADggEBALMts0+gmkjsqQaXjbSvkxOoWI9OQ/FPexNZ1cbc8Pe48uhHKOCU +LcvR3lioMedB8cObbiHEPixW94s2HrXJQKoVizIzKeaOPKLbrQLCy0b6TStDUZcA +vK2Dselpe4MxqM4YyaLTohf19LI8WTYtbe4hvfokzcWWJkFma4q6/yVgRGRD9U3f +YU2hfxYnY6ScYfzRnp+q4N3dT2QuiQPNp/S40Nelckb6MxOED6Lh+pqh5G/0MPsw +JN+s0FKUjZI7Jv4doDDaIwU/7/F5qLf5c0Jf2p34qCi4T+NuUIFG4bShfux4EIy+ +LrwhbRp43z/5qI5nDrbLHv3t0yhoWePUWag= +-----END CERTIFICATE----- diff --git a/mysql-test/std_data/server-new-key.pem b/mysql-test/std_data/server-new-key.pem new file mode 100644 index 00000000000..40f6138157d --- /dev/null +++ b/mysql-test/std_data/server-new-key.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpQIBAAKCAQEA2FI1PksO/swXH7h5XDXWoOPFESNbEn/DpE0PNXHhlIdJEeL0 +s4DcM8Bl9BskIbHE5da4HoP2P2t/qioYoElsh+6038xYGQ9/BrOTzozeRmmA6aye +eQW94sa8gD9EfqjKCXLj5LCkVHkInPiw7VY7IdrdiwYS3/u2Lg7KJ8Tei1Xik9b/ +CarwqY6DvpL7najEtifiYwM8DWtKBflvHBTe88PvYJ+0IdZ0b6OlasCwTns3lQ32 +QwaVz8CTE9CBg1qqv4GYyk9wRnlChBIydOR/ToQTg1QVSUUd0UC/4V8R3pTQSl6L +oiYDYVVBRYZFANjqNPcfIWT3hWumRz75geSmawIDAQABAoIBAQDMUdGidejC92g7 ++NUAKIYBz0Ear+dccLsMnBBqbZcg4Cs/LrvsNCFI7EggKeaVwL/2Szn68K+NNW8O +/dXmx5MwTWIgJHVtrjpPzRwlst5baVlu3TGNo8O3x/jRtXBvpeO2ywK/xaxhcTSW +dzs94P3XO0+X+XOohaqMlEGTEJsWxJoSnZGL/QJAqccUEZMQeAkHOGVIDAlynHPi +Y1zE+7QpeoNDKPPUS+niNouloRWJqhps11UhNHMHelXLWkiO78HNfQuMU8RUjzVu +niRQ5cxn3aj2WrFqTtg8UJH0QEEnvpZnk8ptZoMI8lFALDTjCVTIrRS2b5TT2YOz +UB+G0CGhAoGBAPjNUMBMz7uH+a8rIwS3zGEgHmpQY1vBw1uxH/vDdSgY28BXKEMw +4ofGjyT1tXi6sdUFzWHybwCPoaaTb46Vo3G9lZoTX6k9Sp5HatGqa7gJwcU1UjUQ +KLkokmwFi9nupCjOze4cP+uykQME6RBIBDGSeG4kn2ZPhYsXbxI15tz7AoGBAN6U +VOgAu2/EgB/TD7k4Be3uKVgtSSAAmDe4DdT2WdeUYy/YQ5avpvayd1kjlMeybMia +PM27VJr8pXnCcfabvwC9vP5KjX7Z45NeTqgUsY4nGASEQpECVVWjOyL3yyPSUDyG +s4yMsrJ5N4cAFodZ2uvZtdez/Msdrd0Icyqqp0FRAoGBALGyOiVN9uPSRuLz5Sve +dcs8nFyEE6KaLgQT6mru+4Lq1jB2T1xF0tT0XJIiJz0V4iLp5Pk6pEr7SpHlJTzp +5PU8WVfU1HLUQrHvAfzDQfIMjedioNcjNmKf9ovOHkdFaNt4cJ3KcWDOhUFpxWeK +d+xL11WbNHlm/FMOJpcUBlH3AoGBANwto6g1QTWZDp1srjss/kCVvfRqJ9IuhGVp +/tTSNaGaOlwT9RhU/jc/5+wX1I+PIyl12fwx+cmvbwn5nb6z5sgW6aQrn7kCVats +OSbwAYx7g7jEFQ1ZX4ztggxfT2ZKH/Ef1vGMJSGD47f6EE8oRfXVUZrlg4Zx/5GN +UE++rOFhAoGAdjQrHtlHx7woHOwwgnfF6TlSp99TZWLvn+ethpIA8qET+xGAOi8H +gVWSA/Yq9fjc8W2niJG05EB8FbwSaAA6HH13E3B5+KWYGwgC1osSkF/JDKInTilC +/fvUW6clvoXQoJPymwtFpSK5NygJfASujZaAetSQFiG2oAdgQW1rjlY= +-----END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/server8k-cert.pem b/mysql-test/std_data/server8k-cert.pem index df27c77e8e0..a2878516020 100644 --- a/mysql-test/std_data/server8k-cert.pem +++ b/mysql-test/std_data/server8k-cert.pem @@ -1,86 +1,86 @@ Certificate: Data: Version: 3 (0x2) - Serial Number: 2 (0x2) + Serial Number: 3 (0x3) Signature Algorithm: sha256WithRSAEncryption Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB Validity - Not Before: Apr 25 20:52:33 2017 GMT - Not After : Apr 20 20:52:33 2037 GMT + Not Before: Jan 27 10:11:15 2019 GMT + Not After : Jan 22 10:11:15 2039 GMT Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=server8k Subject Public Key Info: Public Key Algorithm: rsaEncryption Public-Key: (8192 bit) Modulus: - 00:b3:a7:81:cf:a3:9b:3c:57:2a:8e:de:13:08:a6: - 15:6a:68:08:ce:a1:a0:ef:fc:32:95:5a:9a:b5:cc: - 84:bb:a3:15:a0:fc:29:bb:71:0e:f3:40:20:97:35: - 92:92:89:36:6a:5f:be:a5:24:5a:c8:0e:f7:53:a8: - e0:74:05:90:38:21:a5:25:72:2b:56:70:74:aa:d6: - 30:25:e0:95:dd:3d:4a:48:4b:25:a7:a8:c4:eb:e5: - d6:10:4f:95:42:91:b0:cb:68:2f:bf:96:0f:0a:9b: - 2b:01:0d:03:ae:3f:b7:7e:f6:1e:c1:14:42:04:7f: - 09:21:e8:3e:87:c0:b3:d7:dd:4f:7e:95:b6:83:33: - 8f:cc:f4:bb:11:8e:66:5f:b4:32:22:8b:8e:34:93: - 82:0f:02:d1:6f:85:b2:a7:7e:36:0c:f3:0d:91:46: - f9:a5:91:dc:60:4a:0d:eb:e5:37:e3:76:d8:13:bb: - 55:33:23:4c:b3:90:df:6a:b6:80:3d:f6:bd:9d:bd: - ef:d3:8d:7a:9a:61:ac:02:3d:10:b5:c2:53:d2:7e: - ee:1c:90:a5:b0:e8:db:71:8f:d3:53:e4:80:b0:b6: - cc:b0:f2:eb:46:c3:d9:3c:48:01:1d:3a:5c:d0:f2: - 17:9c:9a:8e:fc:2a:36:e7:1c:59:41:66:ad:e1:d3: - 82:d8:95:ee:ae:dc:ab:72:94:cb:0b:8a:df:ef:70: - f7:f9:e2:77:76:64:67:2d:02:dc:1a:db:02:e9:5e: - 63:3f:3e:07:e9:65:e4:02:78:62:55:e1:52:18:5a: - a3:9c:56:dd:cd:d3:f7:f2:55:45:62:20:ce:fd:41: - 93:b9:c2:20:90:23:a4:41:4f:30:5c:5e:a0:97:6f: - a4:1f:87:6a:97:87:70:f9:d5:56:b7:6a:cc:f1:28: - d2:26:34:57:65:9c:2d:41:43:8b:6c:bd:15:6f:ec: - ce:3e:9f:4d:2f:a6:21:d8:f7:4d:d1:63:4f:f0:9e: - 04:c3:82:33:58:34:20:4b:81:0d:42:0d:44:62:48: - 1b:4c:cf:e0:69:e4:c8:f8:9c:98:1f:74:37:3a:3f: - 23:40:3a:88:80:c2:9c:9b:ba:6a:b9:2c:3a:67:a6: - b6:5c:83:fd:93:3f:6e:53:19:48:e3:3d:fa:f5:8e: - 03:40:8f:e6:af:c5:de:aa:f8:70:77:36:2b:6e:3a: - df:bc:d7:f6:c7:4f:02:7f:a1:ad:2f:3c:e9:08:45: - 2f:57:1a:f1:5b:9c:27:07:3a:44:43:3e:05:b1:4a: - 1b:42:a4:90:ab:ce:4b:f7:c1:9b:d7:dd:6f:05:11: - f9:e8:a3:a1:99:6c:2e:27:3d:b1:54:6f:eb:b2:e8: - f8:e6:12:6f:8a:69:05:cc:c6:f6:c4:2d:b0:06:b6: - 21:50:28:50:dc:8c:b2:8c:65:ce:d9:2b:51:b8:62: - 56:70:b4:46:4d:e4:4c:a1:86:31:3d:e3:07:7f:73: - e3:09:6e:ee:a7:29:2a:80:23:8a:b6:0c:22:9e:43: - 1c:a9:8c:47:2c:02:6d:13:ef:88:a7:d7:d1:60:d9: - 6b:28:80:97:8a:b7:ff:62:6b:28:54:0d:ab:63:3a: - ac:57:9e:2f:95:2b:f4:a0:3d:a1:60:a0:57:1a:09: - 23:ee:fc:4d:9b:45:83:f2:0a:1f:b3:77:0e:98:20: - b3:16:fc:97:03:30:fc:ab:3e:7e:fc:3e:76:64:cb: - 4b:4d:c9:6c:8f:aa:70:ec:03:c5:81:31:43:11:9a: - fc:2d:ba:25:94:0b:73:7e:c1:39:01:ca:68:70:1a: - ef:a4:ba:dc:13:d6:37:17:09:0d:ca:aa:21:94:bb: - 3e:43:fd:8c:80:e6:58:fd:75:23:5a:ca:1f:0b:2e: - 35:c2:cd:77:0c:73:b3:2f:9a:e4:03:68:58:c8:3f: - f3:76:8d:05:53:d2:34:db:09:af:70:ed:67:0b:ff: - 2f:64:35:2d:71:22:7a:f2:f2:2b:7d:6d:be:80:bd: - 18:38:37:01:67:a4:5f:48:29:52:78:9f:b5:b8:80: - 70:ca:10:6a:e1:27:3b:c0:61:4e:96:f8:e8:0f:42: - b1:fa:bc:05:ef:31:91:38:ab:0f:a7:ef:2c:86:c1: - ab:85:36:7c:10:9d:c7:0a:6b:e6:2b:11:dd:fa:45: - e7:d2:c3:3a:c1:cd:60:27:68:26:d7:87:49:5f:e3: - 7f:26:20:1f:99:a8:f9:00:a6:0d:d5:13:81:6e:fc: - 27:8a:03:58:6b:0e:3a:c7:20:a1:5c:24:d1:08:a6: - 5a:1e:e7:81:3d:21:05:2e:4b:5d:18:14:f1:4f:ab: - 5c:e5:81:da:c1:2c:f6:12:ff:25:09:97:1e:9d:51: - 6d:1f:63:2e:9c:ed:7d:86:45:b0:35:73:f6:9f:82: - 65:bc:7f:46:88:e1:a1:60:a1:37:50:26:9c:d7:76: - f3:dc:94:89:6d:d7:be:a6:17:a1:2b:71:14:37:17: - 5f:ed:5a:39:99:fc:69:af:bb:63:55:c6:60:7b:64: - d8:bb:b7:4a:9f:b9:aa:89:4b:30:1f:9c:ef:23:7a: - af:7e:31:dd:fb:dd:0a:d5:04:0a:8c:57:6f:64:80: - eb:f3:ee:6c:33:d2:72:c2:24:68:a2:4e:99:88:1c: - f7:3b:5d:10:cc:4e:ea:a5:cb:00:40:8a:a9:63:2e: - 18:92:eb:b1:28:05:fe:19:ea:7b:32:fb:63:56:2c: - 0b:20:01:92:a3 + 00:b9:f5:78:46:53:e0:3c:07:bf:97:fb:ab:be:97: + 71:d5:89:44:bf:db:0e:58:be:96:42:06:9e:dc:08: + f7:51:d6:27:7f:65:2d:c7:1e:f7:4c:5b:3f:e5:7a: + f8:fd:df:73:42:92:0f:37:5e:28:ae:51:14:13:be: + b3:55:d4:db:9a:f6:a9:88:84:02:79:fb:f9:c4:67: + f9:96:99:68:80:58:4a:22:c4:a1:90:c0:33:58:c8: + 96:d1:a4:7f:7f:9e:84:a6:f3:03:a3:01:93:cb:1d: + ab:f1:f5:17:28:03:34:78:6d:47:46:07:ab:f8:ea: + ff:02:8a:f8:20:92:a2:ce:29:6a:66:d0:39:87:2f: + 62:9f:43:d9:a3:0b:74:89:ab:f7:d9:39:7d:6c:de: + 05:4e:58:4d:35:15:d4:18:2d:ea:70:df:60:fc:50: + f8:0d:b5:8e:c0:c6:03:74:3b:8d:53:d6:87:a2:9a: + b6:0a:5a:80:a5:cc:df:30:a7:95:30:ad:50:62:e1: + 01:3a:8e:ee:e1:41:b4:99:ee:ce:8b:ca:55:24:3e: + 7c:00:79:08:f4:46:42:e0:63:93:a3:d0:5a:39:fc: + 7e:f4:96:21:24:9a:f7:29:0d:22:85:b6:c5:c9:9c: + 92:71:68:5b:03:de:fb:bc:75:f8:0f:24:ea:01:92: + b7:37:e0:78:a0:64:37:69:90:8a:7c:99:c7:45:f9: + 90:a2:50:59:e1:1c:02:ad:b2:2e:c7:3b:26:ec:76: + 6d:10:c9:f9:2f:dc:12:87:41:72:08:ec:0a:1c:ae: + 9b:6f:de:57:a4:aa:b9:ee:83:a4:14:c4:e5:54:66: + 32:5d:21:2a:a3:6d:2d:8d:f5:8e:08:a2:a3:0d:07: + 83:4b:0a:27:0b:9c:7f:73:78:f8:d9:9c:1e:d4:33: + 2b:a7:35:b4:77:5e:12:d6:a6:a4:d2:d0:af:30:b6: + d5:1f:05:9b:1e:e6:ae:c8:a5:8c:b6:b7:dc:c3:0b: + 1a:85:5a:d5:bd:be:65:c8:e6:a5:f0:37:38:16:d2: + b0:ca:ff:2e:a1:f2:7f:8e:28:c5:9c:d4:de:be:1f: + 23:43:51:85:f9:e5:fb:a8:61:61:96:50:34:ad:75: + 34:fa:46:e9:2a:66:1a:43:9c:e4:e5:79:26:b7:0b: + 5d:d1:1d:81:c6:52:17:d7:95:13:9e:65:64:9b:2d: + 0d:2b:7a:04:28:aa:02:df:81:0c:f3:83:3d:76:ad: + 40:e6:f8:c0:b2:f3:0a:b2:cc:e8:f2:c8:ac:21:c4: + 90:7d:4c:b6:50:d8:b7:0a:15:12:5f:a5:e0:c5:68: + 8f:ed:4d:f4:d9:b5:72:df:63:c9:d6:14:fe:d8:fc: + db:31:72:1e:15:d5:e8:ac:d9:a7:d2:0a:bc:a7:a6: + 51:5f:0d:0f:23:20:2d:34:ba:44:66:f6:81:e3:aa: + fe:38:11:61:ec:03:3f:64:6f:93:f5:2d:b0:be:7d: + 6f:49:73:c6:23:67:7b:46:da:62:67:10:e4:e6:a1: + e4:1b:50:0f:ff:50:51:0a:dc:ee:1b:e3:ed:20:30: + 3a:c1:37:17:24:96:fa:fe:2e:d0:75:b3:9b:c1:ae: + 15:ac:ba:fe:b4:d5:33:ff:33:86:f3:5e:24:f7:45: + 8d:ad:b0:47:6a:ef:9c:0e:f7:07:0e:71:a0:e7:75: + 4a:42:59:02:b7:11:86:d6:65:77:06:3a:f5:6f:99: + 3b:9b:52:cf:e6:30:59:e3:28:19:8e:c2:5f:e1:f7: + 28:74:ff:c2:d1:35:91:96:ed:52:14:4a:3c:91:19: + 50:7b:3e:04:65:f8:3e:d9:6c:29:cf:74:d8:0f:df: + e4:cd:94:73:81:ef:19:9e:4b:0c:3e:2e:24:fd:a9: + c6:73:b5:7c:ed:d1:0e:72:ac:c9:fe:5e:a6:2d:d7: + 7f:ca:c5:75:18:cb:3e:27:62:20:cf:10:c1:7f:d3: + 6f:a9:d4:78:98:3b:f6:0c:e0:5f:54:b3:0b:0a:36: + d7:59:34:c3:70:5c:59:25:cf:54:e0:7f:ec:a3:3b: + c4:a1:6f:be:1e:be:e1:36:c6:d3:26:bd:86:ae:0e: + 73:26:89:3c:7f:72:a1:2d:00:66:b1:e2:e0:74:72: + 86:12:c2:6b:e4:e7:99:70:bb:98:81:c3:44:65:c5: + 76:21:62:f1:af:31:aa:73:be:fb:b0:86:a6:5b:e2: + 51:78:e6:6a:1b:58:3f:4a:34:e6:99:88:e4:1c:b1: + 80:94:f2:31:a0:b0:27:81:b1:18:98:6f:53:2e:74: + a0:c3:2d:e7:f6:92:27:80:40:a4:f3:3a:e2:ad:84: + 64:82:ed:80:3f:e0:54:e8:3d:ec:75:25:21:2a:2f: + 4f:08:61:be:b6:e0:fb:bd:ec:7e:3b:17:d2:a4:bb: + b8:f8:3f:9a:2e:12:eb:b2:00:45:51:3a:99:53:6e: + b5:06:5e:8b:8f:0a:b5:61:2c:12:10:60:4d:2c:de: + 6e:e8:80:f8:99:b2:8b:36:61:33:88:08:60:4f:30: + ff:61:d2:cc:02:75:5d:d7:8d:06:e0:bd:e3:e0:35: + f7:ba:f8:a6:e4:14:79:e4:62:4d:bf:ea:81:fe:1e: + 01:24:69:da:89:1a:c1:11:3c:50:f1:a3:b3:27:df: + cc:16:3a:03:97:88:a4:92:63:a6:8e:c9:18:f5:02: + 16:a7:b2:a5:3d:f7:12:00:e4:e1:55:96:16:84:6e: + 03:70:3d:ce:4b Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Basic Constraints: @@ -88,61 +88,61 @@ Certificate: Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: - 43:3B:26:15:A5:60:62:3F:07:2A:8C:8C:DA:F8:74:BE:36:B2:33:E4 + 74:34:B9:9A:5C:1A:27:83:BA:0D:05:F9:5B:5B:A6:F6:BB:1A:8C:E8 X509v3 Authority Key Identifier: - keyid:1C:C7:2B:AA:1B:B1:BB:2E:9A:F4:0F:B1:86:60:57:38:C2:41:05:12 + keyid:CA:71:99:89:F0:72:AB:75:66:BB:65:6A:03:04:72:A5:7B:95:A6:93 Signature Algorithm: sha256WithRSAEncryption - 5c:c7:4e:56:eb:21:1b:f3:5d:c4:56:fa:bf:6d:e1:0d:fa:cc: - b0:7c:13:58:b9:d4:47:b3:de:b4:ae:f2:45:02:88:65:43:89: - cf:ea:9c:d0:ea:45:42:35:d2:ec:bc:b4:73:03:db:85:7b:c7: - f0:68:d7:dc:2b:70:71:63:ed:33:68:9f:29:ff:67:0a:69:3b: - c4:65:7c:25:00:cf:7f:ee:aa:fe:44:19:70:f2:74:db:da:9f: - 52:92:1a:03:e6:0a:49:85:2e:2a:02:c1:81:d4:6d:cf:98:d1: - e9:6a:2f:bb:fa:a6:d5:4b:55:38:c2:aa:8c:f5:d3:f9:e6:74: - db:00:d6:29:f9:d1:9c:7a:0e:98:c5:e5:8c:16:49:d8:cf:ee: - a0:cb:c2:2c:31:cf:62:2c:b1:7f:6d:60:b0:ce:d5:07:45:e8: - 44:17:7c:c4:12:fb:00:57:24:57:e8:17:78:3b:1e:0d:91:aa: - 67:98:d0:e5:9a:86:4b:88:4a:2f:55:5d:2e:13:ec:f5:4a:7d: - e7:13:a7:57:03:41:2f:f6:6c:08:8e:58:ef:b0:7a:79:32:e3: - bb:4b:eb:4d:42:cd:42:96:2d:67:f6:4c:c1:f6:62:fb:c0:3e: - 09:69:8f:36:7e:fa:c8:cd:ff:72:3e:df:92:f7:8f:44:cf:77: - fe:6e:74:de + e6:e4:75:22:6c:5c:ea:f3:3c:85:1e:3c:62:a4:9b:bc:52:49: + 2a:dd:dd:7e:94:c9:1b:c9:7e:4f:f2:82:ce:68:a2:17:29:b7: + 73:0b:39:33:ca:86:c4:51:ad:d9:18:e7:c2:42:b8:c3:a9:4c: + 8f:54:24:79:f2:27:9e:5b:aa:e5:bc:36:eb:11:b5:91:4b:7b: + 79:b9:41:b0:d9:72:53:fb:ad:67:7e:7a:7e:0d:06:9e:45:7e: + f6:5f:5b:c4:77:1d:d1:e5:d7:7f:8e:f6:64:2a:7e:14:87:f4: + b4:a4:13:50:47:f7:49:b2:ad:36:c0:27:15:eb:c0:91:f0:e0: + 77:bc:93:f3:db:01:69:10:c0:9c:e1:5b:03:9b:1d:ac:3d:0c: + cc:65:24:93:d6:8d:dc:aa:d7:d5:74:7d:0b:2a:6c:ec:c1:ad: + 2d:83:56:aa:28:94:9e:e2:54:98:1c:28:bd:45:63:e5:6a:00: + 20:ab:41:83:31:05:8d:38:ea:bb:35:ad:3b:28:46:44:47:3d: + f6:88:2e:ac:46:73:8e:13:0d:8d:5c:44:2b:0a:e3:bb:27:e3: + ce:5b:f6:3c:fc:e4:86:95:0b:46:87:f7:89:ab:36:7b:3e:78: + 1d:be:04:aa:fa:f0:2c:fd:a7:15:ea:1e:35:bf:3c:33:3c:b7: + b8:4f:1b:db -----BEGIN CERTIFICATE----- -MIIGpDCCBYygAwIBAgIBAjANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl +MIIGpDCCBYygAwIBAgIBAzANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs -c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTcwNDI1MjA1MjMzWhcNMzcwNDIw -MjA1MjMzWjBYMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV +c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTE1WhcNMzkwMTIy +MTAxMTE1WjBYMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMREwDwYDVQQDDAhzZXJ2ZXI4 -azCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBALOngc+jmzxXKo7eEwim -FWpoCM6hoO/8MpVamrXMhLujFaD8KbtxDvNAIJc1kpKJNmpfvqUkWsgO91Oo4HQF -kDghpSVyK1ZwdKrWMCXgld09SkhLJaeoxOvl1hBPlUKRsMtoL7+WDwqbKwENA64/ -t372HsEUQgR/CSHoPofAs9fdT36VtoMzj8z0uxGOZl+0MiKLjjSTgg8C0W+Fsqd+ -NgzzDZFG+aWR3GBKDevlN+N22BO7VTMjTLOQ32q2gD32vZ2979ONepphrAI9ELXC -U9J+7hyQpbDo23GP01PkgLC2zLDy60bD2TxIAR06XNDyF5yajvwqNuccWUFmreHT -gtiV7q7cq3KUywuK3+9w9/nid3ZkZy0C3BrbAuleYz8+B+ll5AJ4YlXhUhhao5xW -3c3T9/JVRWIgzv1Bk7nCIJAjpEFPMFxeoJdvpB+HapeHcPnVVrdqzPEo0iY0V2Wc -LUFDi2y9FW/szj6fTS+mIdj3TdFjT/CeBMOCM1g0IEuBDUINRGJIG0zP4GnkyPic -mB90Nzo/I0A6iIDCnJu6arksOmemtlyD/ZM/blMZSOM9+vWOA0CP5q/F3qr4cHc2 -K24637zX9sdPAn+hrS886QhFL1ca8VucJwc6REM+BbFKG0KkkKvOS/fBm9fdbwUR -+eijoZlsLic9sVRv67Lo+OYSb4ppBczG9sQtsAa2IVAoUNyMsoxlztkrUbhiVnC0 -Rk3kTKGGMT3jB39z4wlu7qcpKoAjirYMIp5DHKmMRywCbRPviKfX0WDZayiAl4q3 -/2JrKFQNq2M6rFeeL5Ur9KA9oWCgVxoJI+78TZtFg/IKH7N3Dpggsxb8lwMw/Ks+ -fvw+dmTLS03JbI+qcOwDxYExQxGa/C26JZQLc37BOQHKaHAa76S63BPWNxcJDcqq -IZS7PkP9jIDmWP11I1rKHwsuNcLNdwxzsy+a5ANoWMg/83aNBVPSNNsJr3DtZwv/ -L2Q1LXEievLyK31tvoC9GDg3AWekX0gpUniftbiAcMoQauEnO8BhTpb46A9Csfq8 -Be8xkTirD6fvLIbBq4U2fBCdxwpr5isR3fpF59LDOsHNYCdoJteHSV/jfyYgH5mo -+QCmDdUTgW78J4oDWGsOOscgoVwk0QimWh7ngT0hBS5LXRgU8U+rXOWB2sEs9hL/ -JQmXHp1RbR9jLpztfYZFsDVz9p+CZbx/RojhoWChN1AmnNd289yUiW3XvqYXoStx -FDcXX+1aOZn8aa+7Y1XGYHtk2Lu3Sp+5qolLMB+c7yN6r34x3fvdCtUECoxXb2SA -6/PubDPScsIkaKJOmYgc9ztdEMxO6qXLAECKqWMuGJLrsSgF/hnqezL7Y1YsCyAB -kqMCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBH -ZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFEM7JhWlYGI/ByqMjNr4dL42 -sjPkMB8GA1UdIwQYMBaAFBzHK6obsbsumvQPsYZgVzjCQQUSMA0GCSqGSIb3DQEB -CwUAA4IBAQBcx05W6yEb813EVvq/beEN+sywfBNYudRHs960rvJFAohlQ4nP6pzQ -6kVCNdLsvLRzA9uFe8fwaNfcK3BxY+0zaJ8p/2cKaTvEZXwlAM9/7qr+RBlw8nTb -2p9SkhoD5gpJhS4qAsGB1G3PmNHpai+7+qbVS1U4wqqM9dP55nTbANYp+dGceg6Y -xeWMFknYz+6gy8IsMc9iLLF/bWCwztUHRehEF3zEEvsAVyRX6Bd4Ox4NkapnmNDl -moZLiEovVV0uE+z1Sn3nE6dXA0Ev9mwIjljvsHp5MuO7S+tNQs1Cli1n9kzB9mL7 -wD4JaY82fvrIzf9yPt+S949Ez3f+bnTe +azCCBCIwDQYJKoZIhvcNAQEBBQADggQPADCCBAoCggQBALn1eEZT4DwHv5f7q76X +cdWJRL/bDli+lkIGntwI91HWJ39lLcce90xbP+V6+P3fc0KSDzdeKK5RFBO+s1XU +25r2qYiEAnn7+cRn+ZaZaIBYSiLEoZDAM1jIltGkf3+ehKbzA6MBk8sdq/H1FygD +NHhtR0YHq/jq/wKK+CCSos4pambQOYcvYp9D2aMLdImr99k5fWzeBU5YTTUV1Bgt +6nDfYPxQ+A21jsDGA3Q7jVPWh6KatgpagKXM3zCnlTCtUGLhATqO7uFBtJnuzovK +VSQ+fAB5CPRGQuBjk6PQWjn8fvSWISSa9ykNIoW2xcmcknFoWwPe+7x1+A8k6gGS +tzfgeKBkN2mQinyZx0X5kKJQWeEcAq2yLsc7Jux2bRDJ+S/cEodBcgjsChyum2/e +V6Sque6DpBTE5VRmMl0hKqNtLY31jgiiow0Hg0sKJwucf3N4+NmcHtQzK6c1tHde +EtampNLQrzC21R8Fmx7mrsiljLa33MMLGoVa1b2+ZcjmpfA3OBbSsMr/LqHyf44o +xZzU3r4fI0NRhfnl+6hhYZZQNK11NPpG6SpmGkOc5OV5JrcLXdEdgcZSF9eVE55l +ZJstDSt6BCiqAt+BDPODPXatQOb4wLLzCrLM6PLIrCHEkH1MtlDYtwoVEl+l4MVo +j+1N9Nm1ct9jydYU/tj82zFyHhXV6KzZp9IKvKemUV8NDyMgLTS6RGb2geOq/jgR +YewDP2Rvk/UtsL59b0lzxiNne0baYmcQ5Oah5BtQD/9QUQrc7hvj7SAwOsE3FySW ++v4u0HWzm8GuFay6/rTVM/8zhvNeJPdFja2wR2rvnA73Bw5xoOd1SkJZArcRhtZl +dwY69W+ZO5tSz+YwWeMoGY7CX+H3KHT/wtE1kZbtUhRKPJEZUHs+BGX4PtlsKc90 +2A/f5M2Uc4HvGZ5LDD4uJP2pxnO1fO3RDnKsyf5epi3Xf8rFdRjLPidiIM8QwX/T +b6nUeJg79gzgX1SzCwo211k0w3BcWSXPVOB/7KM7xKFvvh6+4TbG0ya9hq4OcyaJ +PH9yoS0AZrHi4HRyhhLCa+TnmXC7mIHDRGXFdiFi8a8xqnO++7CGplviUXjmahtY +P0o05pmI5ByxgJTyMaCwJ4GxGJhvUy50oMMt5/aSJ4BApPM64q2EZILtgD/gVOg9 +7HUlISovTwhhvrbg+73sfjsX0qS7uPg/mi4S67IARVE6mVNutQZei48KtWEsEhBg +TSzebuiA+JmyizZhM4gIYE8w/2HSzAJ1XdeNBuC94+A197r4puQUeeRiTb/qgf4e +ASRp2okawRE8UPGjsyffzBY6A5eIpJJjpo7JGPUCFqeypT33EgDk4VWWFoRuA3A9 +zksCAwEAAaN7MHkwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNTTCBH +ZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFHQ0uZpcGieDug0F+Vtbpva7 +GozoMB8GA1UdIwQYMBaAFMpxmYnwcqt1ZrtlagMEcqV7laaTMA0GCSqGSIb3DQEB +CwUAA4IBAQDm5HUibFzq8zyFHjxipJu8Ukkq3d1+lMkbyX5P8oLOaKIXKbdzCzkz +yobEUa3ZGOfCQrjDqUyPVCR58ieeW6rlvDbrEbWRS3t5uUGw2XJT+61nfnp+DQae +RX72X1vEdx3R5dd/jvZkKn4Uh/S0pBNQR/dJsq02wCcV68CR8OB3vJPz2wFpEMCc +4VsDmx2sPQzMZSST1o3cqtfVdH0LKmzswa0tg1aqKJSe4lSYHCi9RWPlagAgq0GD +MQWNOOq7Na07KEZERz32iC6sRnOOEw2NXEQrCuO7J+POW/Y8/OSGlQtGh/eJqzZ7 +PngdvgSq+vAs/acV6h41vzwzPLe4Txvb -----END CERTIFICATE----- diff --git a/mysql-test/std_data/server8k-key.pem b/mysql-test/std_data/server8k-key.pem index a383b359275..2dba202dfa0 100644 --- a/mysql-test/std_data/server8k-key.pem +++ b/mysql-test/std_data/server8k-key.pem @@ -1,99 +1,99 @@ -----BEGIN RSA PRIVATE KEY----- -MIISKAIBAAKCBAEAs6eBz6ObPFcqjt4TCKYVamgIzqGg7/wylVqatcyEu6MVoPwp -u3EO80AglzWSkok2al++pSRayA73U6jgdAWQOCGlJXIrVnB0qtYwJeCV3T1KSEsl -p6jE6+XWEE+VQpGwy2gvv5YPCpsrAQ0Drj+3fvYewRRCBH8JIeg+h8Cz191PfpW2 -gzOPzPS7EY5mX7QyIouONJOCDwLRb4Wyp342DPMNkUb5pZHcYEoN6+U343bYE7tV -MyNMs5DfaraAPfa9nb3v0416mmGsAj0QtcJT0n7uHJClsOjbcY/TU+SAsLbMsPLr -RsPZPEgBHTpc0PIXnJqO/Co25xxZQWat4dOC2JXurtyrcpTLC4rf73D3+eJ3dmRn -LQLcGtsC6V5jPz4H6WXkAnhiVeFSGFqjnFbdzdP38lVFYiDO/UGTucIgkCOkQU8w -XF6gl2+kH4dql4dw+dVWt2rM8SjSJjRXZZwtQUOLbL0Vb+zOPp9NL6Yh2PdN0WNP -8J4Ew4IzWDQgS4ENQg1EYkgbTM/gaeTI+JyYH3Q3Oj8jQDqIgMKcm7pquSw6Z6a2 -XIP9kz9uUxlI4z369Y4DQI/mr8XeqvhwdzYrbjrfvNf2x08Cf6GtLzzpCEUvVxrx -W5wnBzpEQz4FsUobQqSQq85L98Gb191vBRH56KOhmWwuJz2xVG/rsuj45hJvimkF -zMb2xC2wBrYhUChQ3IyyjGXO2StRuGJWcLRGTeRMoYYxPeMHf3PjCW7upykqgCOK -tgwinkMcqYxHLAJtE++Ip9fRYNlrKICXirf/YmsoVA2rYzqsV54vlSv0oD2hYKBX -Ggkj7vxNm0WD8gofs3cOmCCzFvyXAzD8qz5+/D52ZMtLTclsj6pw7APFgTFDEZr8 -LbollAtzfsE5AcpocBrvpLrcE9Y3FwkNyqohlLs+Q/2MgOZY/XUjWsofCy41ws13 -DHOzL5rkA2hYyD/zdo0FU9I02wmvcO1nC/8vZDUtcSJ68vIrfW2+gL0YODcBZ6Rf -SClSeJ+1uIBwyhBq4Sc7wGFOlvjoD0Kx+rwF7zGROKsPp+8shsGrhTZ8EJ3HCmvm -KxHd+kXn0sM6wc1gJ2gm14dJX+N/JiAfmaj5AKYN1ROBbvwnigNYaw46xyChXCTR -CKZaHueBPSEFLktdGBTxT6tc5YHawSz2Ev8lCZcenVFtH2MunO19hkWwNXP2n4Jl -vH9GiOGhYKE3UCac13bz3JSJbde+phehK3EUNxdf7Vo5mfxpr7tjVcZge2TYu7dK -n7mqiUswH5zvI3qvfjHd+90K1QQKjFdvZIDr8+5sM9JywiRook6ZiBz3O10QzE7q -pcsAQIqpYy4YkuuxKAX+Gep7MvtjViwLIAGSowIDAQABAoIEAG18dDwatQx9As62 -wFrQ/NQwOs3S6sXWqO0knoyU639+0Duf8b7uE/Ji7nm4iG8NeEAzwXfbRAgQNuKh -VMjgaxgKSR8dCRRQzIkgp48t46dFJvQP+A7JZ9lr5J1kIs7DAz+zawYTaW9JSVgG -mmujIS0ayXtZ4THkSaiEZTdOVUwE7+FxVB15WvXJYAg/BFzm8HblHfEkxGppiUGx -9ULmRAJ4TZhv7Mzeq7Ny7jEJLJpPXzgHPtE/fgshC0d5mYYpzT1I99OxsTpMtAtZ -M8nReEwcVvjJnnDGOJZo1J2X8GXBwdVE9eXWjZmTODqbytz77S/fcaxz/amzOSIG -dYne4SsllKS0jzfxPhz2saq26ik7vxpD7i0cRQ+I0alvgISWRTQUiHSI8UTtYJ6+ -/l7VAa/isoTZOsOmwv7M7D6U9EtjrUKwBAUHFk+0Fg2w9WELhep7/bEiQWvnOMtX -sruWBm5zv5CxW1MuujKn2t5jHNWhQaeOIrW9V6Hew3PJsLTTHUVX2Ikc8KZLObTP -XTtGE993cADrYYxPH8l40QCHB2t6bM2maBTRy8PlMFMsYaM7rqnftlOuXyRYLm97 -oO7F8InpD1mDND4bBKbL3UOgl1QW9dbb8KOn8pERDXD9Z3K4ewyORiyuONXxBAz2 -QiaQ4gDJWD6sEySPEHcpDjemi6mKJFtDw935JxS2brso/NHoJSVdcNxisd2irA8P -U8jyFTrTm7cO0nKFx9vv9r5dsbkqyQnJ9V0q4/DoWvnkPElKuvTeJMw6CvTjfvc1 -xIf8m3MQJTN8pqPpIOSj8DIhQIJBEVxtcajg+vlMuefR8hTCdLzQV2QEdLGjNGph -OhFuHrHw1b3I4nCyi9MOLzpdUDgZkaw4hPg38u71RJ6bUF6pE89Yj04/svB7SZgA -sE8+/pZcASZl1Y0T29OM3qFJvukBWwsNij5P5SLmTXDev+DXbzUvmVLCk8nJkJ5m -n1peGst0ApHnEzxVhU+9d5FWBdIgN7fp7V2AlFt1r0TRWUYndBn9/B6xiyfd5iyK -LpcbRjLpQ/9b3SYQZL9t65Hc40rP35rY0luQTzVd6E/D041E0NWdpAZai4GrpMKp -NUBXBbmwnCZEzExLi78We6aF5tG9Vh+uxyYUXlrABR98jONgYIvnWaATaw6oLgam -B84RhWUa1f+K70wrTorUO8QNvYO2n4jpwJikn4H9pFvvzzoOB7RaA+EF4HjaVmQr -Jm6S18c7sksYFGIJYsPrXMtgOMQVYiQ3s8LDgsWKoEQYgvgxE24AoXGlXXbALrpo -4WvRN7qLAm3n2OQYFUK0SGoELOADQFQhbNL91i0k4wzQ56ofQCb8aTmm3q76TnbK -4gmIUIECggIBAOm3PhMqIKb3ZEZOWYMKByb7v8seuVh6mwXmgITcZIiA2f8rTfyH -OZanYK72FsuGZEbf1ELwNUX0JobwklA1Uq9NajaJUdfe4wDpghf282APHK1nD3m3 -FX7Rsoof/dW9+bV/IIbQDwy+1ctB20m6dejt3kWyHSXly2y2L3bk1flee8oi+VCO -ROp4u23KJcglIYlL+cL1z76lX41v8JW3deCTL/JStmK6zuvFhY5fTlOGxsLhAY3X -VTZ0MNUpezlBaXTixi7ilgbh7rJSpCmeno5my1hdl/5Q5U/u5F5E7ZxKxlhuVWdA -cf9qbtolSsgJ2w8axPD3dLnQ6wsNnl4yL77TdNr8OlbwIADXHH9VzZbfEgOhP4r9 -Cwz4hIUbylJ9QGZVsEVZhvqR3M6OgqlYOmC72nLPXVYbL/Rr7cTx8t+WJ4wJRP3l -pi6AgDZXKbMKyMIhM1IscSR2swtAFyl6g6rcAjFyG+p1IKMOQ3YOqdVVUf5UYSpo -NBTpJ+ho3CyQJK25yT2Maex5Q91M6Rk9vmXaIs+K40t/zu8cnCIH9j3In0BrpSi7 -WUyLgzXW+7ZrW7cugC93VVgjGNbgBiDimZ5duViI+xY+3OlrsUxzSHN+YY+8H2G2 -TfzT+Mgo8lJXH9tseFBLvRKhoPbbCyCwnOJ6k2k8/iqZ2eE7vQodyW/zAoICAQDE -yK5Mlu0k3oTVasgYRNDYKJ9uyarVLaRcN6UjzNUSta2hABzQe/LG895EucK9yVa0 -4jT7EXILYQpHnQkaYtyHtN/deYWLRObT6RMws7te2MhwzQkaNavgi449dHP38TPS -qy3Vh6v4nMhRjkhLqNiiJoDWThtkB216t+71GxdF2l9trrcvlC6q0Z65PR4LK3B/ -3m8KmlyGN940Ovb/4kEh2EZmNwbMq+3SaXiS4R7ZvKoboyNmwvCh4t5ne+NXz3Vm -7srej0cnOM54dTuNVdXm6pajYjELNVJGsK0vo6CAZiAOyasFkwMFMr5w/ehBaZIo -9ewWjvgDdvQ0+JBMVZJot7e5D4tUgVTaIMpQryzAp/u3r5KC1bkcC1Zie+44CaPr -V2FspEyYQDPJHC2tRj33lbaCWDdfdhYhv6uzlcM9ExPj+RQA0xlCuxh1pxK43H4t -PdWvcIeIKtFRWq9gsH1/wDBaIsB5Kykq4xyvMOj3dyV+dyIO1D3GG2+ZoBt8gklk -ieDIzCMKsXbomgm64/Ewlx9tf1fbTouSWP1+Gh0Wne3sCEtCY72ebYgjtaA0w8Xr -HGTsEdw/rSer46uULYWXYC6VYZwlyTbPh4NSD7ATrQo6HnaKugtuya9NPfYD9S9w -PoXPXpNKvwSq9SA/XsodHet9uU+IlKnYI41hVGaukQKCAgEAu7dAFmh5vWFqmsWH -Q6akQ/1j+KL+v0AKj1yp0Qyreq/zZ+3CP5fk+0oIb76cZG/Wzs4sUG9aeos0/qDv -A5kwhjipnJACul38+diTcugYZgj9QZFLbrlMfIW03xf+6tQhYlNvLpih3dzRHuYQ -WVF4LtQO+O+sVaoSD4js6pO2AQqQZrRchwUd+S1rbS0112FrZDkvrBV+/GMbMiC8 -naOy++N8WSdx8i6Uz+3f7ZBC+vd/YTsT4ncXrBr6tdsRa9VL/GPARhwb3/9LltKl -pAAQ3dNWc+0IjW0wIVmA9u5p4mR0lsZXtgyfA0TbMD9PpwezeJhJojk++ZgBkOkp -UAMDMkPo0ZJQ0U8ghUxBSU0DSbB1aZDz1pCTdaGN3tOJV2Pee9NLNwhHT64kKYtx -Cs8gZF29gQVotCY2CB0/5jVmm4qgzOsNDNiM90CiugKcLX/162Z7L/8eCOmFuP2L -HPeYFX2MDWbXYSMeSZjFOmdgpUZYCux+9m6nljwGn7bJUMmdjCNyrQrAcPydM3v4 -pRtgd7ISz5uAID3RWWAjT3oRn2Ip9rX++44ulTpg8rdviP8FtUWWE4nHdHkMFFnu -0i7ur7Ibki7DbQSkrp6e0watJIZXmfjBQ9wHG5CteybYKqZrofOnVubeP76t6Ffa -wjDYcVd+WsJwaosT4sH2fc+a4V0CggIAX703N+ISHGb6f47FLTGF3jTdZJxPNgpP -teIIwUMtwz2K7RLN8gzr0Cnj0NID0iw7uCN6HVCeiLS8uJzJSgIhQxEX/XvbIify -mdUC1iYLmhikZGUM8ah9J/Ed0f5vUYkTaoKH+SRZ4cn9l9g+ijjqtPFAq4Myxlbq -x9LnOm7kwsJ8vTNMwqQ4lDkKHRuEG3EV+dAxfBofu9lAjW7GrzXX9Gxxy9cnwro/ -KajQ1b0bMloc9PdJCPz87/YduIFI2XcAqoSxRNi2iHmV0ntO7vN87yzg/zqNm+Nk -VSouCEh2lSGapTcusraUuJm4l+agcfq39p+3Lj5+ocjlBUSNh+X2JmaDx1Ctu/50 -Vu+vHtQrVMwlpneQM4Fh3ygQ7jdXbgIasyw/JQlGjqhlyYmhG3VaPrOjKQVcY2Bj -YiYLloLdi0BV5AtR1RjfaFz4iH0xmakE5mP4K7P27KPQVOFnBAa5+EZ7/856kDkU -fV4jnYSRQ5y/LCkv88EFEPZWNIr19Hy60mRWbbsLrW8r5/zRkRDHTpmn27EiAHvV -Ye1T3187Gb7ae4SJgRJftc2ad60s9Z7uEvYsj8Icwwoui+1nk98V6NENuPXVb3jW -5t8KYAlr5BbDLAWYLORZHZyYYl8r6z8FxnlUxtA/nxUSY06BUvN+J+5fnTpkXJHf -lF2vslPK5VECggIANpTlrc5Zp9c0jPOiBQT/92LdtMR9mB76WB8fX9xn1Tm7V/cI -MatRrFzaTvi5HqHxPWJJ5cgMYKQw8kHHk1q9U7jeexZGCICFOUjk3N2Z0aXIWrx+ -hiS1i5DzRaZNI682s436cdaS4GpZIhqjIOR4/JS15Nfu+DVqyHOevWnd0D/tGoJB -JpiePYl2k7b8sirM3bHnRDtBiMHrHyHxzpdTLImDLHXr7C5DTeQAzzo+YMu45mNm -utKq3SRlO2wizj0qpONgJ6cHI7pypAPalliA+hPRRJqaHmTr7LpkP3+g73hf26wK -PoF6CLkdaN945F4Z48/3zEOP3XRIQocMA46ayA+8TsOpx9rm8L1LrF1pgmJi5Ml9 -3yV93ZZ/w4Jy0pqZ28nn3gcX6JP7qtfgioLLeyuuBphpOQXl7Ys3w1d0EEErpATU -tRG+BS16o+FhM1iXAN8c8HrqOtyJzCpYnuoWiNc+G8BIn6ox3xmihwK4hiR6s/OM -Mxaa6T4FF/IWIzuCezYPGgybWMXj3nRHsD7eNP170irBLwS3GdD1HWM2BpmLdJa0 -m/7QQkONhCnNFtjIalfPWMX51z/8GOKRKWH5A8PY6CxVHRg1ZfHT4TlfbdRPIG8d -6JrWt2s4eLv9VRdM+oMifHR4qvLDgg7R8pBr2FSsVXM9U2+j+drIeAhkjHI= +MIISKAIBAAKCBAEAufV4RlPgPAe/l/urvpdx1YlEv9sOWL6WQgae3Aj3UdYnf2Ut +xx73TFs/5Xr4/d9zQpIPN14orlEUE76zVdTbmvapiIQCefv5xGf5lplogFhKIsSh +kMAzWMiW0aR/f56EpvMDowGTyx2r8fUXKAM0eG1HRger+Or/Aor4IJKizilqZtA5 +hy9in0PZowt0iav32Tl9bN4FTlhNNRXUGC3qcN9g/FD4DbWOwMYDdDuNU9aHopq2 +ClqApczfMKeVMK1QYuEBOo7u4UG0me7Oi8pVJD58AHkI9EZC4GOTo9BaOfx+9JYh +JJr3KQ0ihbbFyZyScWhbA977vHX4DyTqAZK3N+B4oGQ3aZCKfJnHRfmQolBZ4RwC +rbIuxzsm7HZtEMn5L9wSh0FyCOwKHK6bb95XpKq57oOkFMTlVGYyXSEqo20tjfWO +CKKjDQeDSwonC5x/c3j42Zwe1DMrpzW0d14S1qak0tCvMLbVHwWbHuauyKWMtrfc +wwsahVrVvb5lyOal8Dc4FtKwyv8uofJ/jijFnNTevh8jQ1GF+eX7qGFhllA0rXU0 ++kbpKmYaQ5zk5Xkmtwtd0R2BxlIX15UTnmVkmy0NK3oEKKoC34EM84M9dq1A5vjA +svMKsszo8sisIcSQfUy2UNi3ChUSX6XgxWiP7U302bVy32PJ1hT+2PzbMXIeFdXo +rNmn0gq8p6ZRXw0PIyAtNLpEZvaB46r+OBFh7AM/ZG+T9S2wvn1vSXPGI2d7Rtpi +ZxDk5qHkG1AP/1BRCtzuG+PtIDA6wTcXJJb6/i7QdbObwa4VrLr+tNUz/zOG814k +90WNrbBHau+cDvcHDnGg53VKQlkCtxGG1mV3Bjr1b5k7m1LP5jBZ4ygZjsJf4fco +dP/C0TWRlu1SFEo8kRlQez4EZfg+2Wwpz3TYD9/kzZRzge8ZnksMPi4k/anGc7V8 +7dEOcqzJ/l6mLdd/ysV1GMs+J2IgzxDBf9NvqdR4mDv2DOBfVLMLCjbXWTTDcFxZ +Jc9U4H/sozvEoW++Hr7hNsbTJr2Grg5zJok8f3KhLQBmseLgdHKGEsJr5OeZcLuY +gcNEZcV2IWLxrzGqc777sIamW+JReOZqG1g/SjTmmYjkHLGAlPIxoLAngbEYmG9T +LnSgwy3n9pIngECk8zrirYRkgu2AP+BU6D3sdSUhKi9PCGG+tuD7vex+OxfSpLu4 ++D+aLhLrsgBFUTqZU261Bl6Ljwq1YSwSEGBNLN5u6ID4mbKLNmEziAhgTzD/YdLM +AnVd140G4L3j4DX3uvim5BR55GJNv+qB/h4BJGnaiRrBETxQ8aOzJ9/MFjoDl4ik +kmOmjskY9QIWp7KlPfcSAOThVZYWhG4DcD3OSwIDAQABAoIEAQCw8nPtL7jKRnE4 +VIEbDY6DK2ggy3e+WDQwRY56P4ne9FGHNqa1t7CHlriZS0eMg0hwyvzxqYY6QOpC +045gGPiSXy34ueyFWJBVJL7pX7aBkgGRTduTGmCBlfV1LPspW5RMLCeEv2Z7uxM3 +XAkZyNrv0MQmTfyFEk9vgv8SN5X1aJFXncFv8lX8yJpaO/c7XUitCbhglG8mGn31 +Cn1UOLTBjL0DuqQen2lj48e7nUMgyJ0ty9t2xKFvox+pc31R4UkBnasGpqWF8HjC +lOszN2eG4nIqHQG5NvZCAF6nXQXN8YZ4hDarV03iYR49cCqKapMqmKsqZs7RiMtu +1ahZsNror474yAO2TpSIdeeZnRzUZnLv8jBWSZubdpzWGuYzOI0FznpO+6Zf+QKy +Qi+j5kUtakscO2UxYh36DnjUB1BETAox77ukWeWe60wyZkm7EcJxBWZ94sGvF7Xt +GPxNLVXtrIpgE7TwPLlVGId/gvBD+suHvjKx4WnuBP4n2/mMjnTNvC2CAh+6OdGM +xmw7wG4xipkc/hIW54b9wKqTkX5DgrRtbX7ou/r4nklVlwBznrGJMaam6lXneYw4 +ViFh8ocl5VuHyEYWz5eGR40kVfhxafC9F2x9myjN9I+hHfQ0+Y6nvAwrp9ucG2rt +WrEkBxgVLb3UP4U8Lf8L19Sccxa714PNuO9OBcGODmHNPceDuwCDOaJhKChgl3Dj +KNM4cxtUh8WnKfsDQxzP4ShX6dGxhY6oGCnimOoBmv5PsXLdlSrLMaDh3OW6s+xh +1okitSGUfcxsMG5JrokDT4dX8jLdMpF+qOl9BDYnDBitzdDWh07txedwIKX4roG1 +9X5RX9Q0chjrplGIcNuZOOJp8zWAoVdwrTnPNX6bdMntbQMbHXMqJWsXBNC+VWh5 +5bHvehut5dl5E/DsdHth7hTvXHwhFLmAtRyGmMjZU63Anmr/UBz6Tg9+s0XHcJQu +7/CGH5vUXR/2tCT57Prae0x+t7pbhLxbBn1z95u2IiVjahJInlaik3QTjiFZnMaZ +OuyAe1IBkkNuu5r3MjQ5OSQyPX9sztS24jFh5xVER59YDnCg+pv8zMEmQ6y6wY0/ +O2HwOCiwMcFktAn+qvjRnPwrwmWvcnEpViff9zhmjkLMjYSXYWPXLr541Vvy3Fd4 +izlEoFUM3jStYPKukDCGifG6j6TRlMlrSNiTr07bjDiiRUfRP8nNvS8SYqDx0ukc +bOpTYmJLQn4PE0BB+nsH9qvC8jA3Etx0NH6Bn0haWYdOFaTGeiWAHHRCairNreFZ +PU0rVrX6NgzUiT++HguBuDB+eoNOn9/TI+IMVHXT2Z7n/kiOh9OGGJL1Ej1ohULa +cUcfYjwBAoICAQDo4d48xxnjhEalY0Y0z3b2uP4sUBhgyCBs3Zf2/wEIiheJDmae +ewUU81IBT2w2dwnCGvynxTGJ4hkXPLr5DLjB1HCrG96t/Oc0lmEO4c+SCrJnaf2M +9e8Wx+zfL0rqdIv6OFGVSw2vUE+eLcN+UXXbx5DvEpz2PP750YILPpJEMXykZUAE +cxObKmskYWj5rbGf5SyWE8umGnn52TS37a9T5pG5og3zoMeydthSiS4/jC1u9niq +YXOJ345uhXU3HCjKbCbeMXdYONV14um8fizY6Hw8UD3853uDjxisDh6uT9s9L9PN +zEaSCw7DLNvtYWfb74iprZSvu4F7iQpN/lclNTnwLHV2XGmsmjbJBSzWK2Hgv0C3 +xzpjj7yt5IAM0w768PXE+9yisR/91Q571pf8afAlqsdjwE5GILw4VnRxiM2iYjwK +9O0MCQHWhHeB6eFetKeP45QNXMM2BBAkUQbRdY4MXvg6k9pVPXzL0ZFtjzwImD8C +zk3ucF/+hcPctVc2B9boFYQmstG4QGMRhpX2cwXckGnQalK65xcKRYld+lswds45 +0cRtzyBCHm5xt4rGeTn985XbB2WtMSbSSCKfsf3yFy4vLkLjwHlYDkBkBKvJBD30 +duT9g7fInF5V9aSNOYqflS5a+9XR9rUFIk4NPTWKUiozOCbHJlD3iPe2AQKCAgEA +zGsobIOxluTC2P1d2tCs1SribdC7jFFT+vpzJOftwZFt0taXvifMATcKTvl1UEBz +DYdyvcDRWbfmWjf0xhjSrhHCHKsgl7MOeOcPiog0LJhOLcBVV9Rsz+6FEMhDQtcl +z/4FyHWTel3pBKkdXBVcqQZdxNV9Oxn2KusKPMKvoRwwF8RF4Bzvh4RnCOOLbUDY +0kWKJ/1Hg4XbAO0Ll+efNse7LGA+KM4hRzAQLHWYbUEqzgXaGXZwNRb8qSkm5ker +NzYee76sM9vfXsNQk2fa6R1H2womCq926DHzFf+DXNAWJ8xf4fKWSv0rtYRH9t+c +01b9/a2/ViaKySzymlH1scgKprNSMSylF228A3XbiJkz8vRki+itxPpMNrEIlbdI +J0M/Qk7Lu/Gz0aKkI1oPB3qs6mE0vaYl2a1kl+G5UOaOnacQjrXDlDDQY+Awi6yC +S/nPrkgs+Y+tx5k4UQnm8VIPUhQGha7BJ4QulIFrz/+KuqeVGy06lxvFiiNghEGO +NHLyTlUIJiybuPDLopQh+U3IVwDPIoiLMAfxaUecsjq5S3vaYP+ThMoJYZdCPd2P +McgkVubxf/DmnBievNjlWJNt2obuFBCG9ScsRRTh0wddt324IICFTg15B3Z8x0Kw +QkGvOp0QX360wMpAVxyrZQvaC64qf2/Akc1ajjGDfEsCggIAVhM90BsLD5PRhMmn +pldUMib4Eyrbh9IQYgyZYXqpSB26SzceaM8xdqfklIVlis/+tFbDMcNp5vvBqFwT +A4BXPZUmu6fGa2qBjmdSomyGCwWXITAEvjgcUcA9ZdSWDQhcwHRWeybNfRHjC6UA +j8zOEhi2EhdAGqc62t08Aqny5++ekSi3O63I/l30UfMLGNXBREcxbpsMd21rzhQh +LyZT2l/rVsB2BalUhjr1A7SeenB2ToAc42S3jqspeuIrC96FmSPWTePcp6gCBduD +5t5/9wAfAy/paXOprFuUk+t4HZd4gioOUA+DufEKWMtY0mlhOOJVEdoNjdJxLlbd +jyxFy4Pb0VCtbb0Edf5d53jZNKO+PpKR+htSEoCLDX7acWMFM20ieddZmmx7VZeN +DeqoLGx/jXyMy+rFQ5hP2UbjLR+SWcWTSb1zbDJcEozNmx/148pD8KP+Ed5KbMmd +qb6lFYAsq5fiicwiM8VRPghMh0EcwFR9Xa0hEtNIN8v7M7V28Yp+PTPOr3sCluZ9 +d3nWLcwfy4E5CwZxY5GMa4h+GFUzpTsUSDynLKsU0jtrOO7NBUTDUYDZz6XxR81V ++v0chwgDw5obwOaJZKK8dvZ1iEJNuDOwLo5PXwBzSlu5Zm4vjt9IxGkgRBK22i8k +gyxFyxDnnCN4Y4wKkSsxW/ytCgECggIAP7+zTZQMT/hrY2wwVsr4+0lyb7jGpE3A +mOZ9/iZuGQ2XaEcP73dNwZs+lb5p/Wr79l4lRFPbddVJ+xy0MwsOuMZE+NfNREHM +45t7V0J+suGUj+QJOWi/vmCuErvBbhjWa/TWLNut8F1VC+UJiOwIh5W6rGW/tiy0 +flHqUWSNjPrTbLYC7I9Zi7OYxkbf9mRgucKCAVKVeMjHsZQ7J1ZOarEDCCXDfMo7 +yo2MnbDWpkvKY5GjoIk1GPlgNgjlXq8/D+rKuuCNp2aMVGsot6+Nr2E4RXD2yCJM +PMFHA7c5ajpijmrIBBi5Eg2+Ec98+dpmd+oLL499ugovAeoIhmPE8XpnB/GoUjmQ +CqxoE9QvcHwGnV/l81POzT0Zg3zWJoqP796i3bThCG2qHFhSQ8wUH8r8HePOpM4p +w6a1VkBIoJgmJbgyC69XnOFUO7Fwsj5MLBFt2PYdQH60PSjlTTB/WwayTHB+UDZd +ektYk2uBCc6xnuAgOedy/CjnA9tggB5JkMXAFvmhnvYOYjCF8N+tcKf3MFrKPgTD +E2mGucRhc5uoqYeoZNOPV7wCDPM070InI+k8m/VNnw6rfEaZSl+BtovTmHC30n4M ++GsM/UYz3rHPYifMwiYSbHL7KX6kDygW+7KsSOUuc/l5uR3ZztDcCpkVmMrp6fAZ +595YvTtnu90CggIAV5tGE9Bnh/W9NoBPTuL79cPuNeZRVo/4zSh10LWiSoh+39UB +uVbWt8Y5XeqF6iDx/gyO5qauieF1ZZ27CPrqq/E/SU7FW2H1zKWlyvGWA6jW9mZy +HTbiZgGoNhYougQIt7NN0U3DXqf7+Y+m1vAacKOkoc86U5dK5XtMjhxhxoqWUOSv +TZR6VkHWhiMDNAJSmdkUojf8FwtCFDYXVoxQxVeF0jMN4S3DEjdkpIhnpetz4b9Y +q62SIw7Moz8CABL9VMI/L2masrYaQMm0GW9o3hHkwV8t9+O9IgcbBj6np2yw9uIS +6q9xzOHviBtbHCBieJwvKjIvbWy84MiGYdutpOVom4Wo0AvehLxgc10xpCc8tpDX +rq9WjyLRAkHQf+mUXzquBoVJr/pQOF0tlqMLhicOELHt6Y3kGVAqLqlQSiiOTfpE +mkRDDDbj8pTl9YneAC6asosEtukL8IJv7Pwiz7u/OSD9dZM8SzyhFMJ8hLRg6VZD +upFxO/n4GZK/F57nivdRz3XhH5A3sx4Dh6moLAF7NwBaWL1vTcV5f+MNCos1psC0 +2mQ3YORQ+OJRMb+uUOCre6TVeii0KjEiLxVuptw7NTXsUAPKYvVMzp2yZoqSkkaD +T9lytWVuEUmoZX4BAHsI0dpq1G5nT+9cZRWf/qY7wlUKz+CPg6SLFdaDmG8= -----END RSA PRIVATE KEY----- diff --git a/mysql-test/std_data/serversan-cert.pem b/mysql-test/std_data/serversan-cert.pem index e47779f420d..d40127365ca 100644 --- a/mysql-test/std_data/serversan-cert.pem +++ b/mysql-test/std_data/serversan-cert.pem @@ -5,56 +5,68 @@ Certificate: Signature Algorithm: sha256WithRSAEncryption Issuer: CN=cacert, C=FI, ST=Helsinki, L=Helsinki, O=MariaDB Validity - Not Before: Apr 25 20:52:33 2017 GMT - Not After : Apr 20 20:52:33 2037 GMT + Not Before: Jan 27 10:11:15 2019 GMT + Not After : Jan 22 10:11:15 2039 GMT Subject: C=FI, ST=Helsinki, L=Helsinki, O=MariaDB, CN=server Subject Public Key Info: Public Key Algorithm: rsaEncryption - Public-Key: (1024 bit) + Public-Key: (2048 bit) Modulus: - 00:a7:74:d4:2b:80:cb:96:08:2a:b9:c2:87:18:0d: - 69:2b:da:cf:ef:21:cb:05:d4:80:2c:f3:85:bc:78: - b2:42:d9:9f:f1:dc:47:68:c5:af:5a:c9:01:f0:dd: - 91:cb:3a:b9:38:b2:36:6b:a3:66:ef:cd:44:0f:8f: - 39:57:60:ad:3b:44:33:51:c2:7f:cb:5c:8d:55:b8: - 1e:e8:80:e0:ed:9d:8d:10:7a:42:68:73:06:63:83: - ce:db:05:5b:e1:7b:f9:0e:87:20:38:b8:11:6a:b7: - 59:3d:4a:ca:cb:60:e6:e1:73:d9:a2:24:4a:70:93: - 5e:cf:d5:04:d5:ad:ac:96:a5 + 00:be:e7:9b:da:e1:bf:fe:e6:a4:6d:c2:20:8a:1f: + ea:8e:1a:a6:3f:57:93:75:d8:3b:80:55:bd:f3:fe: + c3:1e:50:0f:e9:66:0e:bf:98:98:5f:06:95:fc:4a: + 9a:b2:fc:7f:b1:e0:d9:ef:df:6c:28:d0:12:98:bf: + 78:b6:f4:1a:94:83:a0:3e:bc:d3:b3:02:4f:4a:96: + d9:30:b5:7c:5a:82:dd:ff:96:72:1c:f5:ad:80:bd: + ec:f7:fa:9c:40:e2:37:f5:86:b7:c6:b0:bb:6a:69: + 77:77:e1:2a:b1:03:bb:1e:bb:e8:b3:7a:2c:bf:a6: + c5:6b:4d:99:fb:f3:84:ec:ac:a9:2a:f3:f5:09:4e: + 5b:75:18:9c:68:f7:c9:2b:59:0b:41:33:60:23:fa: + d4:f8:64:e2:51:59:37:29:f2:bb:68:f5:6a:47:69: + 58:ed:a8:bb:11:9d:6b:d1:77:75:01:da:57:5d:3e: + 8e:bf:f7:b1:7b:69:df:53:22:5f:7d:c5:ac:b0:80: + 0c:20:ea:9d:f7:c4:52:d8:31:03:07:b8:84:a9:74: + e3:2e:4a:68:bf:a1:84:c6:38:32:c1:11:ef:f9:4b: + e6:79:f4:7b:7f:52:f3:36:4b:a6:d8:a5:ad:d2:02: + 40:89:42:ed:ba:d6:ea:74:d0:6e:c1:bc:02:33:9f: + 0b:ab Exponent: 65537 (0x10001) X509v3 extensions: X509v3 Subject Alternative Name: DNS:localhost Signature Algorithm: sha256WithRSAEncryption - 4b:78:d9:09:4c:25:cc:fb:17:8f:31:13:ac:d7:36:2d:5f:d4: - ce:94:84:d2:a7:fa:e2:1e:ae:b6:72:1f:01:56:0f:89:80:c0: - 01:ba:ad:d7:cb:24:c5:25:ec:f8:35:ac:52:1b:4f:af:7c:26: - 8d:d4:d4:91:05:21:b7:ba:3f:6b:1b:8d:1d:a5:6b:7e:7d:be: - 2f:6a:09:83:c2:c3:6c:2f:8a:31:fa:7b:36:3f:6d:e1:62:ca: - a0:3c:43:b8:53:5a:4a:b3:4d:7a:cb:9c:6e:db:a4:ce:a1:95: - 5e:26:d8:22:39:8c:34:0e:92:bd:87:a2:b1:7a:68:25:57:17: - b2:d8:43:3b:98:e4:80:6b:7d:3e:ab:32:82:6d:b8:80:45:83: - d6:55:f8:cd:31:74:17:8c:42:75:09:71:66:b9:e0:94:16:ca: - 1d:db:1e:89:12:a1:9f:00:cb:83:99:5d:5d:28:7a:df:2a:87: - b5:8d:f1:9c:b9:89:2a:0d:6c:af:61:00:41:cb:03:df:99:4a: - fe:93:81:88:ff:47:4e:2a:b5:2b:bf:85:0f:9a:21:7b:20:58: - 7a:1c:67:b5:8b:da:db:03:69:25:db:76:0e:f9:23:57:8d:8a: - 47:dc:15:16:7c:2d:66:8f:6a:10:f3:b2:ea:2e:31:c6:d4:2c: - 90:15:56:f4 + 73:fa:07:e9:05:65:28:2e:72:91:29:f8:6b:a6:11:2e:e3:e2: + 14:6c:4d:7e:69:16:01:47:55:df:88:8d:be:82:37:bd:95:4e: + cc:9c:71:98:fa:3b:0d:ad:13:53:e7:04:e7:6f:38:97:ce:12: + c1:f1:c2:48:bc:3f:a9:61:b5:22:48:e1:8c:64:1f:58:14:e9: + dd:5d:9f:e3:e7:78:5f:7d:43:6a:89:21:38:9d:65:e8:71:c1: + 62:d9:62:c7:e6:b3:bd:cb:de:f1:7c:46:10:53:28:8c:47:02: + 22:91:ad:78:c0:21:10:28:a8:2c:23:a3:f2:c0:2c:c9:71:0d: + b4:a0:ca:37:ac:36:b3:1c:75:6a:74:85:a5:ba:c2:19:de:e4: + 3e:c2:3c:a4:cc:dc:8e:a7:08:36:f4:e9:81:32:ac:49:f4:34: + 89:84:e7:61:54:29:7b:c0:54:53:b9:73:37:58:21:32:56:01: + 7f:97:d3:a1:06:5b:06:14:19:6a:42:5d:45:5a:ba:8e:14:d7: + df:49:46:f2:83:7a:f0:d6:25:52:37:39:ae:37:ea:67:5f:7f: + 7b:6d:f1:42:c9:0f:44:4d:f7:39:2d:39:78:12:93:42:1b:4a: + 6d:f8:76:48:78:41:e9:a1:0b:78:fd:ad:29:f1:28:62:b8:9f: + f7:22:39:3b -----BEGIN CERTIFICATE----- -MIICuzCCAaOgAwIBAgIBBDANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl +MIIDPzCCAiegAwIBAgIBBDANBgkqhkiG9w0BAQsFADBWMQ8wDQYDVQQDDAZjYWNl cnQxCzAJBgNVBAYTAkZJMREwDwYDVQQIDAhIZWxzaW5raTERMA8GA1UEBwwISGVs -c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTcwNDI1MjA1MjMzWhcNMzcwNDIw -MjA1MjMzWjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV +c2lua2kxEDAOBgNVBAoMB01hcmlhREIwHhcNMTkwMTI3MTAxMTE1WhcNMzkwMTIy +MTAxMTE1WjBWMQswCQYDVQQGEwJGSTERMA8GA1UECAwISGVsc2lua2kxETAPBgNV BAcMCEhlbHNpbmtpMRAwDgYDVQQKDAdNYXJpYURCMQ8wDQYDVQQDDAZzZXJ2ZXIw -gZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAKd01CuAy5YIKrnChxgNaSvaz+8h -ywXUgCzzhbx4skLZn/HcR2jFr1rJAfDdkcs6uTiyNmujZu/NRA+POVdgrTtEM1HC -f8tcjVW4HuiA4O2djRB6QmhzBmODztsFW+F7+Q6HIDi4EWq3WT1Kystg5uFz2aIk -SnCTXs/VBNWtrJalAgMBAAGjGDAWMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkq -hkiG9w0BAQsFAAOCAQEAS3jZCUwlzPsXjzETrNc2LV/UzpSE0qf64h6utnIfAVYP -iYDAAbqt18skxSXs+DWsUhtPr3wmjdTUkQUht7o/axuNHaVrfn2+L2oJg8LDbC+K -Mfp7Nj9t4WLKoDxDuFNaSrNNesucbtukzqGVXibYIjmMNA6SvYeisXpoJVcXsthD -O5jkgGt9Pqsygm24gEWD1lX4zTF0F4xCdQlxZrnglBbKHdseiRKhnwDLg5ldXSh6 -3yqHtY3xnLmJKg1sr2EAQcsD35lK/pOBiP9HTiq1K7+FD5oheyBYehxntYva2wNp -Jdt2DvkjV42KR9wVFnwtZo9qEPOy6i4xxtQskBVW9A== +ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQC+55va4b/+5qRtwiCKH+qO +GqY/V5N12DuAVb3z/sMeUA/pZg6/mJhfBpX8Spqy/H+x4Nnv32wo0BKYv3i29BqU +g6A+vNOzAk9KltkwtXxagt3/lnIc9a2Avez3+pxA4jf1hrfGsLtqaXd34SqxA7se +u+izeiy/psVrTZn784TsrKkq8/UJTlt1GJxo98krWQtBM2Aj+tT4ZOJRWTcp8rto +9WpHaVjtqLsRnWvRd3UB2lddPo6/97F7ad9TIl99xaywgAwg6p33xFLYMQMHuISp +dOMuSmi/oYTGODLBEe/5S+Z59Ht/UvM2S6bYpa3SAkCJQu261up00G7BvAIznwur +AgMBAAGjGDAWMBQGA1UdEQQNMAuCCWxvY2FsaG9zdDANBgkqhkiG9w0BAQsFAAOC +AQEAc/oH6QVlKC5ykSn4a6YRLuPiFGxNfmkWAUdV34iNvoI3vZVOzJxxmPo7Da0T +U+cE5284l84SwfHCSLw/qWG1IkjhjGQfWBTp3V2f4+d4X31DaokhOJ1l6HHBYtli +x+azvcve8XxGEFMojEcCIpGteMAhECioLCOj8sAsyXENtKDKN6w2sxx1anSFpbrC +Gd7kPsI8pMzcjqcINvTpgTKsSfQ0iYTnYVQpe8BUU7lzN1ghMlYBf5fToQZbBhQZ +akJdRVq6jhTX30lG8oN68NYlUjc5rjfqZ19/e23xQskPRE33OS05eBKTQhtKbfh2 +SHhB6aELeP2tKfEoYrif9yI5Ow== -----END CERTIFICATE----- diff --git a/mysql-test/std_data/serversan-key.pem b/mysql-test/std_data/serversan-key.pem index 393c0bc9c1a..84c34d63b0f 100644 --- a/mysql-test/std_data/serversan-key.pem +++ b/mysql-test/std_data/serversan-key.pem @@ -1,16 +1,28 @@ -----BEGIN PRIVATE KEY----- -MIICdgIBADANBgkqhkiG9w0BAQEFAASCAmAwggJcAgEAAoGBAKd01CuAy5YIKrnC -hxgNaSvaz+8hywXUgCzzhbx4skLZn/HcR2jFr1rJAfDdkcs6uTiyNmujZu/NRA+P -OVdgrTtEM1HCf8tcjVW4HuiA4O2djRB6QmhzBmODztsFW+F7+Q6HIDi4EWq3WT1K -ystg5uFz2aIkSnCTXs/VBNWtrJalAgMBAAECgYBReSgZmmpzLroK8zhjXXMEIUv1 -3w02YvOR61HwJxEkMVn+hNxBf50XoKDPHh5nMMUZbqvHpxLYLZilsVuGxcTCPVzw -YxTooPcJY8x61oUclI2Ls5czu/OfzoJhA9ESaFn6e4xReUFmNi8ygTMuPReZZ90T -ZvDikonKtCCk99MSaQJBANrmlPtfY57KJ18f1TqLvqy73I1vQjffSOrK3deYbvvB -jUJ79G9Wzj8Hje2y+XkkK+OIPcND1DnoTCTuqVazn+cCQQDD1jy8zrVg/JEPhQkS -BM7nvm4PIb0cgTPrOhsHDIF4hbaAZnA0N4ZEJ2q7YitXfOeR98x+aH/WJOrzzhmE -VXOTAkBQ4lK6b4zH57qUk5aeg3R5LxFX0XyOWJsA5uUB/PlFXUdtAZBYc6LR92Ci -LDeyY4M0F+t6c12/5+3615UKzGSRAkA+SGV6utcOqGTOJcZTt7nCFFtWbqmBZkoH -1qv/2udWWFhJj8rBoKMQC+UzAS69nVjcoI2l6kA17/nVXkfZQYAHAkEAmOHCZCVQ -9CCYTJICvoZR2euUYdnatLN8d2/ARWjzcRDTdS82P2oscATwAsvJxsphDmbOmVWP -Hfy1t8OOCHKYAQ== +MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC+55va4b/+5qRt +wiCKH+qOGqY/V5N12DuAVb3z/sMeUA/pZg6/mJhfBpX8Spqy/H+x4Nnv32wo0BKY +v3i29BqUg6A+vNOzAk9KltkwtXxagt3/lnIc9a2Avez3+pxA4jf1hrfGsLtqaXd3 +4SqxA7seu+izeiy/psVrTZn784TsrKkq8/UJTlt1GJxo98krWQtBM2Aj+tT4ZOJR +WTcp8rto9WpHaVjtqLsRnWvRd3UB2lddPo6/97F7ad9TIl99xaywgAwg6p33xFLY +MQMHuISpdOMuSmi/oYTGODLBEe/5S+Z59Ht/UvM2S6bYpa3SAkCJQu261up00G7B +vAIznwurAgMBAAECggEATXOwMuyWNbejjHhPNVrfkcnUGyzPweb5tQaUa5K33OuE +mR/z6d3iK+ODJHmsK+Pvdt6P7RcLTb+lW92K/0coJYsFj46SoTTVsKBk+7MWAa7I +nLKQF5nBS9NCehVuIZDmPTHsC6uWTgT+GF/9LxYha8W3EmIGF7d0ryUrzSGuk0qA +yVj4V2JbEbox5jjRUvRvCfbQnZYhT1Aa1/kN4fxYp00sQTkCQ1QZiC+SbN245nrv +UHumVBy0dPL+vmYxKc+L9qwYhHKsspx6+RUTgW+7YbHs6LEd8HmXb0hIp1Xb4yUS +ADVI7TgTGEGGRt1gQYkfcwl1YoVQeyBK8Yvfz88tgQKBgQD9PeBEXM+y7z8jcXAB +f/JpmMmm+S8JhPyKOMDZRL5jPKgm93Xm0pAReo8xM/quKH2jAoMxmburnYTTskyo +HBATcWDTBUiNkjCJORdWKwP6kvtYt8ZZsC9vrWkx4pPqTXQaXUNmrfZ1cuh5U/BK +5aAzN5Drx0tKie+/+2gvevoZawKBgQDA++qDlRAiNft7fEZhjA3ovOSq9kIf1hnE +psh4SRB21QZ443gifQKRRFIhMWRX0QkTyw2PbeVJvPjab08NmcumJWK5NCxPy3C0 +/ihQV2Ip49GVYA2qlgVzOMuxJJlG6SyKvCiBmadHY/ex4Ya1YPcfhjKsNr4ObIV8 +OCvQruQmwQKBgB+jp21jGyAD/CN1fMTzM1o2GJuf7lyGHPc3+AAtMow7e9bCfByG +mjFU2qcPE3bG4EuJeNKtnmDmoT3BvQoT135WX/59Xn8xkJbUZzIA1dJsorKG42U5 +OfP9+nKdGFXhr2vL0yv0+CHcZWcjMZZp8gX0H0sV7zY03Zti0bV869pZAoGBALDg +c+IkJoRkm9ljXxKbDkiJkMBNMvABCN8fyk/ND8UKnIMCYaKil07Tor7/iSuf0MUO +b6BNJkE+bYuvR3J8ypW+YEzFT/PWz7dj10lDvhoMz5QsVHpMRDSGEtOKat3+ay/B +IxMd5J7fNjAYN6JYfEetdRY4mluYBYSD60y6byxBAoGBALDoRoub5TUMdgr66fNp +p7tc9ERH8/htPEq5g2SrzQex7lUIp8+wmvprx0i4a2SgDYCkj6gmjG8rP2O65tsn +dkrKXnUOjIgjHGesbZoKgE+7Gl4c+eyoDsNVHH+ZFKN26fcO9i6wrbeGKjTTMcfu +nEXqAq0CccdZ0lXxQTS/ttbU -----END PRIVATE KEY----- diff --git a/mysql-test/suite.pm b/mysql-test/suite.pm index d0a4b618aaa..1c99e1ed645 100644 --- a/mysql-test/suite.pm +++ b/mysql-test/suite.pm @@ -19,6 +19,9 @@ sub skip_combinations { # don't run tests for the wrong platform $skip{'include/platform.combinations'} = [ (IS_WINDOWS) ? 'unix' : 'win' ]; + $skip{'include/maybe_debug.combinations'} = + [ defined $::mysqld_variables{'debug-dbug'} ? 'release' : 'debug' ]; + # and for the wrong word size # check for exact values, in case the default changes to be small everywhere my $longsysvar= $::mysqld_variables{'max-binlog-stmt-cache-size'}; @@ -29,9 +32,6 @@ sub skip_combinations { die "unknown value max-binlog-stmt-cache-size=$longsysvar" unless $val_map{$longsysvar}; $skip{'include/word_size.combinations'} = [ $val_map{$longsysvar} ]; - $skip{'include/maybe_debug.combinations'} = - [ defined $::mysqld_variables{'debug-dbug'} ? 'release' : 'debug' ]; - # as a special case, disable certain include files as a whole $skip{'include/not_embedded.inc'} = 'Not run for embedded server' if $::opt_embedded_server; @@ -62,9 +62,9 @@ sub skip_combinations { } $skip{'include/check_ipv6.inc'} = 'No IPv6' unless ipv6_ok(); - $skip{'main/openssl_6975.test'} = 'no or too old openssl' + $skip{'main/openssl_6975.test'} = 'no or wrong openssl version' unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/ - and $1 ge "1.0.1d"; + and $1 ge "1.0.1d" and $1 lt "1.1.1"; $skip{'main/ssl_7937.combinations'} = [ 'x509v3' ] unless $::mysqld_variables{'version-ssl-library'} =~ /OpenSSL (\S+)/ @@ -74,4 +74,3 @@ sub skip_combinations { } bless { }; - diff --git a/mysql-test/suite/archive/disabled.def b/mysql-test/suite/archive/disabled.def new file mode 100644 index 00000000000..ae841eaaf33 --- /dev/null +++ b/mysql-test/suite/archive/disabled.def @@ -0,0 +1,13 @@ +############################################################################## +# +# List the test cases that are to be disabled temporarily. +# +# Separate the test case name and the comment with ':'. +# +# : BUG# +# +# Do not use any TAB characters for whitespace. +# +############################################################################## + +archive_gis : MDEV-17297 wait for the fix and then enable it diff --git a/mysql-test/suite/archive/flush.result b/mysql-test/suite/archive/flush.result new file mode 100644 index 00000000000..428f32d09f8 --- /dev/null +++ b/mysql-test/suite/archive/flush.result @@ -0,0 +1,18 @@ +CREATE TABLE t1(a INT) ENGINE=archive; +INSERT INTO t1 VALUES(1); +connect con1, localhost, root; +LOCK TABLE t1 READ; +connection default; +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +# Must return 1 row +SELECT * FROM t2; +a +1 +SELECT * FROM t1; +a +1 +connection con1; +UNLOCK TABLES; +connection default; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/archive/flush.test b/mysql-test/suite/archive/flush.test new file mode 100644 index 00000000000..feadef08d7a --- /dev/null +++ b/mysql-test/suite/archive/flush.test @@ -0,0 +1,25 @@ +--source include/have_archive.inc + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +CREATE TABLE t1(a INT) ENGINE=archive; +INSERT INTO t1 VALUES(1); +# Works correct if we uncomment next row +#FLUSH TABLE t1; + +connect(con1, localhost, root); +LOCK TABLE t1 READ; + +connection default; +FLUSH TABLES WITH READ LOCK; +copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t2.frm; +copy_file $MYSQLD_DATADIR/test/t1.ARZ $MYSQLD_DATADIR/test/t2.ARZ; +UNLOCK TABLES; +--echo # Must return 1 row +SELECT * FROM t2; +SELECT * FROM t1; + +connection con1; +UNLOCK TABLES; + +connection default; +DROP TABLE t1, t2; diff --git a/mysql-test/suite/archive/rnd_pos.result b/mysql-test/suite/archive/rnd_pos.result new file mode 100644 index 00000000000..b6b6748d53f --- /dev/null +++ b/mysql-test/suite/archive/rnd_pos.result @@ -0,0 +1,56 @@ +create table t1(c1 int not null, c2 double not null, c3 char(255) not null) engine=archive; +insert t1 select seq, seq+0.7, concat('row with c1 = ', seq) from seq_1_to_10; +explain partitions select c1,c3 from t1 order by c2; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using filesort +set max_length_for_sort_data = 4; +explain partitions select c1,c3 from t1 order by c2; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 NULL ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +flush status; +select c1,c3 from t1 order by c2; +c1 c3 +1 row with c1 = 1 +2 row with c1 = 2 +3 row with c1 = 3 +4 row with c1 = 4 +5 row with c1 = 5 +6 row with c1 = 6 +7 row with c1 = 7 +8 row with c1 = 8 +9 row with c1 = 9 +10 row with c1 = 10 +set max_length_for_sort_data = default; +show status where variable_name like '%tmp%' and value != 0; +Variable_name Value +Created_tmp_tables 1 +Handler_tmp_write 10 +Rows_tmp_read 20 +alter table t1 partition by hash (c1) partitions 3; +explain partitions select c1,c3 from t1 order by c2; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 Using filesort +set max_length_for_sort_data = 4; +explain partitions select c1,c3 from t1 order by c2; +id select_type table partitions type possible_keys key key_len ref rows Extra +1 SIMPLE t1 p0,p1,p2 ALL NULL NULL NULL NULL 10 Using temporary; Using filesort +flush status; +select c1,c3 from t1 order by c2; +c1 c3 +1 row with c1 = 1 +2 row with c1 = 2 +3 row with c1 = 3 +4 row with c1 = 4 +5 row with c1 = 5 +6 row with c1 = 6 +7 row with c1 = 7 +8 row with c1 = 8 +9 row with c1 = 9 +10 row with c1 = 10 +set max_length_for_sort_data = default; +show status where variable_name like '%tmp%' and value != 0; +Variable_name Value +Created_tmp_tables 1 +Handler_tmp_write 10 +Rows_tmp_read 20 +drop table t1; diff --git a/mysql-test/suite/archive/rnd_pos.test b/mysql-test/suite/archive/rnd_pos.test new file mode 100644 index 00000000000..7a1d78ea003 --- /dev/null +++ b/mysql-test/suite/archive/rnd_pos.test @@ -0,0 +1,27 @@ +# +# MDEV-14500 Support engines without rnd_pos +# +source include/have_archive.inc; +source include/have_sequence.inc; +source include/have_partition.inc; + +create table t1(c1 int not null, c2 double not null, c3 char(255) not null) engine=archive; +insert t1 select seq, seq+0.7, concat('row with c1 = ', seq) from seq_1_to_10; +explain partitions select c1,c3 from t1 order by c2; +set max_length_for_sort_data = 4; +explain partitions select c1,c3 from t1 order by c2; +flush status; +select c1,c3 from t1 order by c2; +set max_length_for_sort_data = default; +show status where variable_name like '%tmp%' and value != 0; + +alter table t1 partition by hash (c1) partitions 3; +explain partitions select c1,c3 from t1 order by c2; +set max_length_for_sort_data = 4; +explain partitions select c1,c3 from t1 order by c2; +flush status; +select c1,c3 from t1 order by c2; +set max_length_for_sort_data = default; +show status where variable_name like '%tmp%' and value != 0; + +drop table t1; diff --git a/mysql-test/suite/binlog/include/binlog.test b/mysql-test/suite/binlog/include/binlog.test index 92fcb3a792b..e5d4efb183b 100644 --- a/mysql-test/suite/binlog/include/binlog.test +++ b/mysql-test/suite/binlog/include/binlog.test @@ -5,7 +5,6 @@ -- source include/have_log_bin.inc -- source include/not_embedded.inc -- source include/have_innodb.inc --- source include/have_debug.inc --disable_warnings drop table if exists t1, t2; @@ -270,12 +269,10 @@ create table if not exists t3 like tt1; # the mysql database is replicated even when the current database is # 'mysql'. ---disable_warnings USE mysql; -INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test'); -UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'; -DELETE FROM user WHERE host='localhost' AND user='@#@'; ---enable_warnings +INSERT db SET host='localhost', user='@#@', db='Just a test'; +UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@'; +DELETE FROM db WHERE host='localhost' AND user='@#@'; use test; source include/show_binlog_events.inc; diff --git a/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result index 99f2a57835f..fdcfb4bfa01 100644 --- a/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result +++ b/mysql-test/suite/binlog/r/binlog_flush_binlogs_delete_domain.result @@ -17,6 +17,12 @@ master-bin.000002 # SET @@SESSION.gtid_domain_id=1; SET @@SESSION.server_id=1; CREATE TABLE t (a int); +SELECT @@GLOBAL.gtid_binlog_state, @@GLOBAL.gtid_binlog_pos; +@@GLOBAL.gtid_binlog_state @@GLOBAL.gtid_binlog_pos +1-1-1 1-1-1 +include/show_binlog_events.inc +Log_name Pos Event_type Server_id End_log_pos Info +master-bin.000001 # Rotate # # master-bin.000002;pos=POS FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); ERROR HY000: Could not delete gtid domain. Reason: binlog files may contain gtids from the domain ('1') being deleted. Make sure to first purge those files. FLUSH BINARY LOGS; @@ -74,5 +80,11 @@ the following command succeeds with warnings FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); Warnings: Warning 1076 The current gtid binlog state is incompatible with a former one having a gtid '11-11-1' which is less than the '11-11-11' of the gtid list describing an earlier state. The state may have been affected by manually injecting a lower sequence number gtid or via replication. +RESET MASTER; +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (4294967296); +ERROR HY000: The value of gtid domain being deleted ('4294967296') exceeds its maximum size of 32 bit unsigned integer +FLUSH BINARY LOGS DELETE_DOMAIN_ID = (4294967295); +Warnings: +Warning 1076 The gtid domain being deleted ('4294967295') is not in the current binlog state DROP TABLE t; RESET MASTER; diff --git a/mysql-test/suite/binlog/r/binlog_row_binlog.result b/mysql-test/suite/binlog/r/binlog_row_binlog.result index 4068a80771c..2d79de6960a 100644 --- a/mysql-test/suite/binlog/r/binlog_row_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_row_binlog.result @@ -843,9 +843,9 @@ create table if not exists t2 select * from t1; create temporary table tt1 (a int); create table if not exists t3 like tt1; USE mysql; -INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test'); -UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'; -DELETE FROM user WHERE host='localhost' AND user='@#@'; +INSERT db SET host='localhost', user='@#@', db='Just a test'; +UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@'; +DELETE FROM db WHERE host='localhost' AND user='@#@'; use test; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -894,18 +894,18 @@ master-bin.000001 # Query # # use `test`; CREATE TABLE IF NOT EXISTS `t3` ( `a` int(11) DEFAULT NULL ) ENGINE=MyISAM master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Annotate_rows # # INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test') -master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Annotate_rows # # INSERT db SET host='localhost', user='@#@', db='Just a test' +master-bin.000001 # Table_map # # table_id: # (mysql.db) 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 # # UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@' -master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Annotate_rows # # UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@' +master-bin.000001 # Table_map # # table_id: # (mysql.db) master-bin.000001 # Update_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Annotate_rows # # DELETE FROM user WHERE host='localhost' AND user='@#@' -master-bin.000001 # Table_map # # table_id: # (mysql.user) +master-bin.000001 # Annotate_rows # # DELETE FROM db WHERE host='localhost' AND user='@#@' +master-bin.000001 # Table_map # # table_id: # (mysql.db) master-bin.000001 # Delete_rows_v1 # # table_id: # flags: STMT_END_F master-bin.000001 # Query # # COMMIT drop table t1,t2,t3,tt1; diff --git a/mysql-test/suite/binlog/r/binlog_stm_binlog.result b/mysql-test/suite/binlog/r/binlog_stm_binlog.result index 872ba40e05f..ccc3db2ba7e 100644 --- a/mysql-test/suite/binlog/r/binlog_stm_binlog.result +++ b/mysql-test/suite/binlog/r/binlog_stm_binlog.result @@ -1,4 +1,3 @@ -drop table if exists t1; create table t1 (a int, b int) engine=innodb; begin; insert into t1 values (1,2); @@ -6,8 +5,6 @@ commit; 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`; DROP TABLE IF EXISTS `t1` /* generated by server */ -master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table t1 (a int, b int) engine=innodb master-bin.000001 # Gtid # # BEGIN GTID #-#-# master-bin.000001 # Query # # use `test`; insert into t1 values (1,2) @@ -451,9 +448,9 @@ create table if not exists t2 select * from t1; create temporary table tt1 (a int); create table if not exists t3 like tt1; USE mysql; -INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test'); -UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@'; -DELETE FROM user WHERE host='localhost' AND user='@#@'; +INSERT db SET host='localhost', user='@#@', db='Just a test'; +UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@'; +DELETE FROM db WHERE host='localhost' AND user='@#@'; use test; include/show_binlog_events.inc Log_name Pos Event_type Server_id End_log_pos Info @@ -501,15 +498,14 @@ master-bin.000001 # Query # # use `test`; create temporary table tt1 (a int) master-bin.000001 # Gtid # # GTID #-#-# master-bin.000001 # Query # # use `test`; create table if not exists t3 like tt1 master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Query # # use `mysql`; INSERT IGNORE INTO user SET host='localhost', user='@#@', password=password('Just a test') +master-bin.000001 # Query # # use `mysql`; INSERT db SET host='localhost', user='@#@', db='Just a test' master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Query # # use `mysql`; UPDATE user SET password=password('Another password') WHERE host='localhost' AND user='@#@' +master-bin.000001 # Query # # use `mysql`; UPDATE db SET db='Another db' WHERE host='localhost' AND user='@#@' master-bin.000001 # Query # # COMMIT master-bin.000001 # Gtid # # BEGIN GTID #-#-# -master-bin.000001 # Query # # use `mysql`; DELETE FROM user WHERE host='localhost' AND user='@#@' +master-bin.000001 # Query # # use `mysql`; DELETE FROM db WHERE host='localhost' AND user='@#@' master-bin.000001 # Query # # COMMIT -master-bin.000001 # Rotate # # master-bin.000002;pos=POS drop table t1,t2,t3,tt1; reset master; create table t1 (a int not null auto_increment, primary key (a)) engine=myisam; diff --git a/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test index 0faafa35a1b..8311f4bd800 100644 --- a/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test +++ b/mysql-test/suite/binlog/t/binlog_flush_binlogs_delete_domain.test @@ -28,6 +28,9 @@ FLUSH BINARY LOGS DELETE_DOMAIN_ID = (99); SET @@SESSION.gtid_domain_id=1; SET @@SESSION.server_id=1; CREATE TABLE t (a int); +SELECT @@GLOBAL.gtid_binlog_state, @@GLOBAL.gtid_binlog_pos; +--let $binlog_start= +--source include/show_binlog_events.inc --error ER_BINLOG_CANT_DELETE_GTID_DOMAIN FLUSH BINARY LOGS DELETE_DOMAIN_ID = (1); @@ -129,6 +132,22 @@ SELECT @gtid_binlog_state_saved "as original state", @@GLOBAL.gtid_binlog_state --echo the following command succeeds with warnings --eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($del_d_id) +# cleanup: forget the out-of-order +RESET MASTER; + +# +# MDEV-14431 +# Check rejection to delete a domain with value exceeding its range's maximum +# +--let $d_max_plus_1=`SELECT 1 << 32` +--error ER_BINLOG_CANT_DELETE_GTID_DOMAIN +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($d_max_plus_1) + +# accepted maximum: +--let $d_max=`SELECT (1 << 32) - 1` +--error 0 +--eval FLUSH BINARY LOGS DELETE_DOMAIN_ID = ($d_max) + # # Cleanup # diff --git a/mysql-test/suite/binlog/t/binlog_stm_binlog.test b/mysql-test/suite/binlog/t/binlog_stm_binlog.test index c3d8066f807..e9c8e0ed874 100644 --- a/mysql-test/suite/binlog/t/binlog_stm_binlog.test +++ b/mysql-test/suite/binlog/t/binlog_stm_binlog.test @@ -3,10 +3,6 @@ let collation=utf8_unicode_ci; --source include/have_collation.inc ---disable_warnings -drop table if exists t1; ---enable_warnings - # REQUIREMENT # replace_regex should replace output of SHOW BINLOG EVENTS diff --git a/mysql-test/suite/binlog_encryption/rpl_corruption.result b/mysql-test/suite/binlog_encryption/rpl_corruption.result index 161559af81f..14a67b3a3a5 100644 --- a/mysql-test/suite/binlog_encryption/rpl_corruption.result +++ b/mysql-test/suite/binlog_encryption/rpl_corruption.result @@ -53,10 +53,6 @@ include/start_slave.inc connection master; connection slave; include/diff_tables.inc [master:test.t1, slave:test.t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead # 8. Clean up connection master; SET GLOBAL debug_dbug= ""; diff --git a/mysql-test/suite/binlog_encryption/rpl_loadfile.result b/mysql-test/suite/binlog_encryption/rpl_loadfile.result index f7ed4018b66..19a11e99250 100644 --- a/mysql-test/suite/binlog_encryption/rpl_loadfile.result +++ b/mysql-test/suite/binlog_encryption/rpl_loadfile.result @@ -244,10 +244,6 @@ include/start_slave.inc connection master; connection slave; include/diff_tables.inc [master:t1, slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead connection master; DROP TABLE t1; DROP PROCEDURE p; diff --git a/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result b/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result index ffee1a01158..388c8e67b68 100644 --- a/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result +++ b/mysql-test/suite/binlog_encryption/rpl_mixed_binlog_max_cache_size.result @@ -23,10 +23,6 @@ include/wait_for_slave_sql_error_and_skip.inc [errno=1590] Got one of the listed errors include/wait_for_slave_sql_error_and_skip.inc [errno=1590] include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead ######################################################################################## # 2 - BEGIN - IMPLICIT COMMIT by DDL ######################################################################################## @@ -59,10 +55,6 @@ INSERT INTO t1 (a, data) VALUES (29, 's');; CREATE TABLE t5 (a int); connection slave; include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead ######################################################################################## # 3 - BEGIN - COMMIT ######################################################################################## @@ -77,10 +69,6 @@ Got one of the listed errors COMMIT; connection slave; include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead ######################################################################################## # 4 - BEGIN - ROLLBACK ######################################################################################## @@ -97,10 +85,6 @@ Warnings: Warning 1196 Some non-transactional changed tables couldn't be rolled back connection slave; include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead ######################################################################################## # 5 - PROCEDURE ######################################################################################## @@ -127,10 +111,6 @@ Got one of the listed errors ROLLBACK; connection slave; include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead ######################################################################################## # 6 - XID ######################################################################################## @@ -151,10 +131,6 @@ Warning 1196 Some non-transactional changed tables couldn't be rolled back COMMIT; connection slave; include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead ######################################################################################## # 7 - NON-TRANS TABLE ######################################################################################## @@ -176,10 +152,6 @@ Got one of the listed errors COMMIT; connection slave; include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead ######################################################################## # 8 - Bug#55375(Regression Bug) Transaction bigger than # max_binlog_cache_size crashes slave diff --git a/mysql-test/suite/binlog_encryption/rpl_parallel.result b/mysql-test/suite/binlog_encryption/rpl_parallel.result index 20f3facea27..5f78a378829 100644 --- a/mysql-test/suite/binlog_encryption/rpl_parallel.result +++ b/mysql-test/suite/binlog_encryption/rpl_parallel.result @@ -1518,6 +1518,7 @@ SET SESSION debug_dbug="+d,binlog_force_commit_id"; SET @commit_id= 10000; ANALYZE TABLE t2; Table Op Msg_type Msg_text +test.t2 analyze status Engine-independent statistics collected test.t2 analyze status OK INSERT INTO t3 VALUES (120, 0); SET @commit_id= 10001; diff --git a/mysql-test/suite/binlog_encryption/rpl_special_charset.result b/mysql-test/suite/binlog_encryption/rpl_special_charset.result index 728f4114aa7..b947cf3484d 100644 --- a/mysql-test/suite/binlog_encryption/rpl_special_charset.result +++ b/mysql-test/suite/binlog_encryption/rpl_special_charset.result @@ -5,10 +5,6 @@ CREATE TABLE t1(i VARCHAR(20)); INSERT INTO t1 VALUES (0xFFFF); connection slave; include/diff_tables.inc [master:t1, slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead connection master; DROP TABLE t1; include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.result b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.result index 1dde93df372..3113eec9e10 100644 --- a/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.result +++ b/mysql-test/suite/binlog_encryption/rpl_stm_relay_ign_space.result @@ -2,9 +2,5 @@ include/master-slave.inc [connection master] include/assert.inc [Assert that relay log space is close to the limit] include/diff_tables.inc [master:test.t1,slave:test.t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead connection slave; include/rpl_end.inc diff --git a/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result index 2f7f1b07cb4..936f604be2e 100644 --- a/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result +++ b/mysql-test/suite/binlog_encryption/rpl_switch_stm_row_mixed.result @@ -140,7 +140,7 @@ create table t4 select * from t1 where 3 in (select 1 union select 2 union selec SET STATEMENT sql_mode = 'NO_ENGINE_SUBSTITUTION' FOR create table t5 select * from t1 where 3 in (select 1 union select 2 union select curdate() union select 3); Warnings: -Warning 1292 Incorrect datetime value: '3' +Warning 1292 Truncated incorrect datetime value: '3' insert ignore into t5 select UUID() from t1 where 3 in (select 1 union select 2 union select 3 union select * from t4); create procedure foo() begin diff --git a/mysql-test/suite/binlog_encryption/rpl_sync.result b/mysql-test/suite/binlog_encryption/rpl_sync.result index 90c90f269c6..1240c446164 100644 --- a/mysql-test/suite/binlog_encryption/rpl_sync.result +++ b/mysql-test/suite/binlog_encryption/rpl_sync.result @@ -29,10 +29,6 @@ include/start_slave.inc connection master; connection slave; include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead =====Corrupting the master.info=======; connection slave; include/stop_slave.inc @@ -51,10 +47,6 @@ include/start_slave.inc connection master; connection slave; include/diff_tables.inc [master:t1,slave:t1] -Warnings: -Warning 1287 ' INTO FROM...' instead -Warnings: -Warning 1287 ' INTO FROM...' instead =====Clean up=======; connection master; drop table t1; diff --git a/mysql-test/suite/binlog_encryption/rpl_typeconv.result b/mysql-test/suite/binlog_encryption/rpl_typeconv.result index cb50c69aa55..1ba259edf8e 100644 --- a/mysql-test/suite/binlog_encryption/rpl_typeconv.result +++ b/mysql-test/suite/binlog_encryption/rpl_typeconv.result @@ -47,6 +47,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS=''; # MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values # # End of MDEV-15833 +# +# MDEV-17098 DATE <-> DATETIME +# +# End of MDEV-17098 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; @@ -59,6 +63,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_NON_LOSSY'; # MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values # # End of MDEV-15833 +# +# MDEV-17098 DATE <-> DATETIME +# +# End of MDEV-17098 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; @@ -71,6 +79,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY'; # MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values # # End of MDEV-15833 +# +# MDEV-17098 DATE <-> DATETIME +# +# End of MDEV-17098 include/rpl_reset.inc connection slave; SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; @@ -83,6 +95,10 @@ SET GLOBAL SLAVE_TYPE_CONVERSIONS='ALL_LOSSY,ALL_NON_LOSSY'; # MDEV-15833 Row format replication between LONGBLOB and MEDIUMBLOB does not work for long values # # End of MDEV-15833 +# +# MDEV-17098 DATE <-> DATETIME +# +# End of MDEV-17098 include/rpl_reset.inc connection slave; **** Result of conversions **** @@ -244,6 +260,13 @@ LONGBLOB TINYBLOB LONGBLOB BLOB LONGBLOB MEDIUMBLOB LONGBLOB VARBINARY(65500 +DATE DATETIME(6) +DATE DATETIME(6) +DATE DATETIME(6) +DATE DATETIME(0) +DATETIME(6) DATE +DATETIME(6) DATE +DATETIME(0) DATE TINYBLOB TINYBLOB ALL_NON_LOSSY TINYBLOB BLOB ALL_NON_LOSSY TINYBLOB MEDIUMBLOB ALL_NON_LOSSY @@ -401,6 +424,13 @@ LONGBLOB TINYBLOB ALL_NON_LOSSY LONGBLOB BLOB ALL_NON_LOSSY LONGBLOB MEDIUMBLOB ALL_NON_LOSSY LONGBLOB VARBINARY(65500 ALL_NON_LOSSY +DATE DATETIME(6) ALL_NON_LOSSY +DATE DATETIME(6) ALL_NON_LOSSY +DATE DATETIME(6) ALL_NON_LOSSY +DATE DATETIME(0) ALL_NON_LOSSY +DATETIME(6) DATE ALL_NON_LOSSY +DATETIME(6) DATE ALL_NON_LOSSY +DATETIME(0) DATE ALL_NON_LOSSY TINYBLOB TINYBLOB ALL_LOSSY TINYBLOB BLOB ALL_LOSSY TINYBLOB MEDIUMBLOB ALL_LOSSY @@ -558,6 +588,13 @@ LONGBLOB TINYBLOB ALL_LOSSY LONGBLOB BLOB ALL_LOSSY LONGBLOB MEDIUMBLOB ALL_LOSSY LONGBLOB VARBINARY(65500 ALL_LOSSY +DATE DATETIME(6) ALL_LOSSY +DATE DATETIME(6) ALL_LOSSY +DATE DATETIME(6) ALL_LOSSY +DATE DATETIME(0) ALL_LOSSY +DATETIME(6) DATE ALL_LOSSY +DATETIME(6) DATE ALL_LOSSY +DATETIME(0) DATE ALL_LOSSY TINYBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY TINYBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY TINYBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY @@ -715,6 +752,13 @@ LONGBLOB TINYBLOB ALL_LOSSY,ALL_NON_LOSSY LONGBLOB BLOB ALL_LOSSY,ALL_NON_LOSSY LONGBLOB MEDIUMBLOB ALL_LOSSY,ALL_NON_LOSSY LONGBLOB VARBINARY(65500 ALL_LOSSY,ALL_NON_LOSSY +DATE DATETIME(6) ALL_LOSSY,ALL_NON_LOSSY +DATE DATETIME(6) ALL_LOSSY,ALL_NON_LOSSY +DATE DATETIME(6) ALL_LOSSY,ALL_NON_LOSSY +DATE DATETIME(0) ALL_LOSSY,ALL_NON_LOSSY +DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY +DATETIME(6) DATE ALL_LOSSY,ALL_NON_LOSSY +DATETIME(0) DATE ALL_LOSSY,ALL_NON_LOSSY DROP TABLE type_conversions; call mtr.add_suppression("Slave SQL.*Column 1 of table .test.t1. cannot be converted from type.* error.* 1677"); connection master; diff --git a/mysql-test/suite/compat/oracle/r/func_concat.result b/mysql-test/suite/compat/oracle/r/func_concat.result index b598f97006e..392d579707a 100644 --- a/mysql-test/suite/compat/oracle/r/func_concat.result +++ b/mysql-test/suite/compat/oracle/r/func_concat.result @@ -322,3 +322,72 @@ id select_type table type possible_keys key key_len ref rows filtered Extra 1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used Warnings: Note 1003 select concat_operator_oracle(-1,0 ^ 1) AS "a" +# +# MDEV-17359 Concatenation operator || in like expression failed in sql_mode=ORACLE +# +SELECT 'abc' LIKE 'a'||'%'; +'abc' LIKE 'a'||'%' +1 +EXPLAIN EXTENDED SELECT 'abc' LIKE 'a'||'%'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE NULL NULL NULL NULL NULL NULL NULL NULL No tables used +Warnings: +Note 1003 select 'abc' like concat_operator_oracle('a','%') AS "'abc' LIKE 'a'||'%'" +SELECT 'x' FROM DUAL WHERE 11 LIKE 1||1; +x +x +SELECT 'x' FROM DUAL WHERE 1||1 LIKE 11; +x +x +SELECT 'x' FROM DUAL WHERE 1||1 LIKE 1||1; +x +x +CREATE TABLE t1 (c1 VARCHAR(10),c2 VARCHAR(10), ord INTEGER); +INSERT INTO t1 VALUES ('a', 'ab' ,1); +INSERT INTO t1 VALUES ('ab', 'ab', 2); +INSERT INTO t1 VALUES ('abc', 'ab', 3); +SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord; +c1 +ab +EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort +Warnings: +Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like (concat_operator_oracle('%','b')) order by "test"."t1"."ord" +SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord; +c1 +abc +EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where; Using filesort +Warnings: +Note 1003 select "test"."t1"."c1" AS "c1" from "test"."t1" where "test"."t1"."c1" like concat_operator_oracle(concat_operator_oracle("test"."t1"."c2",'%'),'c') order by "test"."t1"."ord" +SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%'; +x +x +EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%'; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like 'aa%' +SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1; +x +x +EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using where +Warnings: +Note 1003 select 'x' AS "x" from "test"."t1" where concat_operator_oracle("test"."t1"."c1","test"."t1"."c2") like concat_operator_oracle("test"."t1"."c2","test"."t1"."c1") +CREATE VIEW v1 AS SELECT c1, c2, c1 LIKE c2||'_' FROM t1 ORDER BY ord; +SELECT * FROM v1; +c1 c2 c1 LIKE c2||'_' +a ab 0 +ab ab 0 +abc ab 1 +EXPLAIN EXTENDED SELECT * FROM v1; +id select_type table type possible_keys key key_len ref rows filtered Extra +1 SIMPLE t1 ALL NULL NULL NULL NULL 3 100.00 Using filesort +Warnings: +Note 1003 select "test"."t1"."c1" AS "c1","test"."t1"."c2" AS "c2","test"."t1"."c1" like concat_operator_oracle("test"."t1"."c2",'_') AS "c1 LIKE c2||'_'" from "test"."t1" order by "test"."t1"."ord" +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/r/parser.result b/mysql-test/suite/compat/oracle/r/parser.result index c8600c29bd4..1c60c1434a3 100644 --- a/mysql-test/suite/compat/oracle/r/parser.result +++ b/mysql-test/suite/compat/oracle/r/parser.result @@ -499,3 +499,113 @@ test.comment() Warnings: Note 1585 This function 'comment' has the same name as a native function DROP FUNCTION comment; +# +# MDEV-17660 sql_mode=ORACLE: Some keywords do not work as label names: history, system, versioning, without +# +BEGIN +<> +NULL; +END; +/ +BEGIN +<> +NULL; +END; +/ +BEGIN +<> +NULL; +END; +/ +BEGIN +<> +NULL; +END; +/ +BEGIN +<> +NULL; +END; +/ +BEGIN +<> +NULL; +END; +/ +# +# MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved +# +DECLARE +ELSEIF INT; +BEGIN +ELSEIF:=1; +END; +/ +BEGIN +<> +NULL; +END; +/ +# +# MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar +# +CREATE TABLE names (names INT); +SELECT names FROM names AS names; +names +DROP TABLE names; +CREATE TABLE password (password INT); +SELECT password FROM password AS password; +password +DROP TABLE password; +CREATE TABLE role (role INT); +SELECT role FROM role AS role; +role +DROP TABLE role; +DECLARE +names VARCHAR(32) DEFAULT '[names]'; +password VARCHAR(32) DEFAULT '[password]'; +role VARCHAR(32) DEFAULT '[role]'; +BEGIN +<> +SELECT names; +<> +SELECT password; +<> +SELECT role; +END; +$$ +names +[names] +password +[password] +role +[role] +DECLARE +names VARCHAR(32); +BEGIN +SET names='[names]'; +END; +$$ +ERROR 42000: Variable 'names' must be quoted with `...`, or renamed +DECLARE +password VARCHAR(32); +BEGIN +SET password='[password]'; +END; +$$ +ERROR 42000: Variable 'password' must be quoted with `...`, or renamed +DECLARE +role VARCHAR(32); +BEGIN +SET role='[role]'; +END; +$$ +SELECT @@GLOBAL.names; +ERROR HY000: Unknown system variable 'names' +SELECT @@GLOBAL.password; +ERROR HY000: Unknown system variable 'password' +SELECT @@GLOBAL.role; +ERROR HY000: Unknown system variable 'role' +# +# End of 10.3 tests +# diff --git a/mysql-test/suite/compat/oracle/r/sp-code.result b/mysql-test/suite/compat/oracle/r/sp-code.result index 1049563511c..1c6aacc8743 100644 --- a/mysql-test/suite/compat/oracle/r/sp-code.result +++ b/mysql-test/suite/compat/oracle/r/sp-code.result @@ -579,8 +579,8 @@ SHOW FUNCTION CODE f1; Pos Instruction 0 set total@2 0 1 set i@3 1 -2 set [upper_bound]@4 a@0 -3 jump_if_not 9(9) i@3 <= [upper_bound]@4 +2 set [target_bound]@4 a@0 +3 jump_if_not 9(9) i@3 <= [target_bound]@4 4 set total@2 total@2 + i@3 5 jump_if_not 7(7) i@3 = b@1 6 jump 9 @@ -598,7 +598,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT AS total INT := 0; BEGIN -FOR i IN REVERSE a..1 +FOR i IN REVERSE 1..a LOOP total:= total + i; IF i = b THEN @@ -612,8 +612,8 @@ SHOW FUNCTION CODE f1; Pos Instruction 0 set total@2 0 1 set i@3 a@0 -2 set [upper_bound]@4 1 -3 jump_if_not 9(9) i@3 >= [upper_bound]@4 +2 set [target_bound]@4 1 +3 jump_if_not 9(9) i@3 >= [target_bound]@4 4 set total@2 total@2 + i@3 5 jump_if_not 7(7) i@3 = b@1 6 jump 9 @@ -651,12 +651,12 @@ SHOW FUNCTION CODE f1; Pos Instruction 0 set total@4 0 1 set ia@5 1 -2 set [upper_bound]@6 a@0 -3 jump_if_not 17(17) ia@5 <= [upper_bound]@6 +2 set [target_bound]@6 a@0 +3 jump_if_not 17(17) ia@5 <= [target_bound]@6 4 set total@4 total@4 + 1000 5 set ib@7 1 -6 set [upper_bound]@8 b@2 -7 jump_if_not 15(15) ib@7 <= [upper_bound]@8 +6 set [target_bound]@8 b@2 +7 jump_if_not 15(15) ib@7 <= [target_bound]@8 8 set total@4 total@4 + 1 9 jump_if_not 11(0) ib@7 = limitb@3 10 jump 15 @@ -698,8 +698,8 @@ SHOW FUNCTION CODE f1; Pos Instruction 0 set total@1 0 1 set i@2 1 -2 set [upper_bound]@3 a@0 -3 jump_if_not 11(11) i@2 <= [upper_bound]@3 +2 set [target_bound]@3 a@0 +3 jump_if_not 11(11) i@2 <= [target_bound]@3 4 set total@1 total@1 + 1000 5 jump_if_not 8(8) i@2 = 5 6 set i@2 i@2 + 1 @@ -735,11 +735,11 @@ SHOW FUNCTION CODE f1; Pos Instruction 0 set total@1 0 1 set i@2 1 -2 set [upper_bound]@3 a@0 -3 jump_if_not 16(16) i@2 <= [upper_bound]@3 +2 set [target_bound]@3 a@0 +3 jump_if_not 16(16) i@2 <= [target_bound]@3 4 set j@4 1 -5 set [upper_bound]@5 2 -6 jump_if_not 14(14) j@4 <= [upper_bound]@5 +5 set [target_bound]@5 2 +6 jump_if_not 14(14) j@4 <= [target_bound]@5 7 set total@1 total@1 + 1000 8 jump_if_not 11(11) i@2 = 5 9 set i@2 i@2 + 1 @@ -778,11 +778,11 @@ SHOW FUNCTION CODE f1; Pos Instruction 0 set total@1 0 1 set j@2 1 -2 set [upper_bound]@3 2 -3 jump_if_not 16(16) j@2 <= [upper_bound]@3 +2 set [target_bound]@3 2 +3 jump_if_not 16(16) j@2 <= [target_bound]@3 4 set i@4 1 -5 set [upper_bound]@5 a@0 -6 jump_if_not 14(14) i@4 <= [upper_bound]@5 +5 set [target_bound]@5 a@0 +6 jump_if_not 14(14) i@4 <= [target_bound]@5 7 set total@1 total@1 + 1000 8 jump_if_not 11(11) i@4 = 5 9 set i@4 i@4 + 1 @@ -814,8 +814,8 @@ SHOW FUNCTION CODE f1; Pos Instruction 0 set total@1 0 1 set i@2 1 -2 set [upper_bound]@3 a@0 -3 jump_if_not 10(10) i@2 <= [upper_bound]@3 +2 set [target_bound]@3 a@0 +3 jump_if_not 10(10) i@2 <= [target_bound]@3 4 jump_if_not 7(0) i@2 = 5 5 set i@2 i@2 + 1 6 jump 3 diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result index 093d52ba4e3..a60bbc38883 100644 --- a/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result +++ b/mysql-test/suite/compat/oracle/r/sp-cursor-rowtype.result @@ -1479,3 +1479,28 @@ f1() 1 DROP FUNCTION f1; DROP TABLE t1; +# +# MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH) +# +CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c')); +INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c'); +CREATE PROCEDURE p1() +AS +BEGIN +FOR rec IN (SELECT en1 FROM t1) +LOOP +SELECT rec.en1; +END LOOP; +END; +$$ +CALL p1(); +rec.en1 +aaa +rec.en1 +a +rec.en1 +b +rec.en1 +c +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/r/sp-cursor.result b/mysql-test/suite/compat/oracle/r/sp-cursor.result index 03211509f8b..a09459ad7cd 100644 --- a/mysql-test/suite/compat/oracle/r/sp-cursor.result +++ b/mysql-test/suite/compat/oracle/r/sp-cursor.result @@ -459,7 +459,7 @@ CALL p1('b1'); msg Fetched a record a=0 Warnings: -Warning 1366 Incorrect integer value: 'b1' for column 'p_a' at row 1 +Warning 1366 Incorrect integer value: 'b1' for column ``.``.`p_a` at row 1 DROP PROCEDURE p1; # # One parameter in SELECT list + subselect @@ -949,3 +949,31 @@ def c%FOUND 3 1 0 Y 32896 0 63 def c%ROWCOUNT 8 21 1 Y 32896 0 63 c%ISOPEN c%NOTFOUND c%FOUND c%ROWCOUNT 1 NULL NULL 0 +# +# MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure +# +CREATE TABLE t1 +( +JOBN varchar(18) NOT NULL, +pk int(11) NOT NULL, +PRIMARY KEY (pk), +KEY (JOBN) +); +CREATE PROCEDURE p1 +AS +lS NUMBER(10) :=0; +CURSOR cBPD IS SELECT * FROM t1 WHERE JOBN='x'; +BEGIN +FOR lbpd IN cBPD LOOP +lS:=lS+1; +END LOOP; +EXCEPTION +WHEN OTHERS THEN +BEGIN +SELECT SQLERRM; +END; +END; +$$ +CALL p1(); +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/r/sp-package-mdl.result b/mysql-test/suite/compat/oracle/r/sp-package-mdl.result index 18cc834461c..bb46341f202 100644 --- a/mysql-test/suite/compat/oracle/r/sp-package-mdl.result +++ b/mysql-test/suite/compat/oracle/r/sp-package-mdl.result @@ -61,8 +61,8 @@ TABLE_NAME pkg1.p1 CONN 2 INFO DROP PACKAGE pkg1 STATE Waiting for stored package body metadata lock -LOCK_MODE MDL_INTENTION_EXCLUSIVE -LOCK_TYPE Global read lock +LOCK_MODE MDL_BACKUP_DDL +LOCK_TYPE Backup lock TABLE_NAME CONN 2 INFO DROP PACKAGE pkg1 diff --git a/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result b/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result index 1a8e01a992f..21bead42b0a 100644 --- a/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result +++ b/mysql-test/suite/compat/oracle/r/sp-package-mysqldump.result @@ -38,7 +38,7 @@ $$ /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */; /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */; /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */; -/*!40101 SET NAMES utf8 */; +/*!40101 SET NAMES utf8mb4 */; /*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */; /*!40103 SET TIME_ZONE='+00:00' */; /*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */; diff --git a/mysql-test/suite/compat/oracle/r/sp-package.result b/mysql-test/suite/compat/oracle/r/sp-package.result index 1ea53daf43a..4f0f05b1939 100644 --- a/mysql-test/suite/compat/oracle/r/sp-package.result +++ b/mysql-test/suite/compat/oracle/r/sp-package.result @@ -2878,3 +2878,51 @@ msg This is p01 DROP PACKAGE pkg1; DROP TABLE t1; +# +# MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure +# +CREATE TABLE t1 ( +CTR varchar(2) NOT NULL, +COR varchar(3) NOT NULL, +DATE datetime NOT NULL, +CHAN varchar(4) NOT NULL, +CNO varchar(20) NOT NULL, +JOBN varchar(18) NOT NULL, +C1 varchar(30) DEFAULT NULL, +C2 varchar(30) DEFAULT NULL, +TIME datetime DEFAULT NULL, +AMT decimal(12,2) DEFAULT NULL, +DT datetime NOT NULL, +pk int(11) NOT NULL, +PRIMARY KEY (pk), +KEY Indx1 (JOBN) +); +CREATE PACKAGE xyz IS +PROCEDURE xyz123(ctr IN VARCHAR2,Jn IN VARCHAR2,R OUT VARCHAR2); +END; +$$ +CREATE OR REPLACE PACKAGE BODY xyz IS +PROCEDURE xyz123( +ctr IN VARCHAR2, +Jn IN VARCHAR2, +R OUT VARCHAR2) +AS +lS NUMBER(10) :=0; +CURSOR cBPD IS +SELECT CTR, COR, DATE, CHAN, CNO, C1, C2, TIME, AMT +FROM t1 WHERE JOBN=Jn; +BEGIN +FOR lbpd IN cBPD +LOOP +lS:=lS+1; +END LOOP; +EXCEPTION +WHEN OTHERS THEN +BEGIN +SELECT SQLERRM; +END; +END; +END $$ +CALL xyz.xyz123(17,18,@R); +DROP PACKAGE xyz; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/r/sp.result b/mysql-test/suite/compat/oracle/r/sp.result index 5cdfd517562..6db999b238f 100644 --- a/mysql-test/suite/compat/oracle/r/sp.result +++ b/mysql-test/suite/compat/oracle/r/sp.result @@ -843,7 +843,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT AS total INT := 0; BEGIN -FOR i IN REVERSE a..1 +FOR i IN REVERSE 1..a LOOP total:= total + i; IF i = b THEN @@ -2494,3 +2494,61 @@ BEGIN SELECT 'a' IN ('b',v); END $$ ERROR HY000: Illegal parameter data types varchar and row for operation 'in' +# +# MDEV-17253 Oracle compatibility: The REVERSE key word for FOR loop behaves incorrectly +# +DECLARE +totalprice DECIMAL(12,2):=NULL; +loop_start INTEGER := 1; +BEGIN +FOR idx IN REVERSE loop_start..10 LOOP +SELECT idx; +END LOOP; +END; +$$ +idx +10 +idx +9 +idx +8 +idx +7 +idx +6 +idx +5 +idx +4 +idx +3 +idx +2 +idx +1 +CREATE PROCEDURE p1 AS +loop_start INTEGER := 1; +BEGIN +FOR idx IN REVERSE 3..loop_start LOOP +SELECT idx; +END LOOP; +END; +$$ +CALL p1(); +DROP PROCEDURE p1; +CREATE PROCEDURE p1 AS +loop_start INTEGER := 1; +BEGIN +FOR idx IN REVERSE loop_start..3 LOOP +SELECT idx; +END LOOP; +END; +$$ +CALL p1(); +idx +3 +idx +2 +idx +1 +DROP PROCEDURE p1; diff --git a/mysql-test/suite/compat/oracle/r/versioning.result b/mysql-test/suite/compat/oracle/r/versioning.result index ebedcf0f462..bbecfa1f6b1 100644 --- a/mysql-test/suite/compat/oracle/r/versioning.result +++ b/mysql-test/suite/compat/oracle/r/versioning.result @@ -14,3 +14,11 @@ SELECT * FROM t1 FOR SYSTEM_TIME AS OF (NOW()+INTERVAL 10 YEAR); a 20 DROP TABLE t1; +# +# MDEV-17959 Assertion `opt_bootstrap || mysql_parse_status || thd->lex->select_stack_top == 0' failed in parse_sql upon DELETE HISTORY under ORACLE mode +# +SET SQL_MODE= ORACLE; +CREATE TABLE t1 (a INT); +DELETE HISTORY FROM t1; +ERROR HY000: Table `t1` is not system-versioned +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/func_concat.test b/mysql-test/suite/compat/oracle/t/func_concat.test index 7f9fec4f2fe..5a613242e87 100644 --- a/mysql-test/suite/compat/oracle/t/func_concat.test +++ b/mysql-test/suite/compat/oracle/t/func_concat.test @@ -146,3 +146,39 @@ SELECT -1||0^1 AS a FROM DUAL; EXPLAIN EXTENDED SELECT -1^1||1 AS a FROM DUAL; EXPLAIN EXTENDED SELECT -1||0^1 AS a FROM DUAL; + + +--echo # +--echo # MDEV-17359 Concatenation operator || in like expression failed in sql_mode=ORACLE +--echo # + +SELECT 'abc' LIKE 'a'||'%'; +EXPLAIN EXTENDED SELECT 'abc' LIKE 'a'||'%'; + +SELECT 'x' FROM DUAL WHERE 11 LIKE 1||1; +SELECT 'x' FROM DUAL WHERE 1||1 LIKE 11; +SELECT 'x' FROM DUAL WHERE 1||1 LIKE 1||1; + +CREATE TABLE t1 (c1 VARCHAR(10),c2 VARCHAR(10), ord INTEGER); +INSERT INTO t1 VALUES ('a', 'ab' ,1); +INSERT INTO t1 VALUES ('ab', 'ab', 2); +INSERT INTO t1 VALUES ('abc', 'ab', 3); + +SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord; +EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE '%'||'b' ORDER BY ord; + +SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord; +EXPLAIN EXTENDED SELECT c1 FROM t1 WHERE c1 LIKE c2||'%'||'c' ORDER BY ord; + +SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%'; +EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE 'aa%'; + +SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1; +EXPLAIN EXTENDED SELECT 'x' FROM t1 WHERE c1||c2 LIKE c2||c1; + +CREATE VIEW v1 AS SELECT c1, c2, c1 LIKE c2||'_' FROM t1 ORDER BY ord; +SELECT * FROM v1; +EXPLAIN EXTENDED SELECT * FROM v1; + +DROP VIEW v1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/parser.test b/mysql-test/suite/compat/oracle/t/parser.test index 86b6b270ccd..067fd9beb48 100644 --- a/mysql-test/suite/compat/oracle/t/parser.test +++ b/mysql-test/suite/compat/oracle/t/parser.test @@ -258,3 +258,157 @@ enable_prepare_warnings; SELECT test.comment() FROM DUAL; disable_prepare_warnings; DROP FUNCTION comment; + + +--echo # +--echo # MDEV-17660 sql_mode=ORACLE: Some keywords do not work as label names: history, system, versioning, without +--echo # + +DELIMITER /; +BEGIN +<> + NULL; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +BEGIN +<> + NULL; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +BEGIN +<> + NULL; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +BEGIN +<> + NULL; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +BEGIN +<> + NULL; +END; +/ +DELIMITER ;/ + + +DELIMITER /; +BEGIN +<> + NULL; +END; +/ +DELIMITER ;/ + + +--echo # +--echo # MDEV-17666 sql_mode=ORACLE: Keyword ELSEIF should not be reserved +--echo # + +DELIMITER /; +DECLARE + ELSEIF INT; +BEGIN + ELSEIF:=1; +END; +/ +DELIMITER ;/ + +DELIMITER /; +BEGIN +<> + NULL; +END; +/ +DELIMITER ;/ + + +--echo # +--echo # MDEV-17693 Shift/reduce conflicts for NAMES,ROLE,PASSWORD in the option_value_no_option_type grammar +--echo # + +CREATE TABLE names (names INT); +SELECT names FROM names AS names; +DROP TABLE names; + +CREATE TABLE password (password INT); +SELECT password FROM password AS password; +DROP TABLE password; + +CREATE TABLE role (role INT); +SELECT role FROM role AS role; +DROP TABLE role; + +DELIMITER $$; +DECLARE + names VARCHAR(32) DEFAULT '[names]'; + password VARCHAR(32) DEFAULT '[password]'; + role VARCHAR(32) DEFAULT '[role]'; +BEGIN +<> + SELECT names; +<> + SELECT password; +<> + SELECT role; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +--error ER_SP_BAD_VAR_SHADOW +DECLARE + names VARCHAR(32); +BEGIN + SET names='[names]'; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +--error ER_SP_BAD_VAR_SHADOW +DECLARE + password VARCHAR(32); +BEGIN + SET password='[password]'; +END; +$$ +DELIMITER ;$$ + +DELIMITER $$; +DECLARE + role VARCHAR(32); +BEGIN + SET role='[role]'; +END; +$$ +DELIMITER ;$$ + +--error ER_UNKNOWN_SYSTEM_VARIABLE +SELECT @@GLOBAL.names; +--error ER_UNKNOWN_SYSTEM_VARIABLE +SELECT @@GLOBAL.password; +--error ER_UNKNOWN_SYSTEM_VARIABLE +SELECT @@GLOBAL.role; + + +--echo # +--echo # End of 10.3 tests +--echo # diff --git a/mysql-test/suite/compat/oracle/t/sp-code.test b/mysql-test/suite/compat/oracle/t/sp-code.test index 9a1f64e54b4..ea66ed80d2a 100644 --- a/mysql-test/suite/compat/oracle/t/sp-code.test +++ b/mysql-test/suite/compat/oracle/t/sp-code.test @@ -470,7 +470,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT AS total INT := 0; BEGIN - FOR i IN REVERSE a..1 + FOR i IN REVERSE 1..a LOOP total:= total + i; IF i = b THEN diff --git a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test index 31e28d5c8de..ba0ca9b6a60 100644 --- a/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test +++ b/mysql-test/suite/compat/oracle/t/sp-cursor-rowtype.test @@ -1572,3 +1572,26 @@ DELIMITER ;$$ SELECT f1(); DROP FUNCTION f1; DROP TABLE t1; + + +--echo # +--echo # MDEV-17278 CURSOR FOR LOOP - ERROR: unexpected end of stream, read 0 bytes (SERVER CRASH) +--echo # + +CREATE TABLE t1 (id2 int, id int, en1 enum('aaa','a','b','c')); +INSERT INTO t1 VALUES(1,1,'aaa'),(2,2,'a'),(3,3,'b'),(4,4,'c'); + +DELIMITER $$; +CREATE PROCEDURE p1() +AS +BEGIN + FOR rec IN (SELECT en1 FROM t1) + LOOP + SELECT rec.en1; + END LOOP; +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/sp-cursor.test b/mysql-test/suite/compat/oracle/t/sp-cursor.test index 5a8b7b69f67..03b8b016ee0 100644 --- a/mysql-test/suite/compat/oracle/t/sp-cursor.test +++ b/mysql-test/suite/compat/oracle/t/sp-cursor.test @@ -952,3 +952,38 @@ $$ DELIMITER ;$$ --enable_ps_protocol --disable_metadata + + +--echo # +--echo # MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure +--echo # + +CREATE TABLE t1 +( + JOBN varchar(18) NOT NULL, + pk int(11) NOT NULL, + PRIMARY KEY (pk), + KEY (JOBN) +); + +DELIMITER $$; +CREATE PROCEDURE p1 +AS + lS NUMBER(10) :=0; + CURSOR cBPD IS SELECT * FROM t1 WHERE JOBN='x'; +BEGIN + FOR lbpd IN cBPD LOOP + lS:=lS+1; + END LOOP; +EXCEPTION + WHEN OTHERS THEN + BEGIN + SELECT SQLERRM; + END; +END; +$$ +DELIMITER ;$$ + +CALL p1(); +DROP PROCEDURE p1; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/sp-package-mysqldump.test b/mysql-test/suite/compat/oracle/t/sp-package-mysqldump.test index 8f50c1fc4b0..6f3d7964521 100644 --- a/mysql-test/suite/compat/oracle/t/sp-package-mysqldump.test +++ b/mysql-test/suite/compat/oracle/t/sp-package-mysqldump.test @@ -1,3 +1,4 @@ +--source include/have_utf8mb4.inc --source include/not_embedded.inc SET sql_mode=ORACLE; diff --git a/mysql-test/suite/compat/oracle/t/sp-package.test b/mysql-test/suite/compat/oracle/t/sp-package.test index e61dd37467c..04357a7487a 100644 --- a/mysql-test/suite/compat/oracle/t/sp-package.test +++ b/mysql-test/suite/compat/oracle/t/sp-package.test @@ -2624,3 +2624,60 @@ DELIMITER ;$$ CALL pkg1.p00; DROP PACKAGE pkg1; DROP TABLE t1; + + +--echo # +--echo # MDEV-17387 MariaDB Server giving wrong error while executing select query from procedure +--echo # + +CREATE TABLE t1 ( + CTR varchar(2) NOT NULL, + COR varchar(3) NOT NULL, + DATE datetime NOT NULL, + CHAN varchar(4) NOT NULL, + CNO varchar(20) NOT NULL, + JOBN varchar(18) NOT NULL, + C1 varchar(30) DEFAULT NULL, + C2 varchar(30) DEFAULT NULL, + TIME datetime DEFAULT NULL, + AMT decimal(12,2) DEFAULT NULL, + DT datetime NOT NULL, + pk int(11) NOT NULL, + PRIMARY KEY (pk), + KEY Indx1 (JOBN) +); + +DELIMITER $$; + +CREATE PACKAGE xyz IS + PROCEDURE xyz123(ctr IN VARCHAR2,Jn IN VARCHAR2,R OUT VARCHAR2); +END; +$$ + +CREATE OR REPLACE PACKAGE BODY xyz IS + PROCEDURE xyz123( + ctr IN VARCHAR2, + Jn IN VARCHAR2, + R OUT VARCHAR2) + AS + lS NUMBER(10) :=0; + CURSOR cBPD IS + SELECT CTR, COR, DATE, CHAN, CNO, C1, C2, TIME, AMT + FROM t1 WHERE JOBN=Jn; + BEGIN + FOR lbpd IN cBPD + LOOP + lS:=lS+1; + END LOOP; + EXCEPTION + WHEN OTHERS THEN + BEGIN + SELECT SQLERRM; + END; + END; +END $$ +DELIMITER ;$$ + +CALL xyz.xyz123(17,18,@R); +DROP PACKAGE xyz; +DROP TABLE t1; diff --git a/mysql-test/suite/compat/oracle/t/sp.test b/mysql-test/suite/compat/oracle/t/sp.test index de2a4a5e4e7..96b4cd59fbd 100644 --- a/mysql-test/suite/compat/oracle/t/sp.test +++ b/mysql-test/suite/compat/oracle/t/sp.test @@ -918,7 +918,7 @@ CREATE FUNCTION f1 (a INT, b INT) RETURN INT AS total INT := 0; BEGIN - FOR i IN REVERSE a..1 + FOR i IN REVERSE 1..a LOOP total:= total + i; IF i = b THEN @@ -2344,3 +2344,46 @@ BEGIN END $$ DELIMITER ;$$ +--echo # +--echo # MDEV-17253 Oracle compatibility: The REVERSE key word for FOR loop behaves incorrectly +--echo # + +DELIMITER $$; +DECLARE + totalprice DECIMAL(12,2):=NULL; + loop_start INTEGER := 1; +BEGIN + FOR idx IN REVERSE loop_start..10 LOOP + SELECT idx; + END LOOP; +END; +$$ +DELIMITER ;$$ + + +DELIMITER $$; +CREATE PROCEDURE p1 AS + loop_start INTEGER := 1; +BEGIN + FOR idx IN REVERSE 3..loop_start LOOP + SELECT idx; + END LOOP; +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; + + +DELIMITER $$; +CREATE PROCEDURE p1 AS + loop_start INTEGER := 1; +BEGIN + FOR idx IN REVERSE loop_start..3 LOOP + SELECT idx; + END LOOP; +END; +$$ +DELIMITER ;$$ +CALL p1(); +DROP PROCEDURE p1; diff --git a/mysql-test/suite/compat/oracle/t/versioning.test b/mysql-test/suite/compat/oracle/t/versioning.test index d70058c56e4..abcca8c588a 100644 --- a/mysql-test/suite/compat/oracle/t/versioning.test +++ b/mysql-test/suite/compat/oracle/t/versioning.test @@ -11,3 +11,13 @@ INSERT INTO t1 VALUES (20); SELECT * FROM t1 FOR SYSTEM_TIME ALL; SELECT * FROM t1 FOR SYSTEM_TIME AS OF (NOW()+INTERVAL 10 YEAR); DROP TABLE t1; + +--echo # +--echo # MDEV-17959 Assertion `opt_bootstrap || mysql_parse_status || thd->lex->select_stack_top == 0' failed in parse_sql upon DELETE HISTORY under ORACLE mode +--echo # + +SET SQL_MODE= ORACLE; +CREATE TABLE t1 (a INT); +--error ER_VERS_NOT_VERSIONED +DELETE HISTORY FROM t1; +DROP TABLE t1; diff --git a/mysql-test/suite/csv/flush.result b/mysql-test/suite/csv/flush.result new file mode 100644 index 00000000000..b0b9b21bd0a --- /dev/null +++ b/mysql-test/suite/csv/flush.result @@ -0,0 +1,25 @@ +CREATE TABLE t1(a INT NOT NULL) ENGINE=csv; +INSERT INTO t1 VALUES(1); +connect con1, localhost, root; +LOCK TABLE t1 READ; +connection default; +FLUSH TABLES WITH READ LOCK; +UNLOCK TABLES; +# Must return 1 row +SELECT * FROM t2; +a +1 +SELECT * FROM t1; +a +1 +connection con1; +UNLOCK TABLES; +connection default; +INSERT INTO t2 VALUES(2); +INSERT INTO t2 VALUES(2); +SELECT * from t1,t2; +a a +1 1 +1 2 +1 2 +DROP TABLE t1, t2; diff --git a/mysql-test/suite/csv/flush.test b/mysql-test/suite/csv/flush.test new file mode 100644 index 00000000000..934ac26f291 --- /dev/null +++ b/mysql-test/suite/csv/flush.test @@ -0,0 +1,30 @@ +--source include/have_csv.inc + +let $MYSQLD_DATADIR= `SELECT @@datadir`; +CREATE TABLE t1(a INT NOT NULL) ENGINE=csv; +INSERT INTO t1 VALUES(1); +# works correct if uncommented +#FLUSH TABLE t1; + +connect(con1, localhost, root); +LOCK TABLE t1 READ; + +connection default; +FLUSH TABLES WITH READ LOCK; +copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t2.frm; +copy_file $MYSQLD_DATADIR/test/t1.CSV $MYSQLD_DATADIR/test/t2.CSV; +copy_file $MYSQLD_DATADIR/test/t1.CSM $MYSQLD_DATADIR/test/t2.CSM; +UNLOCK TABLES; +--echo # Must return 1 row +SELECT * FROM t2; +SELECT * FROM t1; +connection con1; +UNLOCK TABLES; + +connection default; + +INSERT INTO t2 VALUES(2); +INSERT INTO t2 VALUES(2); +SELECT * from t1,t2; + +DROP TABLE t1, t2; diff --git a/mysql-test/suite/encryption/disabled.def b/mysql-test/suite/encryption/disabled.def index d92d3495cb8..746faf49873 100644 --- a/mysql-test/suite/encryption/disabled.def +++ b/mysql-test/suite/encryption/disabled.def @@ -12,3 +12,4 @@ innodb_scrub : MDEV-8139 scrubbing does not work reliably innodb_scrub_background : MDEV-8139 scrubbing does not work reliably +innodb-redo-badkey : MDEV-13893/MDEV-12699 fix recovery of corrupted pages diff --git a/mysql-test/suite/encryption/r/innodb-bad-key-change.result b/mysql-test/suite/encryption/r/innodb-bad-key-change.result index 179be43cc41..5812ff6dce9 100644 --- a/mysql-test/suite/encryption/r/innodb-bad-key-change.result +++ b/mysql-test/suite/encryption/r/innodb-bad-key-change.result @@ -3,6 +3,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); # Start server with keys2.txt SET GLOBAL innodb_file_per_table = ON; diff --git a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result index cca3b9ad686..afb79dbad8a 100644 --- a/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result +++ b/mysql-test/suite/encryption/r/innodb-checksum-algorithm.result @@ -58,31 +58,6 @@ tpe_crc32.cfg tpe_crc32.frm tpe_crc32.ibd UNLOCK TABLES; -SET GLOBAL innodb_checksum_algorithm=strict_crc32; -ALTER TABLE tce_crc32 DISCARD TABLESPACE; -ALTER TABLE tc_crc32 DISCARD TABLESPACE; -ALTER TABLE te_crc32 DISCARD TABLESPACE; -ALTER TABLE t_crc32 DISCARD TABLESPACE; -ALTER TABLE tpe_crc32 DISCARD TABLESPACE; -ALTER TABLE tp_crc32 DISCARD TABLESPACE; -restore: tce_crc32 .ibd and .cfg files -restore: tc_crc32 .ibd and .cfg files -restore: te_crc32 .ibd and .cfg files -restore: t_crc32 .ibd and .cfg files -restore: tpe_crc32 .ibd and .cfg files -restore: tp_crc32 .ibd and .cfg files -ALTER TABLE tce_crc32 IMPORT TABLESPACE; -update tce_crc32 set b=substr(b,1); -ALTER TABLE tc_crc32 IMPORT TABLESPACE; -update tc_crc32 set b=substr(b,1); -ALTER TABLE te_crc32 IMPORT TABLESPACE; -update te_crc32 set b=substr(b,1); -ALTER TABLE t_crc32 IMPORT TABLESPACE; -update t_crc32 set b=substr(b,1); -ALTER TABLE tpe_crc32 IMPORT TABLESPACE; -update tpe_crc32 set b=substr(b,1); -ALTER TABLE tp_crc32 IMPORT TABLESPACE; -update tp_crc32 set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=crc32; ALTER TABLE tce_crc32 DISCARD TABLESPACE; ALTER TABLE tc_crc32 DISCARD TABLESPACE; @@ -108,31 +83,6 @@ ALTER TABLE tpe_crc32 IMPORT TABLESPACE; update tpe_crc32 set b=substr(b,1); ALTER TABLE tp_crc32 IMPORT TABLESPACE; update tp_crc32 set b=substr(b,1); -SET GLOBAL innodb_checksum_algorithm=strict_innodb; -ALTER TABLE tce_crc32 DISCARD TABLESPACE; -ALTER TABLE tc_crc32 DISCARD TABLESPACE; -ALTER TABLE te_crc32 DISCARD TABLESPACE; -ALTER TABLE t_crc32 DISCARD TABLESPACE; -ALTER TABLE tpe_crc32 DISCARD TABLESPACE; -ALTER TABLE tp_crc32 DISCARD TABLESPACE; -restore: tce_crc32 .ibd and .cfg files -restore: tc_crc32 .ibd and .cfg files -restore: te_crc32 .ibd and .cfg files -restore: t_crc32 .ibd and .cfg files -restore: tpe_crc32 .ibd and .cfg files -restore: tp_crc32 .ibd and .cfg files -ALTER TABLE tce_crc32 IMPORT TABLESPACE; -update tce_crc32 set b=substr(b,1); -ALTER TABLE tc_crc32 IMPORT TABLESPACE; -update tc_crc32 set b=substr(b,1); -ALTER TABLE te_crc32 IMPORT TABLESPACE; -update te_crc32 set b=substr(b,1); -ALTER TABLE t_crc32 IMPORT TABLESPACE; -update t_crc32 set b=substr(b,1); -ALTER TABLE tpe_crc32 IMPORT TABLESPACE; -update tpe_crc32 set b=substr(b,1); -ALTER TABLE tp_crc32 IMPORT TABLESPACE; -update tp_crc32 set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=innodb; ALTER TABLE tce_crc32 DISCARD TABLESPACE; ALTER TABLE tc_crc32 DISCARD TABLESPACE; @@ -158,31 +108,6 @@ ALTER TABLE tpe_crc32 IMPORT TABLESPACE; update tpe_crc32 set b=substr(b,1); ALTER TABLE tp_crc32 IMPORT TABLESPACE; update tp_crc32 set b=substr(b,1); -SET GLOBAL innodb_checksum_algorithm=strict_none; -ALTER TABLE tce_crc32 DISCARD TABLESPACE; -ALTER TABLE tc_crc32 DISCARD TABLESPACE; -ALTER TABLE te_crc32 DISCARD TABLESPACE; -ALTER TABLE t_crc32 DISCARD TABLESPACE; -ALTER TABLE tpe_crc32 DISCARD TABLESPACE; -ALTER TABLE tp_crc32 DISCARD TABLESPACE; -restore: tce_crc32 .ibd and .cfg files -restore: tc_crc32 .ibd and .cfg files -restore: te_crc32 .ibd and .cfg files -restore: t_crc32 .ibd and .cfg files -restore: tpe_crc32 .ibd and .cfg files -restore: tp_crc32 .ibd and .cfg files -ALTER TABLE tce_crc32 IMPORT TABLESPACE; -update tce_crc32 set b=substr(b,1); -ALTER TABLE tc_crc32 IMPORT TABLESPACE; -update tc_crc32 set b=substr(b,1); -ALTER TABLE te_crc32 IMPORT TABLESPACE; -update te_crc32 set b=substr(b,1); -ALTER TABLE t_crc32 IMPORT TABLESPACE; -update t_crc32 set b=substr(b,1); -ALTER TABLE tpe_crc32 IMPORT TABLESPACE; -update tpe_crc32 set b=substr(b,1); -ALTER TABLE tp_crc32 IMPORT TABLESPACE; -update tp_crc32 set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=none; ALTER TABLE tce_crc32 DISCARD TABLESPACE; ALTER TABLE tc_crc32 DISCARD TABLESPACE; @@ -268,31 +193,6 @@ tpe_innodb.cfg tpe_innodb.frm tpe_innodb.ibd UNLOCK TABLES; -SET GLOBAL innodb_checksum_algorithm=strict_crc32; -ALTER TABLE tce_innodb DISCARD TABLESPACE; -ALTER TABLE tc_innodb DISCARD TABLESPACE; -ALTER TABLE te_innodb DISCARD TABLESPACE; -ALTER TABLE t_innodb DISCARD TABLESPACE; -ALTER TABLE tpe_innodb DISCARD TABLESPACE; -ALTER TABLE tp_innodb DISCARD TABLESPACE; -restore: tce_innodb .ibd and .cfg files -restore: tc_innodb .ibd and .cfg files -restore: te_innodb .ibd and .cfg files -restore: t_innodb .ibd and .cfg files -restore: tpe_innodb .ibd and .cfg files -restore: tp_innodb .ibd and .cfg files -ALTER TABLE tce_innodb IMPORT TABLESPACE; -update tce_innodb set b=substr(b,1); -ALTER TABLE tc_innodb IMPORT TABLESPACE; -update tc_innodb set b=substr(b,1); -ALTER TABLE te_innodb IMPORT TABLESPACE; -update te_innodb set b=substr(b,1); -ALTER TABLE t_innodb IMPORT TABLESPACE; -update t_innodb set b=substr(b,1); -ALTER TABLE tpe_innodb IMPORT TABLESPACE; -update tpe_innodb set b=substr(b,1); -ALTER TABLE tp_innodb IMPORT TABLESPACE; -update tp_innodb set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=crc32; ALTER TABLE tce_innodb DISCARD TABLESPACE; ALTER TABLE tc_innodb DISCARD TABLESPACE; @@ -318,31 +218,6 @@ ALTER TABLE tpe_innodb IMPORT TABLESPACE; update tpe_innodb set b=substr(b,1); ALTER TABLE tp_innodb IMPORT TABLESPACE; update tp_innodb set b=substr(b,1); -SET GLOBAL innodb_checksum_algorithm=strict_innodb; -ALTER TABLE tce_innodb DISCARD TABLESPACE; -ALTER TABLE tc_innodb DISCARD TABLESPACE; -ALTER TABLE te_innodb DISCARD TABLESPACE; -ALTER TABLE t_innodb DISCARD TABLESPACE; -ALTER TABLE tpe_innodb DISCARD TABLESPACE; -ALTER TABLE tp_innodb DISCARD TABLESPACE; -restore: tce_innodb .ibd and .cfg files -restore: tc_innodb .ibd and .cfg files -restore: te_innodb .ibd and .cfg files -restore: t_innodb .ibd and .cfg files -restore: tpe_innodb .ibd and .cfg files -restore: tp_innodb .ibd and .cfg files -ALTER TABLE tce_innodb IMPORT TABLESPACE; -update tce_innodb set b=substr(b,1); -ALTER TABLE tc_innodb IMPORT TABLESPACE; -update tc_innodb set b=substr(b,1); -ALTER TABLE te_innodb IMPORT TABLESPACE; -update te_innodb set b=substr(b,1); -ALTER TABLE t_innodb IMPORT TABLESPACE; -update t_innodb set b=substr(b,1); -ALTER TABLE tpe_innodb IMPORT TABLESPACE; -update tpe_innodb set b=substr(b,1); -ALTER TABLE tp_innodb IMPORT TABLESPACE; -update tp_innodb set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=innodb; ALTER TABLE tce_innodb DISCARD TABLESPACE; ALTER TABLE tc_innodb DISCARD TABLESPACE; @@ -368,31 +243,6 @@ ALTER TABLE tpe_innodb IMPORT TABLESPACE; update tpe_innodb set b=substr(b,1); ALTER TABLE tp_innodb IMPORT TABLESPACE; update tp_innodb set b=substr(b,1); -SET GLOBAL innodb_checksum_algorithm=strict_none; -ALTER TABLE tce_innodb DISCARD TABLESPACE; -ALTER TABLE tc_innodb DISCARD TABLESPACE; -ALTER TABLE te_innodb DISCARD TABLESPACE; -ALTER TABLE t_innodb DISCARD TABLESPACE; -ALTER TABLE tpe_innodb DISCARD TABLESPACE; -ALTER TABLE tp_innodb DISCARD TABLESPACE; -restore: tce_innodb .ibd and .cfg files -restore: tc_innodb .ibd and .cfg files -restore: te_innodb .ibd and .cfg files -restore: t_innodb .ibd and .cfg files -restore: tpe_innodb .ibd and .cfg files -restore: tp_innodb .ibd and .cfg files -ALTER TABLE tce_innodb IMPORT TABLESPACE; -update tce_innodb set b=substr(b,1); -ALTER TABLE tc_innodb IMPORT TABLESPACE; -update tc_innodb set b=substr(b,1); -ALTER TABLE te_innodb IMPORT TABLESPACE; -update te_innodb set b=substr(b,1); -ALTER TABLE t_innodb IMPORT TABLESPACE; -update t_innodb set b=substr(b,1); -ALTER TABLE tpe_innodb IMPORT TABLESPACE; -update tpe_innodb set b=substr(b,1); -ALTER TABLE tp_innodb IMPORT TABLESPACE; -update tp_innodb set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=none; ALTER TABLE tce_innodb DISCARD TABLESPACE; ALTER TABLE tc_innodb DISCARD TABLESPACE; @@ -478,31 +328,6 @@ tpe_none.cfg tpe_none.frm tpe_none.ibd UNLOCK TABLES; -SET GLOBAL innodb_checksum_algorithm=strict_crc32; -ALTER TABLE tce_none DISCARD TABLESPACE; -ALTER TABLE tc_none DISCARD TABLESPACE; -ALTER TABLE te_none DISCARD TABLESPACE; -ALTER TABLE t_none DISCARD TABLESPACE; -ALTER TABLE tpe_none DISCARD TABLESPACE; -ALTER TABLE tp_none DISCARD TABLESPACE; -restore: tce_none .ibd and .cfg files -restore: tc_none .ibd and .cfg files -restore: te_none .ibd and .cfg files -restore: t_none .ibd and .cfg files -restore: tpe_none .ibd and .cfg files -restore: tp_none .ibd and .cfg files -ALTER TABLE tce_none IMPORT TABLESPACE; -update tce_none set b=substr(b,1); -ALTER TABLE tc_none IMPORT TABLESPACE; -update tc_none set b=substr(b,1); -ALTER TABLE te_none IMPORT TABLESPACE; -update te_none set b=substr(b,1); -ALTER TABLE t_none IMPORT TABLESPACE; -update t_none set b=substr(b,1); -ALTER TABLE tpe_none IMPORT TABLESPACE; -update tpe_none set b=substr(b,1); -ALTER TABLE tp_none IMPORT TABLESPACE; -update tp_none set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=crc32; ALTER TABLE tce_none DISCARD TABLESPACE; ALTER TABLE tc_none DISCARD TABLESPACE; @@ -528,31 +353,6 @@ ALTER TABLE tpe_none IMPORT TABLESPACE; update tpe_none set b=substr(b,1); ALTER TABLE tp_none IMPORT TABLESPACE; update tp_none set b=substr(b,1); -SET GLOBAL innodb_checksum_algorithm=strict_innodb; -ALTER TABLE tce_none DISCARD TABLESPACE; -ALTER TABLE tc_none DISCARD TABLESPACE; -ALTER TABLE te_none DISCARD TABLESPACE; -ALTER TABLE t_none DISCARD TABLESPACE; -ALTER TABLE tpe_none DISCARD TABLESPACE; -ALTER TABLE tp_none DISCARD TABLESPACE; -restore: tce_none .ibd and .cfg files -restore: tc_none .ibd and .cfg files -restore: te_none .ibd and .cfg files -restore: t_none .ibd and .cfg files -restore: tpe_none .ibd and .cfg files -restore: tp_none .ibd and .cfg files -ALTER TABLE tce_none IMPORT TABLESPACE; -update tce_none set b=substr(b,1); -ALTER TABLE tc_none IMPORT TABLESPACE; -update tc_none set b=substr(b,1); -ALTER TABLE te_none IMPORT TABLESPACE; -update te_none set b=substr(b,1); -ALTER TABLE t_none IMPORT TABLESPACE; -update t_none set b=substr(b,1); -ALTER TABLE tpe_none IMPORT TABLESPACE; -update tpe_none set b=substr(b,1); -ALTER TABLE tp_none IMPORT TABLESPACE; -update tp_none set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=innodb; ALTER TABLE tce_none DISCARD TABLESPACE; ALTER TABLE tc_none DISCARD TABLESPACE; @@ -578,31 +378,6 @@ ALTER TABLE tpe_none IMPORT TABLESPACE; update tpe_none set b=substr(b,1); ALTER TABLE tp_none IMPORT TABLESPACE; update tp_none set b=substr(b,1); -SET GLOBAL innodb_checksum_algorithm=strict_none; -ALTER TABLE tce_none DISCARD TABLESPACE; -ALTER TABLE tc_none DISCARD TABLESPACE; -ALTER TABLE te_none DISCARD TABLESPACE; -ALTER TABLE t_none DISCARD TABLESPACE; -ALTER TABLE tpe_none DISCARD TABLESPACE; -ALTER TABLE tp_none DISCARD TABLESPACE; -restore: tce_none .ibd and .cfg files -restore: tc_none .ibd and .cfg files -restore: te_none .ibd and .cfg files -restore: t_none .ibd and .cfg files -restore: tpe_none .ibd and .cfg files -restore: tp_none .ibd and .cfg files -ALTER TABLE tce_none IMPORT TABLESPACE; -update tce_none set b=substr(b,1); -ALTER TABLE tc_none IMPORT TABLESPACE; -update tc_none set b=substr(b,1); -ALTER TABLE te_none IMPORT TABLESPACE; -update te_none set b=substr(b,1); -ALTER TABLE t_none IMPORT TABLESPACE; -update t_none set b=substr(b,1); -ALTER TABLE tpe_none IMPORT TABLESPACE; -update tpe_none set b=substr(b,1); -ALTER TABLE tp_none IMPORT TABLESPACE; -update tp_none set b=substr(b,1); SET GLOBAL innodb_checksum_algorithm=none; ALTER TABLE tce_none DISCARD TABLESPACE; ALTER TABLE tc_none DISCARD TABLESPACE; diff --git a/mysql-test/suite/encryption/r/innodb-encryption-alter.result b/mysql-test/suite/encryption/r/innodb-encryption-alter.result index fcc87493976..995360a5744 100644 --- a/mysql-test/suite/encryption/r/innodb-encryption-alter.result +++ b/mysql-test/suite/encryption/r/innodb-encryption-alter.result @@ -48,3 +48,66 @@ Warning 140 InnoDB: ENCRYPTION_KEY_ID 99 not available Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' set innodb_default_encryption_key_id = 1; drop table t1,t2; +SET GLOBAL innodb_encrypt_tables=OFF; +CREATE TABLE t1 (a int not null primary key) engine=innodb; +ALTER TABLE t1 ENCRYPTION_KEY_ID=4; +ERROR HY000: Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' +SHOW WARNINGS; +Level Code Message +Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1 +Error 1478 Table storage engine 'InnoDB' does not support the create option 'ENCRYPTION_KEY_ID' +SHOW CREATE TABLE t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +DROP TABLE t1; +CREATE TABLE t2 (a int not null primary key) engine=innodb; +ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY; +ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") +SHOW WARNINGS; +Level Code Message +Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1 +Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +SHOW CREATE TABLE t2; +Table Create Table +t2 CREATE TABLE `t2` ( + `a` int(11) NOT NULL, + PRIMARY KEY (`a`) +) ENGINE=InnoDB DEFAULT CHARSET=latin1 +CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4; +ERROR HY000: Can't create table `test`.`t3` (errno: 140 "Wrong create options") +SHOW WARNINGS; +Level Code Message +Warning 140 InnoDB: innodb_encrypt_tables=OFF only allows ENCRYPTION_KEY_ID=1 +Error 1005 Can't create table `test`.`t3` (errno: 140 "Wrong create options") +Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB +FLUSH TABLES; +create table t1(f1 int not null, f2 int not null)engine=innodb encrypted=yes; +insert into t1 values(1, 2), (2, 3), (4, 5), (5, 6), (7, 8); +insert into t1 select * from t1; +BEGIN; +INSERT INTO t2 VALUES (1); +connect con1, localhost, root; +SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL done WAIT_FOR ever'; +alter table t1 force; +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR done'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; +disconnect con1; +select * from t1; +f1 f2 +1 2 +2 3 +4 5 +5 6 +7 8 +1 2 +2 3 +4 5 +5 6 +7 8 +drop table t1,t2; diff --git a/mysql-test/suite/encryption/r/innodb-encryption-disable.result b/mysql-test/suite/encryption/r/innodb-encryption-disable.result index d8d37ba7493..94b47103dd0 100644 --- a/mysql-test/suite/encryption/r/innodb-encryption-disable.result +++ b/mysql-test/suite/encryption/r/innodb-encryption-disable.result @@ -1,6 +1,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1"); call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); create table t5 ( `intcol1` int(32) DEFAULT NULL, diff --git a/mysql-test/suite/encryption/r/innodb-force-corrupt.result b/mysql-test/suite/encryption/r/innodb-force-corrupt.result index 4c8ee2ef4de..13c38f1587d 100644 --- a/mysql-test/suite/encryption/r/innodb-force-corrupt.result +++ b/mysql-test/suite/encryption/r/innodb-force-corrupt.result @@ -1,6 +1,5 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` (has an unreadable root page|is corrupted)"); -call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); -call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page number=[36]\\] in file .*test.t[123]\\.ibd looks corrupted; key_version=3221342974"); SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; # Create and populate tables to be corrupted diff --git a/mysql-test/suite/encryption/r/innodb-missing-key.result b/mysql-test/suite/encryption/r/innodb-missing-key.result index 32ae29ca76b..6f4a45d817a 100644 --- a/mysql-test/suite/encryption/r/innodb-missing-key.result +++ b/mysql-test/suite/encryption/r/innodb-missing-key.result @@ -1,6 +1,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1"); # Start server with keys2.txt CREATE TABLE t1(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=19; CREATE TABLE t2(a int not null primary key auto_increment, b varchar(128)) engine=innodb ENCRYPTED=YES ENCRYPTION_KEY_ID=1; diff --git a/mysql-test/suite/encryption/t/innodb-bad-key-change.test b/mysql-test/suite/encryption/t/innodb-bad-key-change.test index 5c424d8752b..a832880c494 100644 --- a/mysql-test/suite/encryption/t/innodb-bad-key-change.test +++ b/mysql-test/suite/encryption/t/innodb-bad-key-change.test @@ -13,6 +13,7 @@ call mtr.add_suppression("Plugin 'file_key_management' registration.*failed"); call mtr.add_suppression("InnoDB: Table `test`\\.`t[12]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[12]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t1.ibd looks corrupted; key_version=1"); call mtr.add_suppression("File '.*mysql-test.std_data.keysbad3\\.txt' not found"); --echo # Start server with keys2.txt diff --git a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test index 7eaa1bd64c6..c9a4a9e1b92 100644 --- a/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test +++ b/mysql-test/suite/encryption/t/innodb-checksum-algorithm.test @@ -65,17 +65,14 @@ EOF --list_files $MYSQLD_DATADIR/test UNLOCK TABLES; -let $to = 6; +let $to = 3; while ($to) { dec $to; let $tocksum = `select case $to when 0 then 'none' - when 1 then 'strict_none' - when 2 then 'innodb' - when 3 then 'strict_innodb' - when 4 then 'crc32' - when 5 then 'strict_crc32' + when 1 then 'innodb' + when 2 then 'crc32' end`; eval SET GLOBAL innodb_checksum_algorithm=$tocksum; diff --git a/mysql-test/suite/encryption/t/innodb-encryption-alter.test b/mysql-test/suite/encryption/t/innodb-encryption-alter.test index af1c749d8a9..a6a4dbaff9b 100644 --- a/mysql-test/suite/encryption/t/innodb-encryption-alter.test +++ b/mysql-test/suite/encryption/t/innodb-encryption-alter.test @@ -1,13 +1,12 @@ -- source include/have_innodb.inc +-- source include/have_debug.inc +-- source include/have_debug_sync.inc -- source include/have_file_key_management_plugin.inc # # MDEV-8817: Failing assertion: new_state->key_version != ENCRYPTION_KEY_VERSION_INVALID # -let $encrypt_tables = `SELECT @@innodb_encrypt_tables`; -let $threads = `SELECT @@innodb_encryption_threads`; - SET GLOBAL innodb_encrypt_tables = ON; SET GLOBAL innodb_encryption_threads = 4; @@ -81,8 +80,53 @@ connection default; drop table t1,t2; -# reset system ---disable_query_log -EVAL SET GLOBAL innodb_encrypt_tables = $encrypt_tables; -EVAL SET GLOBAL innodb_encryption_threads = $threads; ---enable_query_log +# +# MDEV-17230: encryption_key_id from alter is ignored by encryption threads +# +SET GLOBAL innodb_encrypt_tables=OFF; +CREATE TABLE t1 (a int not null primary key) engine=innodb; +--error ER_ILLEGAL_HA_CREATE_OPTION +ALTER TABLE t1 ENCRYPTION_KEY_ID=4; +SHOW WARNINGS; +SHOW CREATE TABLE t1; +DROP TABLE t1; + +CREATE TABLE t2 (a int not null primary key) engine=innodb; +--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +--error ER_CANT_CREATE_TABLE +ALTER TABLE t2 ENCRYPTION_KEY_ID=4, ALGORITHM=COPY; +--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/ +SHOW WARNINGS; +SHOW CREATE TABLE t2; + +--error ER_CANT_CREATE_TABLE +CREATE TABLE t3 (a int not null primary key) engine=innodb ENCRYPTION_KEY_ID=4; +SHOW WARNINGS; + +FLUSH TABLES; + +create table t1(f1 int not null, f2 int not null)engine=innodb encrypted=yes; +insert into t1 values(1, 2), (2, 3), (4, 5), (5, 6), (7, 8); +insert into t1 select * from t1; +BEGIN; +INSERT INTO t2 VALUES (1); + +connect con1, localhost, root; +SET DEBUG_SYNC = 'row_log_table_apply2_before SIGNAL done WAIT_FOR ever'; +send alter table t1 force; + +connection default; +SET DEBUG_SYNC = 'now WAIT_FOR done'; +SET GLOBAL innodb_flush_log_at_trx_commit=1; +COMMIT; + +--let $shutdown_timeout= 0 +--source include/restart_mysqld.inc +disconnect con1; + +select * from t1; +drop table t1,t2; + +# Work around missing crash recovery at the SQL layer. +let $datadir= `select @@datadir`; +--remove_files_wildcard $datadir/test #sql-*.frm diff --git a/mysql-test/suite/encryption/t/innodb-encryption-disable.test b/mysql-test/suite/encryption/t/innodb-encryption-disable.test index 0994078788e..6d6f1c40d4c 100644 --- a/mysql-test/suite/encryption/t/innodb-encryption-disable.test +++ b/mysql-test/suite/encryption/t/innodb-encryption-disable.test @@ -10,6 +10,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t[15]` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[15]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=3\\] in file .*test.t[15].ibd looks corrupted; key_version=1"); # Suppression for builds where file_key_management plugin is linked statically call mtr.add_suppression("Couldn't load plugins from 'file_key_management"); diff --git a/mysql-test/suite/encryption/t/innodb-force-corrupt.test b/mysql-test/suite/encryption/t/innodb-force-corrupt.test index 2ec4960af4c..6c775dbf733 100644 --- a/mysql-test/suite/encryption/t/innodb-force-corrupt.test +++ b/mysql-test/suite/encryption/t/innodb-force-corrupt.test @@ -8,8 +8,7 @@ -- source include/not_embedded.inc call mtr.add_suppression("InnoDB: Table `test`\\.`t[13]` (has an unreadable root page|is corrupted)"); -call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); -call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=\\d+, page number=[36]\\] in file .*test.t[123]\\.ibd looks corrupted; key_version=3221342974"); SET GLOBAL innodb_file_per_table = ON; set global innodb_compression_algorithm = 1; @@ -51,17 +50,17 @@ perl; open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t1.ibd") or die "open"; binmode FILE; seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek"; -print FILE pack("H*", "c00lcafedeadb017"); +print FILE pack("H*", "c001cafedeadb017"); close FILE or die "close"; open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t2.ibd") or die "open"; binmode FILE; seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek"; -print FILE pack("H*", "c00lcafedeadb017"); +print FILE pack("H*", "c001cafedeadb017"); close FILE or die "close"; open(FILE, "+<", "$ENV{MYSQLD_DATADIR}/test/t3.ibd") or die "open"; binmode FILE; seek(FILE, $ENV{'INNODB_PAGE_SIZE'} * 3 + 26, SEEK_SET) or die "seek"; -print FILE pack("H*", "c00lcafedeadb017"); +print FILE pack("H*", "c001cafedeadb017"); close FILE or die "close"; EOF diff --git a/mysql-test/suite/encryption/t/innodb-missing-key.test b/mysql-test/suite/encryption/t/innodb-missing-key.test index cf851a54def..c2a73d594b4 100644 --- a/mysql-test/suite/encryption/t/innodb-missing-key.test +++ b/mysql-test/suite/encryption/t/innodb-missing-key.test @@ -10,6 +10,7 @@ call mtr.add_suppression("InnoDB: Table `test`\\.`t1` (has an unreadable root page|is corrupted)"); call mtr.add_suppression("InnoDB: The page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file '.*test.t[123]\\.ibd' cannot be decrypted\\."); call mtr.add_suppression("failed to read or decrypt \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\]"); +call mtr.add_suppression("InnoDB: Encrypted page \\[page id: space=[1-9][0-9]*, page number=[1-9][0-9]*\\] in file .*test.t[12].ibd looks corrupted; key_version=1"); --echo # Start server with keys2.txt -- let $restart_parameters=--file-key-management-filename=$MYSQL_TEST_DIR/std_data/keys2.txt diff --git a/mysql-test/suite/engines/funcs/r/an_calendar.result b/mysql-test/suite/engines/funcs/r/an_calendar.result index f057c3b618f..669b097b325 100644 --- a/mysql-test/suite/engines/funcs/r/an_calendar.result +++ b/mysql-test/suite/engines/funcs/r/an_calendar.result @@ -11,6 +11,7 @@ Note 1265 Data truncated for column 'c1' at row 1 Note 1265 Data truncated for column 'c2' at row 1 ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 TIME NULL, c2 TIME NULL); @@ -25,6 +26,7 @@ Note 1265 Data truncated for column 'c1' at row 1 Note 1265 Data truncated for column 'c2' at row 1 ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 DATETIME NULL, c2 DATETIME NULL); @@ -33,6 +35,7 @@ INSERT INTO t1 VALUES(NOW(),NOW()); INSERT INTO t1 VALUES(NOW(),NOW()); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 TIMESTAMP NULL, c2 TIMESTAMP NULL); @@ -41,5 +44,6 @@ INSERT INTO t1 VALUES(NOW(),NOW()); INSERT INTO t1 VALUES(NOW(),NOW()); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/an_number.result b/mysql-test/suite/engines/funcs/r/an_number.result index a77fc0e7d69..257213d0bf8 100644 --- a/mysql-test/suite/engines/funcs/r/an_number.result +++ b/mysql-test/suite/engines/funcs/r/an_number.result @@ -4,6 +4,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 SMALLINT NULL, c2 SMALLINT NULL); @@ -11,6 +12,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 MEDIUMINT NULL, c2 MEDIUMINT NULL); @@ -18,6 +20,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 INT NULL, c2 INT NULL); @@ -25,6 +28,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 INTEGER NULL, c2 INTEGER NULL); @@ -32,6 +36,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 BIGINT NULL, c2 BIGINT NULL); @@ -39,6 +44,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 DECIMAL NULL, c2 DECIMAL NULL); @@ -46,6 +52,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 DEC NULL, c2 DEC NULL); @@ -53,6 +60,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 FIXED NULL, c2 FIXED NULL); @@ -60,6 +68,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 NUMERIC NULL, c2 NUMERIC NULL); @@ -67,6 +76,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 DOUBLE NULL, c2 DOUBLE NULL); @@ -74,6 +84,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 REAL NULL, c2 REAL NULL); @@ -81,6 +92,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 DOUBLE PRECISION NULL, c2 DOUBLE PRECISION NULL); @@ -88,6 +100,7 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 FLOAT NULL, c2 FLOAT NULL); @@ -95,5 +108,6 @@ INSERT INTO t1 VALUES(1,2); INSERT INTO t1 VALUES(3,4); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/an_string.result b/mysql-test/suite/engines/funcs/r/an_string.result index c7762155a7d..f3e7eaedb15 100644 --- a/mysql-test/suite/engines/funcs/r/an_string.result +++ b/mysql-test/suite/engines/funcs/r/an_string.result @@ -4,6 +4,7 @@ INSERT INTO t1 VALUES('abc','ABCDEFG'); INSERT INTO t1 VALUES('123','1234567890'); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 VARCHAR(100) NULL, c2 VARCHAR(100) NULL); @@ -11,6 +12,7 @@ INSERT INTO t1 VALUES('abc','ABCDEFG'); INSERT INTO t1 VALUES('123','1234567890'); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 BINARY(100) NULL, c2 BINARY(100) NULL); @@ -18,6 +20,7 @@ INSERT INTO t1 VALUES('abc','ABCDEFG'); INSERT INTO t1 VALUES('123','1234567890'); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 VARBINARY(100) NULL, c2 VARBINARY(100) NULL); @@ -25,6 +28,7 @@ INSERT INTO t1 VALUES('abc','ABCDEFG'); INSERT INTO t1 VALUES('123','1234567890'); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 BLOB(100) NULL, c2 BLOB(100) NULL); @@ -32,6 +36,9 @@ INSERT INTO t1 VALUES('abc','ABCDEFG'); INSERT INTO t1 VALUES('123','1234567890'); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'c1' +test.t1 analyze Warning Engine-independent statistics are not collected for column 'c2' test.t1 analyze status OK DROP TABLE t1; CREATE TABLE t1(c1 TEXT(100) NULL, c2 TEXT(100) NULL); @@ -39,5 +46,8 @@ INSERT INTO t1 VALUES('abc','ABCDEFG'); INSERT INTO t1 VALUES('123','1234567890'); ANALYZE TABLE t1; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected +test.t1 analyze Warning Engine-independent statistics are not collected for column 'c1' +test.t1 analyze Warning Engine-independent statistics are not collected for column 'c2' test.t1 analyze status OK DROP TABLE t1; diff --git a/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result b/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result index 53964697506..b1c46a3a398 100644 --- a/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result +++ b/mysql-test/suite/engines/funcs/r/in_number_boundary_error.result @@ -7,7 +7,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -26,7 +26,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -45,7 +45,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -64,7 +64,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -83,7 +83,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows @@ -102,7 +102,7 @@ INSERT INTO t4 (c1) VALUES(0); INSERT INTO t4 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t4 (c1) VALUES('x'); -ERROR 22007: Incorrect integer value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect integer value: 'x' for column `test`.`t4`.`c1` at row 1 INSERT INTO t4 (c1) VALUES('9'); SELECT COUNT(c1) AS total_rows FROM t4; total_rows diff --git a/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result b/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result index 62ad9a568f9..0c9ae5453e3 100644 --- a/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result +++ b/mysql-test/suite/engines/funcs/r/in_number_decimal_boundary_error.result @@ -7,7 +7,7 @@ INSERT INTO t5 (c1) VALUES(0); INSERT INTO t5 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t5 (c1) VALUES('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1 INSERT INTO t5 (c1) VALUES(999999); ERROR 22003: Out of range value for column 'c1' at row 1 SELECT COUNT(c1) AS total_rows FROM t5; @@ -27,7 +27,7 @@ INSERT INTO t5 (c1) VALUES(0); INSERT INTO t5 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t5 (c1) VALUES('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1 INSERT INTO t5 (c1) VALUES(999999); ERROR 22003: Out of range value for column 'c1' at row 1 SELECT COUNT(c1) AS total_rows FROM t5; @@ -47,7 +47,7 @@ INSERT INTO t5 (c1) VALUES(0); INSERT INTO t5 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t5 (c1) VALUES('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1 INSERT INTO t5 (c1) VALUES(999999); ERROR 22003: Out of range value for column 'c1' at row 1 SELECT COUNT(c1) AS total_rows FROM t5; @@ -67,7 +67,7 @@ INSERT INTO t5 (c1) VALUES(0); INSERT INTO t5 (c1) VALUES(-1); ERROR 22003: Out of range value for column 'c1' at row 1 INSERT INTO t5 (c1) VALUES('x'); -ERROR 22007: Incorrect decimal value: 'x' for column 'c1' at row 1 +ERROR 22007: Incorrect decimal value: 'x' for column `test`.`t5`.`c1` at row 1 INSERT INTO t5 (c1) VALUES(999999); ERROR 22003: Out of range value for column 'c1' at row 1 SELECT COUNT(c1) AS total_rows FROM t5; diff --git a/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result b/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result index 884408d29b3..52a8b2de642 100644 --- a/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result +++ b/mysql-test/suite/engines/funcs/r/tc_partition_analyze.result @@ -33,6 +33,7 @@ t1 CREATE TABLE `t1` ( PARTITION `p5` VALUES LESS THAN MAXVALUE ENGINE = ENGINE) ALTER TABLE t1 ANALYZE PARTITION p1,p2; Table Op Msg_type Msg_text +test.t1 analyze status Engine-independent statistics collected test.t1 analyze status OK SELECT * FROM t1 ORDER BY c1; c1 c2 diff --git a/mysql-test/suite/engines/iuds/r/insert_decimal.result b/mysql-test/suite/engines/iuds/r/insert_decimal.result index a341de58946..860fa8a2c4c 100644 --- a/mysql-test/suite/engines/iuds/r/insert_decimal.result +++ b/mysql-test/suite/engines/iuds/r/insert_decimal.result @@ -110,15 +110,15 @@ 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 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c1' at row 2 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c2' at row 2 -Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column 'c3' at row 2 +Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c1` at row 2 +Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c2` at row 2 +Warning 1366 Incorrect decimal value: '1e+18446744073709551616' for column `test`.`t2`.`c3` at row 2 Note 1265 Data truncated for column 'c1' at row 3 Note 1265 Data truncated for column 'c2' at row 3 Note 1265 Data truncated for column 'c3' at row 3 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c1' at row 4 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c2' at row 4 -Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column 'c3' at row 4 +Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c1` at row 4 +Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c2` at row 4 +Warning 1366 Incorrect decimal value: '1e-9223372036854775809' for column `test`.`t2`.`c3` at row 4 SELECT * FROM t1; c1 c2 c3 c4 0.00000 -0.10000 0 13 diff --git a/mysql-test/suite/engines/iuds/r/insert_number.result b/mysql-test/suite/engines/iuds/r/insert_number.result index b70c39341ad..564ce8d3401 100644 --- a/mysql-test/suite/engines/iuds/r/insert_number.result +++ b/mysql-test/suite/engines/iuds/r/insert_number.result @@ -12,16 +12,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT IGNORE INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT IGNORE INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT IGNORE INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT IGNORE INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -40,15 +40,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT IGNORE INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT IGNORE INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT IGNORE INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -1378,22 +1378,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT IGNORE INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT IGNORE INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT IGNORE INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT IGNORE INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT IGNORE INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -5621,16 +5621,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -5649,15 +5649,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -6987,22 +6987,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -11321,16 +11321,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -11349,15 +11349,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -12687,22 +12687,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -17126,16 +17126,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -17154,15 +17154,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -18492,22 +18492,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -23036,16 +23036,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -23064,15 +23064,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -24402,22 +24402,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -28946,16 +28946,16 @@ INSERT INTO t2 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t3 VALUES(105,NULL,102,103,104,105,106); INSERT INTO t1 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('','',17,18,19,20,21); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t3`.`c2` at row 1 INSERT INTO t1 VALUES(-1,124,22,23,24,25,26); Warnings: Warning 1264 Out of range value for column 'c1' at row 1 @@ -28974,15 +28974,15 @@ INSERT INTO t3 VALUES(0,0,32,32,34,35,36); INSERT INTO t1 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t1`.`c2` at row 1 INSERT INTO t2 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t2`.`c2` at row 1 INSERT INTO t3 VALUES('101.34 a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t3`.`c2` at row 1 SELECT * FROM t1; c1 c2 c3 c4 c5 c6 c7 0 0 17 18 19 20 21 @@ -30312,22 +30312,22 @@ Warnings: Warning 1364 Field 'c2' doesn't have a default value INSERT INTO t4 VALUES('','',17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t4`.`c2` at row 1 INSERT INTO t5 VALUES('','',-17,18,19,20,21,22); Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t5`.`c2` at row 1 INSERT INTO t4 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t4`.`c3` at row 1 INSERT INTO t5 VALUES('102.34 a','a','a',37,38,39,40,41); Warnings: Warning 1265 Data truncated for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c2' at row 1 -Warning 1366 Incorrect integer value: 'a' for column 'c3' at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c2` at row 1 +Warning 1366 Incorrect integer value: 'a' for column `test`.`t5`.`c3` at row 1 INSERT INTO t4 VALUES(4,7,8,9,10,11,12,13); INSERT INTO t5 VALUES(-1,-1,-1,8,9,10,11,12); Warnings: @@ -31586,8 +31586,33 @@ c1 c2 c3 c4 c5 c6 c7 0 -9223372036854775808 1 2 3 4 5 SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6; c1 c2 c3 c4 c5 c6 c7 +0 NULL 5 6 NULL 0 NULL +0 -9223372036854775808 1 2 3 4 5 +0 0 17 18 19 20 21 +0 124 22 23 24 25 26 +0 124 27 28 29 30 31 +0 -9223372036854775808 31 32 33 34 35 +0 0 32 32 34 35 36 +101 0 37 38 39 40 41 +101 -102 103 104 105 106 107 +102 -109 110 111 112 113 114 +103 -109 110 111 112 113 114 +105 NULL 102 103 104 105 106 +108 -109 110 111 112 101 114 +108 -109 110 111 112 102 114 +108 -109 110 111 112 113 114 +115 -116 117 118 119 120 121 +122 -123 124 125 126 127 128 +255 -2147483648 6 7 8 9 10 +65535 -8388608 11 12 13 14 15 +16777215 -32768 16 17 18 19 20 +4294967295 -128 21 22 23 24 25 +18446744073709551615 9223372036854775807 26 27 28 29 30 +18446744073709551615 9223372036854775807 36 37 38 39 40 SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 LIMIT 2; c1 c2 c3 c4 c5 c6 c7 +0 NULL 5 6 NULL 0 NULL +0 -9223372036854775808 1 2 3 4 5 SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6; c1 c2 c3 c4 c5 c6 c7 0 NULL 5 6 NULL 0 NULL @@ -31747,8 +31772,33 @@ c1 c2 c3 c4 c5 c6 c7 0 -9223372036854775808 31 32 33 34 35 SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC; c1 c2 c3 c4 c5 c6 c7 +0 0 32 32 34 35 36 +0 -9223372036854775808 31 32 33 34 35 +0 124 27 28 29 30 31 +0 124 22 23 24 25 26 +0 0 17 18 19 20 21 +0 -9223372036854775808 1 2 3 4 5 +0 NULL 5 6 NULL 0 NULL +101 -102 103 104 105 106 107 +101 0 37 38 39 40 41 +102 -109 110 111 112 113 114 +103 -109 110 111 112 113 114 +105 NULL 102 103 104 105 106 +108 -109 110 111 112 113 114 +108 -109 110 111 112 102 114 +108 -109 110 111 112 101 114 +115 -116 117 118 119 120 121 +122 -123 124 125 126 127 128 +255 -2147483648 6 7 8 9 10 +65535 -8388608 11 12 13 14 15 +16777215 -32768 16 17 18 19 20 +4294967295 -128 21 22 23 24 25 +18446744073709551615 9223372036854775807 36 37 38 39 40 +18446744073709551615 9223372036854775807 26 27 28 29 30 SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC LIMIT 2; c1 c2 c3 c4 c5 c6 c7 +0 0 32 32 34 35 36 +0 -9223372036854775808 31 32 33 34 35 SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6 DESC; c1 c2 c3 c4 c5 c6 c7 0 0 32 32 34 35 36 @@ -32014,8 +32064,33 @@ c1 c2 c3 c4 c5 c6 c7 18446744073709551615 9223372036854775807 36 37 38 39 40 SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6; c1 c2 c3 c4 c5 c6 c7 +0 NULL 5 6 NULL 0 NULL +0 -9223372036854775808 1 2 3 4 5 +0 0 17 18 19 20 21 +0 124 22 23 24 25 26 +0 124 27 28 29 30 31 +0 -9223372036854775808 31 32 33 34 35 +0 0 32 32 34 35 36 +101 0 37 38 39 40 41 +101 -102 103 104 105 106 107 +102 -109 110 111 112 113 114 +103 -109 110 111 112 113 114 +105 NULL 102 103 104 105 106 +108 -109 110 111 112 101 114 +108 -109 110 111 112 102 114 +108 -109 110 111 112 113 114 +115 -116 117 118 119 120 121 +122 -123 124 125 126 127 128 +255 -2147483648 6 7 8 9 10 +65535 -8388608 11 12 13 14 15 +16777215 -32768 16 17 18 19 20 +4294967295 -128 21 22 23 24 25 +18446744073709551615 9223372036854775807 26 27 28 29 30 +18446744073709551615 9223372036854775807 36 37 38 39 40 SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 LIMIT 2; c1 c2 c3 c4 c5 c6 c7 +0 NULL 5 6 NULL 0 NULL +0 -9223372036854775808 1 2 3 4 5 SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6; c1 c2 c3 c4 c5 c6 c7 0 NULL 5 6 NULL 0 NULL @@ -32175,8 +32250,33 @@ c1 c2 c3 c4 c5 c6 c7 18446744073709551615 9223372036854775807 26 27 28 29 30 SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC; c1 c2 c3 c4 c5 c6 c7 +0 0 32 32 34 35 36 +0 -9223372036854775808 31 32 33 34 35 +0 124 27 28 29 30 31 +0 124 22 23 24 25 26 +0 0 17 18 19 20 21 +0 -9223372036854775808 1 2 3 4 5 +0 NULL 5 6 NULL 0 NULL +101 -102 103 104 105 106 107 +101 0 37 38 39 40 41 +102 -109 110 111 112 113 114 +103 -109 110 111 112 113 114 +105 NULL 102 103 104 105 106 +108 -109 110 111 112 113 114 +108 -109 110 111 112 102 114 +108 -109 110 111 112 101 114 +115 -116 117 118 119 120 121 +122 -123 124 125 126 127 128 +255 -2147483648 6 7 8 9 10 +65535 -8388608 11 12 13 14 15 +16777215 -32768 16 17 18 19 20 +4294967295 -128 21 22 23 24 25 +18446744073709551615 9223372036854775807 36 37 38 39 40 +18446744073709551615 9223372036854775807 26 27 28 29 30 SELECT * FROM t2 WHERE c1 BETWEEN 0 AND 18446744073709551615 ORDER BY c1,c6 DESC LIMIT 2; c1 c2 c3 c4 c5 c6 c7 +0 0 32 32 34 35 36 +0 -9223372036854775808 31 32 33 34 35 SELECT * FROM t2 WHERE c1 IN (0,18446744073709551615) ORDER BY c1,c6 DESC; c1 c2 c3 c4 c5 c6 c7 0 0 32 32 34 35 36 diff --git a/mysql-test/suite/engines/iuds/r/insert_year.result b/mysql-test/suite/engines/iuds/r/insert_year.result index ea6e10d130b..c7a0dbcba86 100644 --- a/mysql-test/suite/engines/iuds/r/insert_year.result +++ b/mysql-test/suite/engines/iuds/r/insert_year.result @@ -60,12 +60,12 @@ Warning 1264 Out of range value for column 'c1' at row 6 Warning 1264 Out of range value for column 'c2' at row 6 INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT IGNORE INTO t4 VALUES('abcd','abcd','08-01-10','08/01/11'),(1234,1234,'08-01-12','08/01/13') /* Inserts zero dates for absurd dates */; Warnings: -Warning 1366 Incorrect integer value: 'abcd' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'abcd' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c2` at row 1 Warning 1264 Out of range value for column 'c1' at row 2 Warning 1264 Out of range value for column 'c2' at row 2 INSERT INTO t2 VALUES('20','30','98-12-16','98.12.16 11:30:45'),('40','20','98-12-15','98.12.15 11:30:45'); @@ -3319,12 +3319,12 @@ Warning 1264 Out of range value for column 'c1' at row 6 Warning 1264 Out of range value for column 'c2' at row 6 INSERT IGNORE INTO t1 VALUES('','','08-01-04','08/01/05') /* Inserts zero dates for '' strings */; Warnings: -Warning 1366 Incorrect integer value: '' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: '' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c1` at row 1 +Warning 1366 Incorrect integer value: '' for column `test`.`t1`.`c2` at row 1 INSERT IGNORE INTO t4 VALUES('abcd','abcd','08-01-10','08/01/11'),(1234,1234,'08-01-12','08/01/13') /* Inserts zero dates for absurd dates */; Warnings: -Warning 1366 Incorrect integer value: 'abcd' for column 'c1' at row 1 -Warning 1366 Incorrect integer value: 'abcd' for column 'c2' at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c1` at row 1 +Warning 1366 Incorrect integer value: 'abcd' for column `test`.`t4`.`c2` at row 1 Warning 1264 Out of range value for column 'c1' at row 2 Warning 1264 Out of range value for column 'c2' at row 2 INSERT INTO t2 VALUES('20','30','98-12-16','98.12.16 11:30:45'),('40','20','98-12-15','98.12.15 11:30:45'); diff --git a/mysql-test/suite/engines/iuds/r/update_decimal.result b/mysql-test/suite/engines/iuds/r/update_decimal.result index 7b4a3ea9079..8bedcf8ab51 100644 --- a/mysql-test/suite/engines/iuds/r/update_decimal.result +++ b/mysql-test/suite/engines/iuds/r/update_decimal.result @@ -334,7 +334,7 @@ INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555' UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3; UPDATE IGNORE t1 SET c3='asdf' WHERE c1='11111.11111'; Warnings: -Warning 1366 Incorrect decimal value: 'asdf' for column 'c3' at row 1 +Warning 1366 Incorrect decimal value: 'asdf' for column `test`.`t1`.`c3` at row 1 SELECT c3 FROM t1; c3 0 @@ -1099,7 +1099,7 @@ INSERT INTO t3 VALUES ('11111.11111','4444444444',1),('55555.55555','5555555555' UPDATE t2,t3 SET t3.c1='22222.22222' WHERE t2.c1=t3.c1 AND t2.c3=t3.c3; UPDATE IGNORE t1 SET c3='asdf' WHERE c1='11111.11111'; Warnings: -Warning 1366 Incorrect double value: 'asdf' for column 'c3' at row 1 +Warning 1366 Incorrect double value: 'asdf' for column `test`.`t1`.`c3` at row 1 SELECT c3 FROM t1; c3 0 diff --git a/mysql-test/suite/engines/iuds/r/update_delete_number.result b/mysql-test/suite/engines/iuds/r/update_delete_number.result index b091d27d1e6..1cd2a62cb56 100644 --- a/mysql-test/suite/engines/iuds/r/update_delete_number.result +++ b/mysql-test/suite/engines/iuds/r/update_delete_number.result @@ -3767,8 +3767,25 @@ c1 c2 c3 -12 18446744073709551615 12 SELECT * FROM t2 WHERE c2 BETWEEN 0 AND 18446744073709551615 ORDER BY c2,c1; c1 c2 c3 +-4 4 4 +-9 9 9 +0 255 13 +-9223372036854775808 18446744073709551615 12 +-12 18446744073709551615 12 +-11 18446744073709551615 11 +-8 18446744073709551615 8 +-7 18446744073709551615 7 +-6 18446744073709551615 6 +-5 18446744073709551615 5 +-3 18446744073709551615 3 +-2 18446744073709551615 2 +-1 18446744073709551615 1 +50 18446744073709551615 10 +9223372036854775807 18446744073709551615 14 SELECT * FROM t2 WHERE c2 BETWEEN 0 AND 18446744073709551615 ORDER BY c2,c1 DESC LIMIT 2; c1 c2 c3 +-4 4 4 +-9 9 9 SELECT * FROM t2 WHERE c2 IN(0,18446744073709551615) ORDER BY c2,c1 DESC; c1 c2 c3 9223372036854775807 18446744073709551615 14 diff --git a/mysql-test/suite/funcs_1/r/innodb_func_view.result b/mysql-test/suite/funcs_1/r/innodb_func_view.result index 481787e4eaa..7850e017fb2 100644 --- a/mysql-test/suite/funcs_1/r/innodb_func_view.result +++ b/mysql-test/suite/funcs_1/r/innodb_func_view.result @@ -3715,8 +3715,8 @@ NULL NULL 1 -00:00:01 -1 5 00:17:58 1758 25 Warnings: -Warning 1292 Incorrect time value: '-1.7976931348623e308' for column 'my_double' at row 2 -Warning 1292 Incorrect time value: '1.7976931348623e308' for column 'my_double' at row 3 +Warning 1292 Incorrect time value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2 +Warning 1292 Incorrect time value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as time) AS `CAST(my_double AS TIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3731,8 +3731,8 @@ NULL NULL 1 -00:00:01 -1 5 00:17:58 1758 25 Warnings: -Warning 1292 Incorrect time value: '-1.7976931348623e308' for column 'my_double' at row 1 -Warning 1292 Incorrect time value: '1.7976931348623e308' for column 'my_double' at row 1 +Warning 1292 Incorrect time value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1 +Warning 1292 Incorrect time value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1 DROP VIEW v1; @@ -3749,8 +3749,8 @@ NULL NULL 1 -00:00:01 -1 5 00:17:58 1758 24 Warnings: -Warning 1292 Incorrect time value: '-9223372036854775808' for column 'my_bigint' at row 2 -Warning 1292 Incorrect time value: '9223372036854775807' for column 'my_bigint' at row 3 +Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2 +Warning 1292 Incorrect time value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as time) AS `CAST(my_bigint AS TIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3765,8 +3765,8 @@ NULL NULL 1 -00:00:01 -1 5 00:17:58 1758 24 Warnings: -Warning 1292 Incorrect time value: '-9223372036854775808' for column 'my_bigint' at row 1 -Warning 1292 Incorrect time value: '9223372036854775807' for column 'my_bigint' at row 1 +Warning 1292 Incorrect time value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1 +Warning 1292 Incorrect time value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1 DROP VIEW v1; @@ -3778,14 +3778,14 @@ WHERE select_id = 51 OR select_id IS NULL order by id; CAST(my_varbinary_1000 AS TIME) my_varbinary_1000 id NULL NULL 1 NULL 2 -00:00:00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 --00:00:00 ---äÖüß@µ*$-- 4 +NULL <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 +NULL ---äÖüß@µ*$-- 4 -00:00:01 -1 5 41:58:00 1 17:58 23 Warnings: -Warning 1292 Truncated incorrect time value: '' -Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' -Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Incorrect time value: '' +Warning 1292 Incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varbinary_1000` as time) AS `CAST(my_varbinary_1000 AS TIME)`,`t1_values`.`my_varbinary_1000` AS `my_varbinary_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3795,14 +3795,14 @@ WHERE select_id = 51 OR select_id IS NULL) order by id; CAST(my_varbinary_1000 AS TIME) my_varbinary_1000 id NULL NULL 1 NULL 2 -00:00:00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 --00:00:00 ---äÖüß@µ*$-- 4 +NULL <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 +NULL ---äÖüß@µ*$-- 4 -00:00:01 -1 5 41:58:00 1 17:58 23 Warnings: -Warning 1292 Truncated incorrect time value: '' -Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' -Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Incorrect time value: '' +Warning 1292 Incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' DROP VIEW v1; @@ -3813,15 +3813,15 @@ my_binary_30, id FROM t1_values WHERE select_id = 50 OR select_id IS NULL order by id; CAST(my_binary_30 AS TIME) my_binary_30 id NULL NULL 1 -00:00:00 2 -00:00:00 <--------30 characters-------> 3 --00:00:00 ---äÖüß@µ*$-- 4 +NULL 2 +NULL <--------30 characters-------> 3 +NULL ---äÖüß@µ*$-- 4 -00:00:01 -1 5 41:58:00 1 17:58 22 Warnings: -Warning 1292 Truncated incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect time value: '<--------30 characters------->' -Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Incorrect time value: '<--------30 characters------->' +Warning 1292 Incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' Warning 1292 Truncated incorrect time value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' Warning 1292 Truncated incorrect time value: '1 17:58\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' SHOW CREATE VIEW v1; @@ -3832,15 +3832,15 @@ WHERE v1.id IN (SELECT id FROM t1_values WHERE select_id = 50 OR select_id IS NULL) order by id; CAST(my_binary_30 AS TIME) my_binary_30 id NULL NULL 1 -00:00:00 2 -00:00:00 <--------30 characters-------> 3 --00:00:00 ---äÖüß@µ*$-- 4 +NULL 2 +NULL <--------30 characters-------> 3 +NULL ---äÖüß@µ*$-- 4 -00:00:01 -1 5 41:58:00 1 17:58 22 Warnings: -Warning 1292 Truncated incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' -Warning 1292 Truncated incorrect time value: '<--------30 characters------->' -Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Incorrect time value: '\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' +Warning 1292 Incorrect time value: '<--------30 characters------->' +Warning 1292 Incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- \x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' Warning 1292 Truncated incorrect time value: '-1\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' Warning 1292 Truncated incorrect time value: '1 17:58\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' DROP VIEW v1; @@ -3854,14 +3854,14 @@ WHERE select_id = 49 OR select_id IS NULL order by id; CAST(my_varchar_1000 AS TIME) my_varchar_1000 id NULL NULL 1 NULL 2 -00:00:00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 --00:00:00 ---äÖüß@µ*$-- 4 +NULL <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 +NULL ---äÖüß@µ*$-- 4 -00:00:01 -1 5 41:58:00 1 17:58 21 Warnings: -Warning 1292 Truncated incorrect time value: '' -Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' -Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Incorrect time value: '' +Warning 1292 Incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_varchar_1000` as time) AS `CAST(my_varchar_1000 AS TIME)`,`t1_values`.`my_varchar_1000` AS `my_varchar_1000`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3871,14 +3871,14 @@ WHERE select_id = 49 OR select_id IS NULL) order by id; CAST(my_varchar_1000 AS TIME) my_varchar_1000 id NULL NULL 1 NULL 2 -00:00:00 <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 --00:00:00 ---äÖüß@µ*$-- 4 +NULL <---------1000 characters--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------> 3 +NULL ---äÖüß@µ*$-- 4 -00:00:01 -1 5 41:58:00 1 17:58 21 Warnings: -Warning 1292 Truncated incorrect time value: '' -Warning 1292 Truncated incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' -Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' +Warning 1292 Incorrect time value: '' +Warning 1292 Incorrect time value: '<---------1000 characters-------------------------------------------------------------------------------------------------------' +Warning 1292 Incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$-- ' DROP VIEW v1; @@ -3890,14 +3890,14 @@ WHERE select_id = 48 OR select_id IS NULL order by id; CAST(my_char_30 AS TIME) my_char_30 id NULL NULL 1 NULL 2 -00:00:00 <--------30 characters-------> 3 --00:00:00 ---äÖüß@µ*$-- 4 +NULL <--------30 characters-------> 3 +NULL ---äÖüß@µ*$-- 4 -00:00:01 -1 5 41:58:00 1 17:58 20 Warnings: -Warning 1292 Truncated incorrect time value: '' -Warning 1292 Truncated incorrect time value: '<--------30 characters------->' -Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$--' +Warning 1292 Incorrect time value: '' +Warning 1292 Incorrect time value: '<--------30 characters------->' +Warning 1292 Incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$--' SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_char_30` as time) AS `CAST(my_char_30 AS TIME)`,`t1_values`.`my_char_30` AS `my_char_30`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -3907,14 +3907,14 @@ WHERE select_id = 48 OR select_id IS NULL) order by id; CAST(my_char_30 AS TIME) my_char_30 id NULL NULL 1 NULL 2 -00:00:00 <--------30 characters-------> 3 --00:00:00 ---äÖüß@µ*$-- 4 +NULL <--------30 characters-------> 3 +NULL ---äÖüß@µ*$-- 4 -00:00:01 -1 5 41:58:00 1 17:58 20 Warnings: -Warning 1292 Truncated incorrect time value: '' -Warning 1292 Truncated incorrect time value: '<--------30 characters------->' -Warning 1292 Truncated incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$--' +Warning 1292 Incorrect time value: '' +Warning 1292 Incorrect time value: '<--------30 characters------->' +Warning 1292 Incorrect time value: ' ---\xC3\xA4\xC3\x96\xC3\xBC\xC3\x9F@\xC2\xB5*$--' DROP VIEW v1; @@ -4061,10 +4061,10 @@ NULL 1.7976931348623e308 3 NULL -1 5 NULL 200506271758 19 Warnings: -Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 2 -Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 3 -Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5 -Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 19 +Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2 +Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3 +Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 5 +Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_double` at row 19 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as datetime) AS `CAST(my_double AS DATETIME)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -4079,10 +4079,10 @@ NULL 1.7976931348623e308 3 NULL -1 5 NULL 200506271758 19 Warnings: -Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 1 -Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 1 -Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1 -Warning 1292 Incorrect datetime value: '200506271758' for column 'my_double' at row 1 +Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1 +Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1 +Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 1 +Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_double` at row 1 DROP VIEW v1; @@ -4099,10 +4099,10 @@ NULL 9223372036854775807 3 NULL -1 5 NULL 200506271758 18 Warnings: -Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 2 -Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 3 -Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 5 -Warning 1292 Incorrect datetime value: '200506271758' for column 'my_bigint' at row 18 +Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2 +Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3 +Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 5 +Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_bigint` at row 18 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as datetime) AS `CAST(my_bigint AS DATETIME)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -4117,10 +4117,10 @@ NULL 9223372036854775807 3 NULL -1 5 NULL 200506271758 18 Warnings: -Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 1 -Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 1 -Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 1 -Warning 1292 Incorrect datetime value: '200506271758' for column 'my_bigint' at row 1 +Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1 +Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1 +Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 1 +Warning 1292 Incorrect datetime value: '200506271758' for column `test`.`t1_values`.`my_bigint` at row 1 DROP VIEW v1; @@ -4421,9 +4421,9 @@ NULL 1.7976931348623e308 3 NULL -1 5 2005-06-27 20050627 13 Warnings: -Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 2 -Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 3 -Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 5 +Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 2 +Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 3 +Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_double` as date) AS `CAST(my_double AS DATE)`,`t1_values`.`my_double` AS `my_double`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -4438,9 +4438,9 @@ NULL 1.7976931348623e308 3 NULL -1 5 2005-06-27 20050627 13 Warnings: -Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column 'my_double' at row 1 -Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column 'my_double' at row 1 -Warning 1292 Incorrect datetime value: '-1' for column 'my_double' at row 1 +Warning 1292 Incorrect datetime value: '-1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1 +Warning 1292 Incorrect datetime value: '1.7976931348623e308' for column `test`.`t1_values`.`my_double` at row 1 +Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_double` at row 1 DROP VIEW v1; @@ -4457,9 +4457,9 @@ NULL 9223372036854775807 3 NULL -1 5 2005-06-27 20050627 12 Warnings: -Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 2 -Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 3 -Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 5 +Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 2 +Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 3 +Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 5 SHOW CREATE VIEW v1; View Create View character_set_client collation_connection v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select cast(`t1_values`.`my_bigint` as date) AS `CAST(my_bigint AS DATE)`,`t1_values`.`my_bigint` AS `my_bigint`,`t1_values`.`id` AS `id` from `t1_values` latin1 latin1_swedish_ci @@ -4474,9 +4474,9 @@ NULL 9223372036854775807 3 NULL -1 5 2005-06-27 20050627 12 Warnings: -Warning 1292 Incorrect datetime value: '-9223372036854775808' for column 'my_bigint' at row 1 -Warning 1292 Incorrect datetime value: '9223372036854775807' for column 'my_bigint' at row 1 -Warning 1292 Incorrect datetime value: '-1' for column 'my_bigint' at row 1 +Warning 1292 Incorrect datetime value: '-9223372036854775808' for column `test`.`t1_values`.`my_bigint` at row 1 +Warning 1292 Incorrect datetime value: '9223372036854775807' for column `test`.`t1_values`.`my_bigint` at row 1 +Warning 1292 Incorrect datetime value: '-1' for column `test`.`t1_values`.`my_bigint` at row 1 DROP VIEW v1; diff --git a/mysql-test/suite/funcs_1/r/is_check_constraint.result b/mysql-test/suite/funcs_1/r/is_check_constraint.result new file mode 100644 index 00000000000..be44a8867e8 --- /dev/null +++ b/mysql-test/suite/funcs_1/r/is_check_constraint.result @@ -0,0 +1,121 @@ +# +# MDEV-17323: Backport INFORMATION_SCHEMA.CHECK_CONSTRAINTS to 10.2 +# +CREATE user boo1; +GRANT select,create,alter,drop on foo.* to boo1; +SHOW GRANTS for boo1; +Grants for boo1@% +GRANT USAGE ON *.* TO 'boo1'@'%' +GRANT SELECT, CREATE, DROP, ALTER ON `foo`.* TO 'boo1'@'%' +CREATE user boo2; +create database foo; +CONNECT con1,localhost, boo1,, foo; +SET check_constraint_checks=1; +CREATE TABLE t0 +( +t int, check (t>32) # table constraint +) ENGINE=myisam; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CONSTRAINT_1 t0 `t` > 32 +ALTER TABLE t0 +ADD CONSTRAINT CHK_t0_t CHECK(t<100); +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CHK_t0_t t0 `t` < 100 +def foo CONSTRAINT_1 t0 `t` > 32 +ALTER TABLE t0 +DROP CONSTRAINT CHK_t0_t; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CONSTRAINT_1 t0 `t` > 32 +ALTER TABLE t0 +ADD CONSTRAINT CHECK(t<50); +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CONSTRAINT_1 t0 `t` > 32 +def foo CONSTRAINT_2 t0 `t` < 50 +CREATE TABLE t1 +( t int CHECK(t>2), # field constraint +tt int, +CONSTRAINT CHECK (tt > 32), CONSTRAINT CHECK (tt <50),# autogenerated names table constraints +CONSTRAINT CHK_tt CHECK(tt<100) # named table constraint +) ENGINE=InnoDB; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CHK_tt t1 `tt` < 100 +def foo CONSTRAINT_1 t0 `t` > 32 +def foo CONSTRAINT_1 t1 `tt` > 32 +def foo CONSTRAINT_2 t0 `t` < 50 +def foo CONSTRAINT_2 t1 `tt` < 50 +def foo t t1 `t` > 2 +ALTER TABLE t1 +DROP CONSTRAINT CHK_tt; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CONSTRAINT_1 t0 `t` > 32 +def foo CONSTRAINT_1 t1 `tt` > 32 +def foo CONSTRAINT_2 t0 `t` < 50 +def foo CONSTRAINT_2 t1 `tt` < 50 +def foo t t1 `t` > 2 +CREATE TABLE t2 +( +name VARCHAR(30) CHECK(CHAR_LENGTH(name)>2), #field constraint +start_date DATE, +end_date DATE, +CONSTRAINT CHK_dates CHECK(start_date IS NULL) #table constraint +)ENGINE=Innodb; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CHK_dates t2 `start_date` is null +def foo CONSTRAINT_1 t0 `t` > 32 +def foo CONSTRAINT_1 t1 `tt` > 32 +def foo CONSTRAINT_2 t0 `t` < 50 +def foo CONSTRAINT_2 t1 `tt` < 50 +def foo name t2 char_length(`name`) > 2 +def foo t t1 `t` > 2 +ALTER TABLE t1 +ADD CONSTRAINT CHK_new_ CHECK(t>tt); +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CHK_dates t2 `start_date` is null +def foo CHK_new_ t1 `t` > `tt` +def foo CONSTRAINT_1 t0 `t` > 32 +def foo CONSTRAINT_1 t1 `tt` > 32 +def foo CONSTRAINT_2 t0 `t` < 50 +def foo CONSTRAINT_2 t1 `tt` < 50 +def foo name t2 char_length(`name`) > 2 +def foo t t1 `t` > 2 +CREATE TABLE t3 +( +a int, +b int check (b>0), # field constraint named 'b' +CONSTRAINT b check (b>10) # table constraint +) ENGINE=InnoDB; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +def foo CHK_dates t2 `start_date` is null +def foo CHK_new_ t1 `t` > `tt` +def foo CONSTRAINT_1 t0 `t` > 32 +def foo CONSTRAINT_1 t1 `tt` > 32 +def foo CONSTRAINT_2 t0 `t` < 50 +def foo CONSTRAINT_2 t1 `tt` < 50 +def foo b t3 `b` > 0 +def foo b t3 `b` > 10 +def foo name t2 char_length(`name`) > 2 +def foo t t1 `t` > 2 +disconnect con1; +CONNECT con2, localhost, boo2,, test; +SELECT * from information_schema.check_constraints; +CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE +disconnect con2; +CONNECT con1, localhost, boo1,,foo; +DROP TABLE t0; +DROP TABLE t1; +DROP TABLE t2; +DROP TABLE t3; +DROP DATABASE foo; +disconnect con1; +connection default; +DROP USER boo1; +DROP USER boo2; diff --git a/mysql-test/suite/funcs_1/r/is_check_constraints.result b/mysql-test/suite/funcs_1/r/is_check_constraints.result index 678cfb8db2f..eaf90f44544 100644 --- a/mysql-test/suite/funcs_1/r/is_check_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_check_constraints.result @@ -9,6 +9,11 @@ t int, check (t>32) # table constraint ) ENGINE=myisam; SELECT * from information_schema.check_constraints order by check_clause; CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA mysql +CONSTRAINT_NAME Priv +TABLE_NAME global_priv +CHECK_CLAUSE json_valid(`Priv`) +CONSTRAINT_CATALOG def CONSTRAINT_SCHEMA test CONSTRAINT_NAME CONSTRAINT_1 TABLE_NAME t0 @@ -17,6 +22,11 @@ ALTER TABLE t0 ADD CONSTRAINT CHK_t0_t CHECK(t<100); SELECT * from information_schema.check_constraints order by check_clause; CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA mysql +CONSTRAINT_NAME Priv +TABLE_NAME global_priv +CHECK_CLAUSE json_valid(`Priv`) +CONSTRAINT_CATALOG def CONSTRAINT_SCHEMA test CONSTRAINT_NAME CHK_t0_t TABLE_NAME t0 @@ -30,6 +40,11 @@ ALTER TABLE t0 DROP CONSTRAINT CHK_t0_t; SELECT * from information_schema.check_constraints order by check_clause; CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA mysql +CONSTRAINT_NAME Priv +TABLE_NAME global_priv +CHECK_CLAUSE json_valid(`Priv`) +CONSTRAINT_CATALOG def CONSTRAINT_SCHEMA test CONSTRAINT_NAME CONSTRAINT_1 TABLE_NAME t0 @@ -40,6 +55,11 @@ tt int, CONSTRAINT CHK_tt CHECK(tt<100) # table constraint ) ENGINE=InnoDB; SELECT * from information_schema.check_constraints order by check_clause; CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA mysql +CONSTRAINT_NAME Priv +TABLE_NAME global_priv +CHECK_CLAUSE json_valid(`Priv`) +CONSTRAINT_CATALOG def CONSTRAINT_SCHEMA test CONSTRAINT_NAME CHK_tt TABLE_NAME t1 @@ -58,6 +78,11 @@ ALTER TABLE t1 DROP CONSTRAINT CHK_tt; SELECT * from information_schema.check_constraints order by check_clause; CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA mysql +CONSTRAINT_NAME Priv +TABLE_NAME global_priv +CHECK_CLAUSE json_valid(`Priv`) +CONSTRAINT_CATALOG def CONSTRAINT_SCHEMA test CONSTRAINT_NAME t TABLE_NAME t1 @@ -81,6 +106,11 @@ CONSTRAINT_NAME name TABLE_NAME t2 CHECK_CLAUSE char_length(`name`) > 2 CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA mysql +CONSTRAINT_NAME Priv +TABLE_NAME global_priv +CHECK_CLAUSE json_valid(`Priv`) +CONSTRAINT_CATALOG def CONSTRAINT_SCHEMA test CONSTRAINT_NAME CHK_dates TABLE_NAME t2 @@ -104,6 +134,11 @@ CONSTRAINT_NAME name TABLE_NAME t2 CHECK_CLAUSE char_length(`name`) > 2 CONSTRAINT_CATALOG def +CONSTRAINT_SCHEMA mysql +CONSTRAINT_NAME Priv +TABLE_NAME global_priv +CHECK_CLAUSE json_valid(`Priv`) +CONSTRAINT_CATALOG def CONSTRAINT_SCHEMA test CONSTRAINT_NAME CHK_dates TABLE_NAME t2 @@ -132,6 +167,7 @@ CONSTRAINT b check (b>10) # table constraint select * from information_schema.check_constraints order by check_clause; CONSTRAINT_CATALOG CONSTRAINT_SCHEMA CONSTRAINT_NAME TABLE_NAME CHECK_CLAUSE def test name t2 char_length(`name`) > 2 +def mysql Priv global_priv json_valid(`Priv`) def test b t3 `b` > 0 def test b t3 `b` > 10 def test CHK_dates t2 `start_date` is null diff --git a/mysql-test/suite/funcs_1/r/is_columns_innodb.result b/mysql-test/suite/funcs_1/r/is_columns_innodb.result index 8f2ba33b591..fbca906a9fb 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_innodb.result +++ b/mysql-test/suite/funcs_1/r/is_columns_innodb.result @@ -359,9 +359,9 @@ drop TABLE if exists t7, t8; CREATE TABLE t7 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = InnoDB; CREATE TABLE t8 (f1 char(20),f2 char(25),f3 date,f4 int) ENGINE = InnoDB; LOAD DATA INFILE '/std_data/funcs_1/t7.txt' INTO TABLE t7; -ERROR 22007: Incorrect date value: '' for column 'f3' at row 1 +ERROR 22007: Incorrect date value: '' for column `test`.`t7`.`f3` at row 1 LOAD DATA INFILE '/std_data/funcs_1/t7.txt' INTO TABLE t8; -ERROR 22007: Incorrect date value: '' for column 'f3' at row 1 +ERROR 22007: Incorrect date value: '' for column `test`.`t8`.`f3` at row 1 drop TABLE if exists t9; CREATE TABLE t9 (f1 int, f2 char(25), f3 int) ENGINE = InnoDB; LOAD DATA INFILE '/std_data/funcs_1/t9.txt' INTO TABLE t9; diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql.result b/mysql-test/suite/funcs_1/r/is_columns_mysql.result index 5a7fdbd63c9..31160f8a3ec 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result @@ -61,7 +61,7 @@ def mysql event modified 9 '0000-00-00 00:00:00' NO timestamp NULL NULL NULL NUL def mysql event name 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI select,insert,update,references NEVER NULL def mysql event on_completion 14 'DROP' NO enum 8 24 NULL NULL NULL utf8 utf8_general_ci enum('DROP','PRESERVE') select,insert,update,references NEVER NULL def mysql event originator 17 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references NEVER NULL -def mysql event sql_mode 15 '' NO set 539 1617 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') select,insert,update,references NEVER NULL +def mysql event sql_mode 15 '' NO set 561 1683 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') select,insert,update,references NEVER NULL def mysql event starts 11 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime select,insert,update,references NEVER NULL def mysql event status 13 'ENABLED' NO enum 18 54 NULL NULL NULL utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') select,insert,update,references NEVER NULL def mysql event time_zone 18 'SYSTEM' NO char 64 64 NULL NULL NULL latin1 latin1_swedish_ci char(64) select,insert,update,references NEVER NULL @@ -75,6 +75,9 @@ def mysql general_log event_time 1 current_timestamp(6) NO timestamp NULL NULL N def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references NEVER NULL def mysql general_log thread_id 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned select,insert,update,references NEVER NULL def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext select,insert,update,references NEVER NULL +def mysql global_priv Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references NEVER NULL +def mysql global_priv Priv 3 '{}' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL +def mysql global_priv User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL def mysql gtid_slave_pos domain_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI select,insert,update,references NEVER NULL def mysql gtid_slave_pos seq_no 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def mysql gtid_slave_pos server_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned select,insert,update,references NEVER NULL @@ -133,7 +136,7 @@ def mysql proc returns 10 NULL NO longblob 4294967295 4294967295 NULL NULL NULL def mysql proc security_type 8 'DEFINER' NO enum 7 21 NULL NULL NULL utf8 utf8_general_ci enum('INVOKER','DEFINER') select,insert,update,references NEVER NULL def mysql proc specific_name 4 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) select,insert,update,references NEVER NULL def mysql proc sql_data_access 6 'CONTAINS_SQL' NO enum 17 51 NULL NULL NULL utf8 utf8_general_ci enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') select,insert,update,references NEVER NULL -def mysql proc sql_mode 15 '' NO set 539 1617 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') select,insert,update,references NEVER NULL +def mysql proc sql_mode 15 '' NO set 561 1683 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') select,insert,update,references NEVER NULL def mysql proc type 3 NULL NO enum 12 36 NULL NULL NULL utf8 utf8_general_ci enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') PRI select,insert,update,references NEVER NULL def mysql procs_priv Db 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI select,insert,update,references NEVER NULL def mysql procs_priv Grantor 6 '' NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) MUL select,insert,update,references NEVER NULL @@ -206,53 +209,53 @@ def mysql transaction_registry commit_id 2 NULL NO bigint NULL NULL 20 0 NULL NU def mysql transaction_registry commit_timestamp 4 '0000-00-00 00:00:00.000000' NO timestamp NULL NULL NULL NULL 6 NULL NULL timestamp(6) MUL select,insert,update,references NEVER NULL def mysql transaction_registry isolation_level 5 NULL NO enum 16 48 NULL NULL NULL utf8 utf8_bin enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') select,insert,update,references NEVER NULL def mysql transaction_registry transaction_id 1 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned PRI select,insert,update,references NEVER NULL -def mysql user Alter_priv 17 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Alter_routine_priv 28 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user authentication_string 43 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_bin text select,insert,update,references NEVER NULL -def mysql user Create_priv 8 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Create_routine_priv 27 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Create_tablespace_priv 32 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Create_tmp_table_priv 20 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Create_user_priv 29 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Create_view_priv 25 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user default_role 46 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) select,insert,update,references NEVER NULL -def mysql user Delete_history_priv 33 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Delete_priv 7 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Drop_priv 9 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Event_priv 30 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Execute_priv 22 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user File_priv 13 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Grant_priv 14 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI select,insert,update,references NEVER NULL -def mysql user Index_priv 16 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Insert_priv 5 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user is_role 45 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Lock_tables_priv 21 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user max_connections 40 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references NEVER NULL -def mysql user max_questions 38 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references NEVER NULL +def mysql user Alter_priv 17 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Alter_routine_priv 28 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user authentication_string 43 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL +def mysql user Create_priv 8 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Create_routine_priv 27 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Create_tablespace_priv 32 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Create_tmp_table_priv 20 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Create_user_priv 29 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Create_view_priv 25 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user default_role 46 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL +def mysql user Delete_history_priv 33 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Delete_priv 7 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Drop_priv 9 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Event_priv 30 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Execute_priv 22 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user File_priv 13 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Grant_priv 14 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) select,insert,update,references NEVER NULL +def mysql user Index_priv 16 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Insert_priv 5 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user is_role 45 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Lock_tables_priv 21 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user max_connections 40 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL +def mysql user max_questions 38 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL def mysql user max_statement_time 47 0.000000 NO decimal NULL NULL 12 6 NULL NULL NULL decimal(12,6) select,insert,update,references NEVER NULL -def mysql user max_updates 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned select,insert,update,references NEVER NULL -def mysql user max_user_connections 41 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) select,insert,update,references NEVER NULL -def mysql user Password 3 '' NO char 41 41 NULL NULL NULL latin1 latin1_bin char(41) select,insert,update,references NEVER NULL -def mysql user password_expired 44 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user plugin 42 '' NO char 64 64 NULL NULL NULL latin1 latin1_swedish_ci char(64) select,insert,update,references NEVER NULL -def mysql user Process_priv 12 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user References_priv 15 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Reload_priv 10 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Repl_client_priv 24 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Repl_slave_priv 23 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Select_priv 4 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Show_db_priv 18 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Show_view_priv 26 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Shutdown_priv 11 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user ssl_cipher 35 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL -def mysql user ssl_type 34 '' NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') select,insert,update,references NEVER NULL -def mysql user Super_priv 19 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Trigger_priv 31 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user Update_priv 6 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') select,insert,update,references NEVER NULL -def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI select,insert,update,references NEVER NULL -def mysql user x509_issuer 36 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL -def mysql user x509_subject 37 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob select,insert,update,references NEVER NULL +def mysql user max_updates 39 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned select,insert,update,references NEVER NULL +def mysql user max_user_connections 41 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) select,insert,update,references NEVER NULL +def mysql user Password 3 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL +def mysql user password_expired 44 '' NO varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user plugin 42 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL +def mysql user Process_priv 12 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user References_priv 15 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Reload_priv 10 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Repl_client_priv 24 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Repl_slave_priv 23 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Select_priv 4 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Show_db_priv 18 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Show_view_priv 26 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Shutdown_priv 11 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user ssl_cipher 35 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL +def mysql user ssl_type 34 NULL YES varchar 9 9 NULL NULL NULL latin1 latin1_swedish_ci varchar(9) select,insert,update,references NEVER NULL +def mysql user Super_priv 19 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Trigger_priv 31 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user Update_priv 6 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) select,insert,update,references NEVER NULL +def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) select,insert,update,references NEVER NULL +def mysql user x509_issuer 36 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL +def mysql user x509_subject 37 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext select,insert,update,references NEVER NULL ########################################################################## # Show the quotient of CHARACTER_OCTET_LENGTH and CHARACTER_MAXIMUM_LENGTH ########################################################################## @@ -269,11 +272,12 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME 1.0000 blob NULL NULL 1.0000 longblob NULL NULL 1.0000 varbinary NULL NULL -1.0000 char latin1 latin1_bin 1.0000 char latin1 latin1_swedish_ci +1.0000 varchar latin1 latin1_swedish_ci 1.0000 text utf8 utf8_bin 1.0000 mediumtext utf8 utf8_general_ci 1.0000 text utf8 utf8_general_ci +1.0000 longtext utf8mb4 utf8mb4_bin SELECT DISTINCT CHARACTER_OCTET_LENGTH / CHARACTER_MAXIMUM_LENGTH AS COL_CML, DATA_TYPE, @@ -380,7 +384,7 @@ NULL mysql event starts datetime NULL NULL NULL NULL datetime NULL mysql event ends datetime NULL NULL NULL NULL datetime 3.0000 mysql event status enum 18 54 utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') 3.0000 mysql event on_completion enum 8 24 utf8 utf8_general_ci enum('DROP','PRESERVE') -3.0000 mysql event sql_mode set 539 1617 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') +3.0000 mysql event sql_mode set 561 1683 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') 3.0000 mysql event comment char 64 192 utf8 utf8_bin char(64) NULL mysql event originator int NULL NULL NULL NULL int(10) unsigned 1.0000 mysql event time_zone char 64 64 latin1 latin1_swedish_ci char(64) @@ -398,6 +402,9 @@ NULL mysql general_log thread_id bigint NULL NULL NULL NULL bigint(21) unsigned NULL mysql general_log server_id int NULL NULL NULL NULL int(10) unsigned 3.0000 mysql general_log command_type varchar 64 192 utf8 utf8_general_ci varchar(64) 1.0000 mysql general_log argument mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext +3.0000 mysql global_priv Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql global_priv User char 80 240 utf8 utf8_bin char(80) +1.0000 mysql global_priv Priv longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext NULL mysql gtid_slave_pos domain_id int NULL NULL NULL NULL int(10) unsigned NULL mysql gtid_slave_pos sub_id bigint NULL NULL NULL NULL bigint(20) unsigned NULL mysql gtid_slave_pos server_id int NULL NULL NULL NULL int(10) unsigned @@ -451,7 +458,7 @@ NULL mysql innodb_table_stats sum_of_other_index_sizes bigint NULL NULL NULL NUL 3.0000 mysql proc definer char 141 423 utf8 utf8_bin char(141) NULL mysql proc created timestamp NULL NULL NULL NULL timestamp NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp -3.0000 mysql proc sql_mode set 539 1617 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') +3.0000 mysql proc sql_mode set 561 1683 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') 1.0000 mysql proc comment text 65535 65535 utf8 utf8_bin text 3.0000 mysql proc character_set_client char 32 96 utf8 utf8_bin char(32) 3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32) @@ -531,48 +538,48 @@ NULL mysql transaction_registry commit_timestamp timestamp NULL NULL NULL NULL t 3.0000 mysql transaction_registry isolation_level enum 16 48 utf8 utf8_bin enum('READ-UNCOMMITTED','READ-COMMITTED','REPEATABLE-READ','SERIALIZABLE') 3.0000 mysql user Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql user User char 80 240 utf8 utf8_bin char(80) -1.0000 mysql user Password char 41 41 latin1 latin1_bin char(41) -3.0000 mysql user Select_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Insert_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Update_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Delete_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Drop_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Reload_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Shutdown_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Process_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user File_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Grant_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user References_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Index_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Alter_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Show_db_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Super_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_tmp_table_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Lock_tables_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Repl_slave_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Repl_client_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Show_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_user_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Event_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_tablespace_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Delete_history_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user ssl_type enum 9 27 utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') -1.0000 mysql user ssl_cipher blob 65535 65535 NULL NULL blob -1.0000 mysql user x509_issuer blob 65535 65535 NULL NULL blob -1.0000 mysql user x509_subject blob 65535 65535 NULL NULL blob -NULL mysql user max_questions int NULL NULL NULL NULL int(11) unsigned -NULL mysql user max_updates int NULL NULL NULL NULL int(11) unsigned -NULL mysql user max_connections int NULL NULL NULL NULL int(11) unsigned -NULL mysql user max_user_connections int NULL NULL NULL NULL int(11) -1.0000 mysql user plugin char 64 64 latin1 latin1_swedish_ci char(64) -1.0000 mysql user authentication_string text 65535 65535 utf8 utf8_bin text -3.0000 mysql user password_expired enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user default_role char 80 240 utf8 utf8_bin char(80) +1.0000 mysql user Password longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user Select_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Insert_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Update_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Delete_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Drop_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Reload_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Shutdown_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Process_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user File_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Grant_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user References_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Index_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Alter_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Show_db_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Super_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_tmp_table_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Lock_tables_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Execute_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Repl_slave_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Repl_client_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_view_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Show_view_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_routine_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Alter_routine_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_user_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Event_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Trigger_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_tablespace_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Delete_history_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user ssl_type varchar 9 9 latin1 latin1_swedish_ci varchar(9) +1.0000 mysql user ssl_cipher longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user x509_issuer longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user x509_subject longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +NULL mysql user max_questions bigint NULL NULL NULL NULL bigint(20) unsigned +NULL mysql user max_updates bigint NULL NULL NULL NULL bigint(20) unsigned +NULL mysql user max_connections bigint NULL NULL NULL NULL bigint(20) unsigned +NULL mysql user max_user_connections bigint NULL NULL NULL NULL bigint(21) +1.0000 mysql user plugin longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user authentication_string longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user password_expired varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user is_role varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user default_role longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext NULL mysql user max_statement_time decimal NULL NULL NULL NULL decimal(12,6) diff --git a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result index 440478b892d..6ad671a54c8 100644 --- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result @@ -61,7 +61,7 @@ def mysql event modified 9 '0000-00-00 00:00:00' NO timestamp NULL NULL NULL NUL def mysql event name 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) PRI NEVER NULL def mysql event on_completion 14 'DROP' NO enum 8 24 NULL NULL NULL utf8 utf8_general_ci enum('DROP','PRESERVE') NEVER NULL def mysql event originator 17 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned NEVER NULL -def mysql event sql_mode 15 '' NO set 539 1617 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NEVER NULL +def mysql event sql_mode 15 '' NO set 561 1683 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NEVER NULL def mysql event starts 11 NULL YES datetime NULL NULL NULL NULL 0 NULL NULL datetime NEVER NULL def mysql event status 13 'ENABLED' NO enum 18 54 NULL NULL NULL utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') NEVER NULL def mysql event time_zone 18 'SYSTEM' NO char 64 64 NULL NULL NULL latin1 latin1_swedish_ci char(64) NEVER NULL @@ -75,6 +75,9 @@ def mysql general_log event_time 1 current_timestamp(6) NO timestamp NULL NULL N def mysql general_log server_id 4 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned NEVER NULL def mysql general_log thread_id 3 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(21) unsigned NEVER NULL def mysql general_log user_host 2 NULL NO mediumtext 16777215 16777215 NULL NULL NULL utf8 utf8_general_ci mediumtext NEVER NULL +def mysql global_priv Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI NEVER NULL +def mysql global_priv Priv 3 '{}' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL +def mysql global_priv User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI NEVER NULL def mysql gtid_slave_pos domain_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI NEVER NULL def mysql gtid_slave_pos seq_no 4 NULL NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned NEVER NULL def mysql gtid_slave_pos server_id 3 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned NEVER NULL @@ -119,7 +122,7 @@ def mysql proc returns 10 NULL NO longblob 4294967295 4294967295 NULL NULL NULL def mysql proc security_type 8 'DEFINER' NO enum 7 21 NULL NULL NULL utf8 utf8_general_ci enum('INVOKER','DEFINER') NEVER NULL def mysql proc specific_name 4 '' NO char 64 192 NULL NULL NULL utf8 utf8_general_ci char(64) NEVER NULL def mysql proc sql_data_access 6 'CONTAINS_SQL' NO enum 17 51 NULL NULL NULL utf8 utf8_general_ci enum('CONTAINS_SQL','NO_SQL','READS_SQL_DATA','MODIFIES_SQL_DATA') NEVER NULL -def mysql proc sql_mode 15 '' NO set 539 1617 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') NEVER NULL +def mysql proc sql_mode 15 '' NO set 561 1683 NULL NULL NULL utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') NEVER NULL def mysql proc type 3 NULL NO enum 12 36 NULL NULL NULL utf8 utf8_general_ci enum('FUNCTION','PROCEDURE','PACKAGE','PACKAGE BODY') PRI NEVER NULL def mysql procs_priv Db 2 '' NO char 64 192 NULL NULL NULL utf8 utf8_bin char(64) PRI NEVER NULL def mysql procs_priv Grantor 6 '' NO char 141 423 NULL NULL NULL utf8 utf8_bin char(141) MUL NEVER NULL @@ -187,53 +190,53 @@ def mysql time_zone_transition_type Is_DST 4 0 NO tinyint NULL NULL 3 0 NULL NUL def mysql time_zone_transition_type Offset 3 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL def mysql time_zone_transition_type Time_zone_id 1 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI NEVER NULL def mysql time_zone_transition_type Transition_type_id 2 NULL NO int NULL NULL 10 0 NULL NULL NULL int(10) unsigned PRI NEVER NULL -def mysql user Alter_priv 17 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Alter_routine_priv 28 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user authentication_string 43 NULL NO text 65535 65535 NULL NULL NULL utf8 utf8_bin text NEVER NULL -def mysql user Create_priv 8 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Create_routine_priv 27 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Create_tablespace_priv 32 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Create_tmp_table_priv 20 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Create_user_priv 29 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Create_view_priv 25 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user default_role 46 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) NEVER NULL -def mysql user Delete_history_priv 33 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Delete_priv 7 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Drop_priv 9 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Event_priv 30 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Execute_priv 22 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user File_priv 13 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Grant_priv 14 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) PRI NEVER NULL -def mysql user Index_priv 16 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Insert_priv 5 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user is_role 45 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Lock_tables_priv 21 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user max_connections 40 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned NEVER NULL -def mysql user max_questions 38 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned NEVER NULL +def mysql user Alter_priv 17 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Alter_routine_priv 28 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user authentication_string 43 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL +def mysql user Create_priv 8 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Create_routine_priv 27 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Create_tablespace_priv 32 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Create_tmp_table_priv 20 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Create_user_priv 29 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Create_view_priv 25 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user default_role 46 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL +def mysql user Delete_history_priv 33 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Delete_priv 7 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Drop_priv 9 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Event_priv 30 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Execute_priv 22 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user File_priv 13 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Grant_priv 14 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Host 1 '' NO char 60 180 NULL NULL NULL utf8 utf8_bin char(60) NEVER NULL +def mysql user Index_priv 16 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Insert_priv 5 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user is_role 45 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Lock_tables_priv 21 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user max_connections 40 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned NEVER NULL +def mysql user max_questions 38 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned NEVER NULL def mysql user max_statement_time 47 0.000000 NO decimal NULL NULL 12 6 NULL NULL NULL decimal(12,6) NEVER NULL -def mysql user max_updates 39 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) unsigned NEVER NULL -def mysql user max_user_connections 41 0 NO int NULL NULL 10 0 NULL NULL NULL int(11) NEVER NULL -def mysql user Password 3 '' NO char 41 41 NULL NULL NULL latin1 latin1_bin char(41) NEVER NULL -def mysql user password_expired 44 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user plugin 42 '' NO char 64 64 NULL NULL NULL latin1 latin1_swedish_ci char(64) NEVER NULL -def mysql user Process_priv 12 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user References_priv 15 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Reload_priv 10 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Repl_client_priv 24 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Repl_slave_priv 23 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Select_priv 4 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Show_db_priv 18 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Show_view_priv 26 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Shutdown_priv 11 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user ssl_cipher 35 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL -def mysql user ssl_type 34 '' NO enum 9 27 NULL NULL NULL utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') NEVER NULL -def mysql user Super_priv 19 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Trigger_priv 31 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user Update_priv 6 'N' NO enum 1 3 NULL NULL NULL utf8 utf8_general_ci enum('N','Y') NEVER NULL -def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) PRI NEVER NULL -def mysql user x509_issuer 36 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL -def mysql user x509_subject 37 NULL NO blob 65535 65535 NULL NULL NULL NULL NULL blob NEVER NULL +def mysql user max_updates 39 0 NO bigint NULL NULL 20 0 NULL NULL NULL bigint(20) unsigned NEVER NULL +def mysql user max_user_connections 41 0 NO bigint NULL NULL 19 0 NULL NULL NULL bigint(21) NEVER NULL +def mysql user Password 3 NULL YES longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL +def mysql user password_expired 44 '' NO varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user plugin 42 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL +def mysql user Process_priv 12 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user References_priv 15 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Reload_priv 10 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Repl_client_priv 24 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Repl_slave_priv 23 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Select_priv 4 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Show_db_priv 18 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Show_view_priv 26 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Shutdown_priv 11 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user ssl_cipher 35 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL +def mysql user ssl_type 34 NULL YES varchar 9 9 NULL NULL NULL latin1 latin1_swedish_ci varchar(9) NEVER NULL +def mysql user Super_priv 19 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Trigger_priv 31 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user Update_priv 6 NULL YES varchar 1 1 NULL NULL NULL latin1 latin1_swedish_ci varchar(1) NEVER NULL +def mysql user User 2 '' NO char 80 240 NULL NULL NULL utf8 utf8_bin char(80) NEVER NULL +def mysql user x509_issuer 36 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL +def mysql user x509_subject 37 '' NO longtext 4294967295 4294967295 NULL NULL NULL utf8mb4 utf8mb4_bin longtext NEVER NULL Warnings: Warning 1286 Unknown storage engine 'InnoDB' Warning 1286 Unknown storage engine 'InnoDB' @@ -254,11 +257,12 @@ COL_CML DATA_TYPE CHARACTER_SET_NAME COLLATION_NAME 1.0000 blob NULL NULL 1.0000 longblob NULL NULL 1.0000 varbinary NULL NULL -1.0000 char latin1 latin1_bin 1.0000 char latin1 latin1_swedish_ci +1.0000 varchar latin1 latin1_swedish_ci 1.0000 text utf8 utf8_bin 1.0000 mediumtext utf8 utf8_general_ci 1.0000 text utf8 utf8_general_ci +1.0000 longtext utf8mb4 utf8mb4_bin Warnings: Warning 1286 Unknown storage engine 'InnoDB' Warning 1286 Unknown storage engine 'InnoDB' @@ -377,7 +381,7 @@ NULL mysql event starts datetime NULL NULL NULL NULL datetime NULL mysql event ends datetime NULL NULL NULL NULL datetime 3.0000 mysql event status enum 18 54 utf8 utf8_general_ci enum('ENABLED','DISABLED','SLAVESIDE_DISABLED') 3.0000 mysql event on_completion enum 8 24 utf8 utf8_general_ci enum('DROP','PRESERVE') -3.0000 mysql event sql_mode set 539 1617 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') +3.0000 mysql event sql_mode set 561 1683 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') 3.0000 mysql event comment char 64 192 utf8 utf8_bin char(64) NULL mysql event originator int NULL NULL NULL NULL int(10) unsigned 1.0000 mysql event time_zone char 64 64 latin1 latin1_swedish_ci char(64) @@ -395,6 +399,9 @@ NULL mysql general_log thread_id bigint NULL NULL NULL NULL bigint(21) unsigned NULL mysql general_log server_id int NULL NULL NULL NULL int(10) unsigned 3.0000 mysql general_log command_type varchar 64 192 utf8 utf8_general_ci varchar(64) 1.0000 mysql general_log argument mediumtext 16777215 16777215 utf8 utf8_general_ci mediumtext +3.0000 mysql global_priv Host char 60 180 utf8 utf8_bin char(60) +3.0000 mysql global_priv User char 80 240 utf8 utf8_bin char(80) +1.0000 mysql global_priv Priv longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext NULL mysql gtid_slave_pos domain_id int NULL NULL NULL NULL int(10) unsigned NULL mysql gtid_slave_pos sub_id bigint NULL NULL NULL NULL bigint(20) unsigned NULL mysql gtid_slave_pos server_id int NULL NULL NULL NULL int(10) unsigned @@ -434,7 +441,7 @@ NULL mysql index_stats avg_frequency decimal NULL NULL NULL NULL decimal(12,4) 3.0000 mysql proc definer char 141 423 utf8 utf8_bin char(141) NULL mysql proc created timestamp NULL NULL NULL NULL timestamp NULL mysql proc modified timestamp NULL NULL NULL NULL timestamp -3.0000 mysql proc sql_mode set 539 1617 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT') +3.0000 mysql proc sql_mode set 561 1683 utf8 utf8_general_ci set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','IGNORE_BAD_TABLE_OPTIONS','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH','EMPTY_STRING_IS_NULL','SIMULTANEOUS_ASSIGNMENT','TIME_ROUND_FRACTIONAL') 1.0000 mysql proc comment text 65535 65535 utf8 utf8_bin text 3.0000 mysql proc character_set_client char 32 96 utf8 utf8_bin char(32) 3.0000 mysql proc collation_connection char 32 96 utf8 utf8_bin char(32) @@ -509,50 +516,50 @@ NULL mysql time_zone_transition_type Is_DST tinyint NULL NULL NULL NULL tinyint( 3.0000 mysql time_zone_transition_type Abbreviation char 8 24 utf8 utf8_general_ci char(8) 3.0000 mysql user Host char 60 180 utf8 utf8_bin char(60) 3.0000 mysql user User char 80 240 utf8 utf8_bin char(80) -1.0000 mysql user Password char 41 41 latin1 latin1_bin char(41) -3.0000 mysql user Select_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Insert_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Update_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Delete_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Drop_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Reload_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Shutdown_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Process_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user File_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Grant_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user References_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Index_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Alter_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Show_db_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Super_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_tmp_table_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Lock_tables_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Execute_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Repl_slave_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Repl_client_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Show_view_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Alter_routine_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_user_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Event_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Trigger_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Create_tablespace_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user Delete_history_priv enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user ssl_type enum 9 27 utf8 utf8_general_ci enum('','ANY','X509','SPECIFIED') -1.0000 mysql user ssl_cipher blob 65535 65535 NULL NULL blob -1.0000 mysql user x509_issuer blob 65535 65535 NULL NULL blob -1.0000 mysql user x509_subject blob 65535 65535 NULL NULL blob -NULL mysql user max_questions int NULL NULL NULL NULL int(11) unsigned -NULL mysql user max_updates int NULL NULL NULL NULL int(11) unsigned -NULL mysql user max_connections int NULL NULL NULL NULL int(11) unsigned -NULL mysql user max_user_connections int NULL NULL NULL NULL int(11) -1.0000 mysql user plugin char 64 64 latin1 latin1_swedish_ci char(64) -1.0000 mysql user authentication_string text 65535 65535 utf8 utf8_bin text -3.0000 mysql user password_expired enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user is_role enum 1 3 utf8 utf8_general_ci enum('N','Y') -3.0000 mysql user default_role char 80 240 utf8 utf8_bin char(80) +1.0000 mysql user Password longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user Select_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Insert_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Update_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Delete_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Drop_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Reload_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Shutdown_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Process_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user File_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Grant_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user References_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Index_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Alter_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Show_db_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Super_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_tmp_table_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Lock_tables_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Execute_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Repl_slave_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Repl_client_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_view_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Show_view_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_routine_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Alter_routine_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_user_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Event_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Trigger_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Create_tablespace_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user Delete_history_priv varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user ssl_type varchar 9 9 latin1 latin1_swedish_ci varchar(9) +1.0000 mysql user ssl_cipher longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user x509_issuer longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user x509_subject longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +NULL mysql user max_questions bigint NULL NULL NULL NULL bigint(20) unsigned +NULL mysql user max_updates bigint NULL NULL NULL NULL bigint(20) unsigned +NULL mysql user max_connections bigint NULL NULL NULL NULL bigint(20) unsigned +NULL mysql user max_user_connections bigint NULL NULL NULL NULL bigint(21) +1.0000 mysql user plugin longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user authentication_string longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext +1.0000 mysql user password_expired varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user is_role varchar 1 1 latin1 latin1_swedish_ci varchar(1) +1.0000 mysql user default_role longtext 4294967295 4294967295 utf8mb4 utf8mb4_bin longtext NULL mysql user max_statement_time decimal NULL NULL NULL NULL decimal(12,6) Warnings: Warning 1286 Unknown storage engine 'InnoDB' diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage.result b/mysql-test/suite/funcs_1/r/is_key_column_usage.result index 326ea3f4acc..efb67e32cee 100644 --- a/mysql-test/suite/funcs_1/r/is_key_column_usage.result +++ b/mysql-test/suite/funcs_1/r/is_key_column_usage.result @@ -90,6 +90,8 @@ def mysql PRIMARY def mysql db User def mysql PRIMARY def mysql event db def mysql PRIMARY def mysql event name def mysql PRIMARY def mysql func name +def mysql PRIMARY def mysql global_priv Host +def mysql PRIMARY def mysql global_priv User def mysql PRIMARY def mysql gtid_slave_pos domain_id def mysql PRIMARY def mysql gtid_slave_pos sub_id def mysql PRIMARY def mysql help_category help_category_id @@ -142,8 +144,6 @@ def mysql PRIMARY def mysql time_zone_transition_type Time_zone_id def mysql PRIMARY def mysql time_zone_transition_type Transition_type_id def mysql commit_id def mysql transaction_registry commit_id def mysql PRIMARY def mysql transaction_registry transaction_id -def mysql PRIMARY def mysql user Host -def mysql PRIMARY def mysql user User ######################################################################################## # Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.KEY_COLUMN_USAGE accessible information ######################################################################################## diff --git a/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result b/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result index a547b1ddf61..cf67be8f7a0 100644 --- a/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_key_column_usage_embedded.result @@ -90,6 +90,8 @@ def mysql PRIMARY def mysql db User def mysql PRIMARY def mysql event db def mysql PRIMARY def mysql event name def mysql PRIMARY def mysql func name +def mysql PRIMARY def mysql global_priv Host +def mysql PRIMARY def mysql global_priv User def mysql PRIMARY def mysql gtid_slave_pos domain_id def mysql PRIMARY def mysql gtid_slave_pos sub_id def mysql PRIMARY def mysql help_category help_category_id @@ -142,8 +144,6 @@ def mysql PRIMARY def mysql time_zone_transition_type Time_zone_id def mysql PRIMARY def mysql time_zone_transition_type Transition_type_id def mysql commit_id def mysql transaction_registry commit_id def mysql PRIMARY def mysql transaction_registry transaction_id -def mysql PRIMARY def mysql user Host -def mysql PRIMARY def mysql user User ######################################################################################## # Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.KEY_COLUMN_USAGE accessible information ######################################################################################## diff --git a/mysql-test/suite/funcs_1/r/is_routines_embedded.result b/mysql-test/suite/funcs_1/r/is_routines_embedded.result index 4f3b14761a9..02d2867b657 100644 --- a/mysql-test/suite/funcs_1/r/is_routines_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_routines_embedded.result @@ -197,8 +197,8 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL SELECT * FROM db_datadict_2.res_6_408002_2; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci connect testuser2, localhost, testuser2, , db_datadict; SELECT * FROM information_schema.routines; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -209,8 +209,8 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL SELECT * FROM db_datadict_2.res_6_408002_2; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci connect testuser3, localhost, testuser3, , test; SELECT * FROM information_schema.routines; SPECIFIC_NAME ROUTINE_CATALOG ROUTINE_SCHEMA ROUTINE_NAME ROUTINE_TYPE DATA_TYPE CHARACTER_MAXIMUM_LENGTH CHARACTER_OCTET_LENGTH NUMERIC_PRECISION NUMERIC_SCALE DATETIME_PRECISION CHARACTER_SET_NAME COLLATION_NAME DTD_IDENTIFIER ROUTINE_BODY ROUTINE_DEFINITION EXTERNAL_NAME EXTERNAL_LANGUAGE PARAMETER_STYLE IS_DETERMINISTIC SQL_DATA_ACCESS SQL_PATH SECURITY_TYPE CREATED LAST_ALTERED SQL_MODE ROUTINE_COMMENT DEFINER CHARACTER_SET_CLIENT COLLATION_CONNECTION DATABASE_COLLATION @@ -221,8 +221,8 @@ sp_6_408002_2 def db_datadict_2 sp_6_408002_2 PROCEDURE NULL NULL NULL NULL NUL SELECT * FROM db_datadict_2.res_6_408002_2; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost latin1 latin1_swedish_ci latin1_swedish_ci add_suppression def mtr add_suppression PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN INSERT INTO test_suppressions (pattern) VALUES (pattern); FLUSH NO_WRITE_TO_BINLOG TABLE test_suppressions; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.user; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci -check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_testcase def mtr check_testcase PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE variable_name NOT IN ('timestamp') AND variable_name not like "Last_IO_Err*" AND variable_name != 'INNODB_IBUF_MAX_SIZE' AND variable_name != 'INNODB_USE_NATIVE_AIO' AND variable_name != 'INNODB_BUFFER_POOL_LOAD_AT_STARTUP' AND variable_name not like 'GTID%POS' AND variable_name != 'GTID_BINLOG_STATE' AND variable_name != 'AUTO_INCREMENT_INCREMENT' ORDER BY variable_name; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA ORDER BY BINARY SCHEMA_NAME; SELECT * FROM INFORMATION_SCHEMA.SCHEMATA WHERE SCHEMA_NAME NOT IN ('mtr_wsrep_notify', 'wsrep_schema') ORDER BY BINARY SCHEMA_NAME; SELECT table_name AS tables_in_test FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='test'; SELECT CONCAT(table_schema, '.', table_name) AS tables_in_mysql FROM INFORMATION_SCHEMA.TABLES WHERE table_schema='mysql' ORDER BY tables_in_mysql; SELECT CONCAT(table_schema, '.', table_name) AS columns_in_mysql, column_name, ordinal_position, column_default, is_nullable, data_type, character_maximum_length, character_octet_length, numeric_precision, numeric_scale, character_set_name, collation_name, column_type, column_key, extra, column_comment FROM INFORMATION_SCHEMA.COLUMNS WHERE table_schema='mysql' ORDER BY columns_in_mysql; SELECT * FROM INFORMATION_SCHEMA.EVENTS; SELECT * FROM INFORMATION_SCHEMA.TRIGGERS WHERE TRIGGER_NAME NOT IN ('gs_insert', 'ts_insert'); SELECT * FROM INFORMATION_SCHEMA.ROUTINES; SHOW STATUS LIKE 'slave_open_temp_tables'; checksum table mysql.columns_priv, mysql.db, mysql.func, mysql.help_category, mysql.help_keyword, mysql.help_relation, mysql.plugin, mysql.proc, mysql.procs_priv, mysql.roles_mapping, mysql.tables_priv, mysql.time_zone, mysql.time_zone_leap_second, mysql.time_zone_name, mysql.time_zone_transition, mysql.time_zone_transition_type, mysql.global_priv; SELECT * FROM INFORMATION_SCHEMA.PLUGINS; select * from information_schema.session_variables where variable_name = 'debug_sync'; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci +check_warnings def mtr check_warnings PROCEDURE NULL NULL NULL NULL NULL NULL NULL NULL SQL BEGIN DECLARE `pos` bigint unsigned; SET SQL_LOG_BIN=0, SQL_SAFE_UPDATES=0; UPDATE error_log el, global_suppressions gs SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP gs.pattern; UPDATE error_log el, test_suppressions ts SET suspicious=0 WHERE el.suspicious=1 AND el.line REGEXP ts.pattern; SELECT COUNT(*) INTO @num_warnings FROM error_log WHERE suspicious=1; IF @num_warnings > 0 THEN SELECT line FROM error_log WHERE suspicious=1; SELECT 2 INTO result; ELSE SELECT 0 INTO RESULT; END IF; TRUNCATE test_suppressions; DROP TABLE error_log; END NULL NULL SQL NO CONTAINS SQL NULL DEFINER YYYY-MM-DD hh:mm:ss YYYY-MM-DD hh:mm:ss root@localhost utf8 utf8_general_ci latin1_swedish_ci connection default; disconnect testuser1; disconnect testuser2; diff --git a/mysql-test/suite/funcs_1/r/is_statistics.result b/mysql-test/suite/funcs_1/r/is_statistics.result index 2cb94b657cc..bacc106a1be 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics.result +++ b/mysql-test/suite/funcs_1/r/is_statistics.result @@ -101,6 +101,8 @@ def mysql db mysql User def mysql event mysql PRIMARY def mysql event mysql PRIMARY def mysql func mysql PRIMARY +def mysql global_priv mysql PRIMARY +def mysql global_priv mysql PRIMARY def mysql gtid_slave_pos mysql PRIMARY def mysql gtid_slave_pos mysql PRIMARY def mysql help_category mysql name @@ -148,8 +150,6 @@ def mysql time_zone_transition mysql PRIMARY def mysql time_zone_transition mysql PRIMARY def mysql time_zone_transition_type mysql PRIMARY def mysql time_zone_transition_type mysql PRIMARY -def mysql user mysql PRIMARY -def mysql user mysql PRIMARY Warnings: Warning 1286 Unknown storage engine 'InnoDB' Warning 1286 Unknown storage engine 'InnoDB' diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result index 96d85a0425f..c01c456edf8 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql.result @@ -22,6 +22,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE +def mysql global_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +def mysql global_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE @@ -80,8 +82,6 @@ def mysql transaction_registry 0 mysql commit_id 1 commit_id A #CARD# NULL NULL def mysql transaction_registry 1 mysql commit_timestamp 1 commit_timestamp A #CARD# NULL NULL BTREE def mysql transaction_registry 1 mysql commit_timestamp 2 transaction_id A #CARD# NULL NULL BTREE def mysql transaction_registry 0 mysql PRIMARY 1 transaction_id A #CARD# NULL NULL BTREE -def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE -def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE connect testuser1,localhost,testuser1,,db_datadict; SELECT * FROM information_schema.statistics WHERE table_schema = 'mysql' diff --git a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result index 69a502e53dd..b7bd3ec2e23 100644 --- a/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_statistics_mysql_embedded.result @@ -22,6 +22,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE +def mysql global_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +def mysql global_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE @@ -80,8 +82,6 @@ def mysql transaction_registry 0 mysql commit_id 1 commit_id A #CARD# NULL NULL def mysql transaction_registry 1 mysql commit_timestamp 1 commit_timestamp A #CARD# NULL NULL BTREE def mysql transaction_registry 1 mysql commit_timestamp 2 transaction_id A #CARD# NULL NULL BTREE def mysql transaction_registry 0 mysql PRIMARY 1 transaction_id A #CARD# NULL NULL BTREE -def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE -def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE connect testuser1,localhost,testuser1,,db_datadict; SELECT * FROM information_schema.statistics WHERE table_schema = 'mysql' @@ -102,6 +102,8 @@ def mysql db 1 mysql User 1 User A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 1 db A #CARD# NULL NULL BTREE def mysql event 0 mysql PRIMARY 2 name A #CARD# NULL NULL BTREE def mysql func 0 mysql PRIMARY 1 name A #CARD# NULL NULL BTREE +def mysql global_priv 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE +def mysql global_priv 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE def mysql gtid_slave_pos 0 mysql PRIMARY 1 domain_id A #CARD# NULL NULL BTREE def mysql gtid_slave_pos 0 mysql PRIMARY 2 sub_id A #CARD# NULL NULL BTREE def mysql help_category 0 mysql name 1 name A #CARD# NULL NULL BTREE @@ -160,8 +162,6 @@ def mysql transaction_registry 0 mysql commit_id 1 commit_id A #CARD# NULL NULL def mysql transaction_registry 1 mysql commit_timestamp 1 commit_timestamp A #CARD# NULL NULL BTREE def mysql transaction_registry 1 mysql commit_timestamp 2 transaction_id A #CARD# NULL NULL BTREE def mysql transaction_registry 0 mysql PRIMARY 1 transaction_id A #CARD# NULL NULL BTREE -def mysql user 0 mysql PRIMARY 1 Host A #CARD# NULL NULL BTREE -def mysql user 0 mysql PRIMARY 2 User A #CARD# NULL NULL BTREE connection default; disconnect testuser1; DROP USER testuser1@localhost; diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints.result b/mysql-test/suite/funcs_1/r/is_table_constraints.result index cb7aa1f8fc0..bc0f9a724a1 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints.result @@ -63,6 +63,8 @@ def mysql PRIMARY mysql column_stats def mysql PRIMARY mysql db def mysql PRIMARY mysql event def mysql PRIMARY mysql func +def mysql PRIMARY mysql global_priv +def mysql Priv mysql global_priv def mysql PRIMARY mysql gtid_slave_pos def mysql name mysql help_category def mysql PRIMARY mysql help_category @@ -89,7 +91,6 @@ def mysql PRIMARY mysql time_zone_transition def mysql PRIMARY mysql time_zone_transition_type def mysql commit_id mysql transaction_registry def mysql PRIMARY mysql transaction_registry -def mysql PRIMARY mysql user ######################################################################################### # Testcase 3.2.7.2 + 3.2.7.3: INFORMATION_SCHEMA.TABLE_CONSTRAINTS accessible information ######################################################################################### diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result index fc9ba660467..d5da807388b 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql.result @@ -12,6 +12,8 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY def mysql PRIMARY mysql db PRIMARY KEY def mysql PRIMARY mysql event PRIMARY KEY def mysql PRIMARY mysql func PRIMARY KEY +def mysql PRIMARY mysql global_priv PRIMARY KEY +def mysql Priv mysql global_priv CHECK def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY def mysql name mysql help_category UNIQUE def mysql PRIMARY mysql help_category PRIMARY KEY @@ -38,7 +40,6 @@ def mysql PRIMARY mysql time_zone_transition PRIMARY KEY def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY def mysql commit_id mysql transaction_registry UNIQUE def mysql PRIMARY mysql transaction_registry PRIMARY KEY -def mysql PRIMARY mysql user PRIMARY KEY connect testuser1,localhost,testuser1,,db_datadict; SELECT * FROM information_schema.table_constraints WHERE table_schema = 'mysql' diff --git a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result index 54e27e22140..0426877bc1c 100644 --- a/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_table_constraints_mysql_embedded.result @@ -12,6 +12,8 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY def mysql PRIMARY mysql db PRIMARY KEY def mysql PRIMARY mysql event PRIMARY KEY def mysql PRIMARY mysql func PRIMARY KEY +def mysql PRIMARY mysql global_priv PRIMARY KEY +def mysql Priv mysql global_priv CHECK def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY def mysql name mysql help_category UNIQUE def mysql PRIMARY mysql help_category PRIMARY KEY @@ -38,7 +40,6 @@ def mysql PRIMARY mysql time_zone_transition PRIMARY KEY def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY def mysql commit_id mysql transaction_registry UNIQUE def mysql PRIMARY mysql transaction_registry PRIMARY KEY -def mysql PRIMARY mysql user PRIMARY KEY connect testuser1,localhost,testuser1,,db_datadict; SELECT * FROM information_schema.table_constraints WHERE table_schema = 'mysql' @@ -49,6 +50,8 @@ def mysql PRIMARY mysql column_stats PRIMARY KEY def mysql PRIMARY mysql db PRIMARY KEY def mysql PRIMARY mysql event PRIMARY KEY def mysql PRIMARY mysql func PRIMARY KEY +def mysql PRIMARY mysql global_priv PRIMARY KEY +def mysql Priv mysql global_priv CHECK def mysql PRIMARY mysql gtid_slave_pos PRIMARY KEY def mysql name mysql help_category UNIQUE def mysql PRIMARY mysql help_category PRIMARY KEY @@ -75,7 +78,6 @@ def mysql PRIMARY mysql time_zone_transition PRIMARY KEY def mysql PRIMARY mysql time_zone_transition_type PRIMARY KEY def mysql commit_id mysql transaction_registry UNIQUE def mysql PRIMARY mysql transaction_registry PRIMARY KEY -def mysql PRIMARY mysql user PRIMARY KEY connection default; disconnect testuser1; DROP USER testuser1@localhost; diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql.result b/mysql-test/suite/funcs_1/r/is_tables_mysql.result index 9d1539bc778..be432e2422a 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result @@ -162,6 +162,31 @@ user_comment General log Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME global_priv +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 11 +ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +MAX_INDEX_LENGTH #MIL# +TEMPORARY N +user_comment Users and global privileges +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME gtid_slave_pos TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA @@ -738,10 +763,10 @@ Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql TABLE_NAME user -TABLE_TYPE BASE TABLE -ENGINE MYISAM_OR_MARIA -VERSION 10 -ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_TYPE VIEW +ENGINE NULL +VERSION NULL +ROW_FORMAT NULL TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -752,13 +777,13 @@ AUTO_INCREMENT NULL CREATE_TIME #CRT# UPDATE_TIME #UT# CHECK_TIME #CT# -TABLE_COLLATION utf8_bin +TABLE_COLLATION NULL CHECKSUM NULL CREATE_OPTIONS #CO# TABLE_COMMENT #TC# MAX_INDEX_LENGTH #MIL# -TEMPORARY N -user_comment Users and global privileges +TEMPORARY NULL +user_comment VIEW Separator ----------------------------------------------------- DROP USER testuser1@localhost; CREATE USER testuser1@localhost; diff --git a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result index c28b4b45ede..01381a5e746 100644 --- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result +++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result @@ -162,6 +162,31 @@ user_comment General log Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME global_priv +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 11 +ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +MAX_INDEX_LENGTH #MIL# +TEMPORARY N +user_comment Users and global privileges +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME gtid_slave_pos TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA @@ -738,10 +763,10 @@ Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql TABLE_NAME user -TABLE_TYPE BASE TABLE -ENGINE MYISAM_OR_MARIA -VERSION 10 -ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_TYPE VIEW +ENGINE NULL +VERSION NULL +ROW_FORMAT NULL TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -752,13 +777,13 @@ AUTO_INCREMENT NULL CREATE_TIME #CRT# UPDATE_TIME #UT# CHECK_TIME #CT# -TABLE_COLLATION utf8_bin +TABLE_COLLATION NULL CHECKSUM NULL CREATE_OPTIONS #CO# TABLE_COMMENT #TC# MAX_INDEX_LENGTH #MIL# -TEMPORARY N -user_comment Users and global privileges +TEMPORARY NULL +user_comment VIEW Separator ----------------------------------------------------- DROP USER testuser1@localhost; CREATE USER testuser1@localhost; @@ -926,6 +951,31 @@ user_comment General log Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql +TABLE_NAME global_priv +TABLE_TYPE BASE TABLE +ENGINE MYISAM_OR_MARIA +VERSION 11 +ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_ROWS #TBLR# +AVG_ROW_LENGTH #ARL# +DATA_LENGTH #DL# +MAX_DATA_LENGTH #MDL# +INDEX_LENGTH #IL# +DATA_FREE #DF# +AUTO_INCREMENT NULL +CREATE_TIME #CRT# +UPDATE_TIME #UT# +CHECK_TIME #CT# +TABLE_COLLATION utf8_bin +CHECKSUM NULL +CREATE_OPTIONS #CO# +TABLE_COMMENT #TC# +MAX_INDEX_LENGTH #MIL# +TEMPORARY N +user_comment Users and global privileges +Separator ----------------------------------------------------- +TABLE_CATALOG def +TABLE_SCHEMA mysql TABLE_NAME gtid_slave_pos TABLE_TYPE BASE TABLE ENGINE MYISAM_OR_MARIA @@ -1502,10 +1552,10 @@ Separator ----------------------------------------------------- TABLE_CATALOG def TABLE_SCHEMA mysql TABLE_NAME user -TABLE_TYPE BASE TABLE -ENGINE MYISAM_OR_MARIA -VERSION 10 -ROW_FORMAT DYNAMIC_OR_PAGE +TABLE_TYPE VIEW +ENGINE NULL +VERSION NULL +ROW_FORMAT NULL TABLE_ROWS #TBLR# AVG_ROW_LENGTH #ARL# DATA_LENGTH #DL# @@ -1516,13 +1566,13 @@ AUTO_INCREMENT NULL CREATE_TIME #CRT# UPDATE_TIME #UT# CHECK_TIME #CT# -TABLE_COLLATION utf8_bin +TABLE_COLLATION NULL CHECKSUM NULL CREATE_OPTIONS #CO# TABLE_COMMENT #TC# MAX_INDEX_LENGTH #MIL# -TEMPORARY N -user_comment Users and global privileges +TEMPORARY NULL +user_comment VIEW Separator ----------------------------------------------------- connection default; disconnect testuser1; diff --git a/mysql-test/suite/funcs_1/r/is_user_privileges.result b/mysql-test/suite/funcs_1/r/is_user_privileges.result index cb619831baa..fe181fbf069 100644 --- a/mysql-test/suite/funcs_1/r/is_user_privileges.result +++ b/mysql-test/suite/funcs_1/r/is_user_privileges.result @@ -54,7 +54,6 @@ grantee table_catalog privilege_type # Testcases 3.2.16.2+3.2.16.3+3.2.16.4: INFORMATION_SCHEMA.USER_PRIVILEGES # accessible information ########################################################################## -DROP DATABASE IF EXISTS db_datadict; CREATE DATABASE db_datadict; DROP USER 'testuser1'@'localhost'; CREATE USER 'testuser1'@'localhost'; @@ -63,7 +62,7 @@ CREATE USER 'testuser2'@'localhost'; DROP USER 'testuser3'@'localhost'; CREATE USER 'testuser3'@'localhost'; GRANT SELECT ON db_datadict.* TO 'testuser1'@'localhost'; -GRANT SELECT ON mysql.user TO 'testuser1'@'localhost'; +GRANT SELECT ON mysql.global_priv TO 'testuser1'@'localhost'; GRANT INSERT ON *.* TO 'testuser2'@'localhost'; GRANT UPDATE ON *.* TO 'testuser2'@'localhost'; SELECT * FROM information_schema.user_privileges @@ -85,149 +84,29 @@ GRANTEE 'testuser3'@'localhost' TABLE_CATALOG def PRIVILEGE_TYPE USAGE IS_GRANTABLE NO -SELECT * FROM mysql.user +SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -Host localhost -User testuser1 -Password -Select_priv N -Insert_priv N -Update_priv N -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 -Host localhost -User testuser2 -Password -Select_priv N -Insert_priv Y -Update_priv Y -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 -Host localhost -User testuser3 -Password -Select_priv N -Insert_priv N -Update_priv N -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 +host localhost +user testuser1 +json_detailed(priv) { + "access": 0, + "plugin": "mysql_native_password", + "authentication_string": "" +} +host localhost +user testuser2 +json_detailed(priv) { + "access": 6, + "plugin": "mysql_native_password", + "authentication_string": "" +} +host localhost +user testuser3 +json_detailed(priv) { + "access": 0, + "plugin": "mysql_native_password", + "authentication_string": "" +} # # Add GRANT OPTION db_datadict.* to testuser1; GRANT UPDATE ON db_datadict.* TO 'testuser1'@'localhost' WITH GRANT OPTION; @@ -250,149 +129,29 @@ GRANTEE 'testuser3'@'localhost' TABLE_CATALOG def PRIVILEGE_TYPE USAGE IS_GRANTABLE NO -SELECT * FROM mysql.user +SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -Host localhost -User testuser1 -Password -Select_priv N -Insert_priv N -Update_priv N -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 -Host localhost -User testuser2 -Password -Select_priv N -Insert_priv Y -Update_priv Y -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 -Host localhost -User testuser3 -Password -Select_priv N -Insert_priv N -Update_priv N -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 +host localhost +user testuser1 +json_detailed(priv) { + "access": 0, + "plugin": "mysql_native_password", + "authentication_string": "" +} +host localhost +user testuser2 +json_detailed(priv) { + "access": 6, + "plugin": "mysql_native_password", + "authentication_string": "" +} +host localhost +user testuser3 +json_detailed(priv) { + "access": 0, + "plugin": "mysql_native_password", + "authentication_string": "" +} connect testuser1, localhost, testuser1, , db_datadict; SELECT * FROM information_schema.user_privileges WHERE grantee LIKE '''testuser%''' @@ -401,154 +160,34 @@ GRANTEE 'testuser1'@'localhost' TABLE_CATALOG def PRIVILEGE_TYPE USAGE IS_GRANTABLE NO -SELECT * FROM mysql.user +SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -Host localhost -User testuser1 -Password -Select_priv N -Insert_priv N -Update_priv N -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 -Host localhost -User testuser2 -Password -Select_priv N -Insert_priv Y -Update_priv Y -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 -Host localhost -User testuser3 -Password -Select_priv N -Insert_priv N -Update_priv N -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 +host localhost +user testuser1 +json_detailed(priv) { + "access": 0, + "plugin": "mysql_native_password", + "authentication_string": "" +} +host localhost +user testuser2 +json_detailed(priv) { + "access": 6, + "plugin": "mysql_native_password", + "authentication_string": "" +} +host localhost +user testuser3 +json_detailed(priv) { + "access": 0, + "plugin": "mysql_native_password", + "authentication_string": "" +} SHOW GRANTS; Grants for testuser1@localhost GRANT USAGE ON *.* TO 'testuser1'@'localhost' GRANT SELECT, UPDATE ON `db_datadict`.* TO 'testuser1'@'localhost' WITH GRANT OPTION -GRANT SELECT ON `mysql`.`user` TO 'testuser1'@'localhost' +GRANT SELECT ON `mysql`.`global_priv` TO 'testuser1'@'localhost' # Now add SELECT on *.* to testuser1; connection default; @@ -574,149 +213,29 @@ GRANTEE 'testuser3'@'localhost' TABLE_CATALOG def PRIVILEGE_TYPE USAGE IS_GRANTABLE NO -SELECT * FROM mysql.user +SELECT host,user,json_detailed(priv) FROM mysql.global_priv WHERE user LIKE 'testuser%' ORDER BY host, user; -Host localhost -User testuser1 -Password -Select_priv Y -Insert_priv N -Update_priv N -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 -Host localhost -User testuser2 -Password -Select_priv N -Insert_priv Y -Update_priv Y -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 -Host localhost -User testuser3 -Password -Select_priv N -Insert_priv N -Update_priv N -Delete_priv N -Create_priv N -Drop_priv N -Reload_priv N -Shutdown_priv N -Process_priv N -File_priv N -Grant_priv N -References_priv N -Index_priv N -Alter_priv N -Show_db_priv N -Super_priv N -Create_tmp_table_priv N -Lock_tables_priv N -Execute_priv N -Repl_slave_priv N -Repl_client_priv N -Create_view_priv N -Show_view_priv N -Create_routine_priv N -Alter_routine_priv N -Create_user_priv N -Event_priv N -Trigger_priv N -Create_tablespace_priv N -Delete_history_priv N -ssl_type -ssl_cipher -x509_issuer -x509_subject -max_questions 0 -max_updates 0 -max_connections 0 -max_user_connections 0 -plugin -authentication_string -password_expired N -is_role N -default_role -max_statement_time 0.000000 +host localhost +user testuser1 +json_detailed(priv) { + "access": 1, + "plugin": "mysql_native_password", + "authentication_string": "" +} +host localhost +user testuser2 +json_detailed(priv) { + "access": 6, + "plugin": "mysql_native_password", + "authentication_string": "" +} +host localhost +user testuser3 +json_detailed(priv) { + "access": 0, + "plugin": "mysql_native_password", + "authentication_string": "" +} GRANT SELECT ON *.* TO 'testuser1'@'localhost' WITH GRANT OPTION; # # Here INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT INTO ;' is deprecated and will be removed in a future release. Please use 'SELECT